X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;ds=sidebyside;f=make_dungeon.py;h=5618e631c9f34098e7de2fbfa80b5d9d85311b54;hb=0d0b8df0a3f6dc7b765c35fa7cc2d2fe52406d87;hp=7e18d76c41da7851a2c0b9deaa5989dc5a18ad88;hpb=3c8482a6136167677bd46d647e90d649035ebe97;p=open-adventure.git diff --git a/make_dungeon.py b/make_dungeon.py index 7e18d76..5618e63 100755 --- a/make_dungeon.py +++ b/make_dungeon.py @@ -175,6 +175,7 @@ extern const action_t actions[]; extern const action_t specials[]; extern const travelop_t travel[]; extern const long tkey[]; +extern const char *ignore; #define NLOCATIONS {} #define NOBJECTS {} @@ -266,12 +267,14 @@ const action_t specials[] = {{ {} }}; -{} +const long tkey[] = {{{}}}; const travelop_t travel[] = {{ {} }}; +const char *ignore = \"{}\"; + /* end */ """ @@ -519,6 +522,11 @@ def get_motions(motions): else: words_str = get_string_group(contents["words"]) mot_str += template.format(words_str) + global ignore + if contents.get("oldstyle", True) == False: + for word in contents["words"]: + if len(word) == 1: + ignore += word.upper() return mot_str def get_actions(actions): @@ -542,6 +550,11 @@ def get_actions(actions): message = contents["message"] act_str += template.format(words_str, message) + global ignore + if contents.get("oldstyle", True) == False: + for word in contents["words"]: + if len(word) == 1: + ignore += word.upper() act_str = act_str[:-1] # trim trailing newline return act_str @@ -552,7 +565,7 @@ def bigdump(arr): if out and out[-1] == ' ': out = out[:-1] out += "\n " - out += str(arr[i]) + ", " + out += str(arr[i]).lower() + ", " out = out[:-2] + "\n" return out @@ -697,7 +710,7 @@ if __name__ == "__main__": (travel, tkey) = buildtravel(db["locations"], db["objects"]) - + ignore = "" c = c_template.format( h_name, get_arbitrary_messages(db["arbitrary_messages"]), @@ -711,8 +724,9 @@ if __name__ == "__main__": get_motions(db["motions"]), get_actions(db["actions"]), get_actions(db["specials"]), - "const long tkey[] = {%s};" % bigdump(tkey), + bigdump(tkey), get_travel(travel), + ignore, ) h = h_template.format(