X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=newdungeon.py;h=193fe03afffbe49abfc359b02959f55320cbc9f9;hb=94d1aa5183c4dde59f6a8789e06ccfcaf1e1e1b2;hp=52380e6705c55a5774c15055c5d079eca892f084;hpb=c3a71f6db6781e40a9e75bb1107c901d791aab04;p=open-adventure.git diff --git a/newdungeon.py b/newdungeon.py index 52380e6..193fe03 100755 --- a/newdungeon.py +++ b/newdungeon.py @@ -9,6 +9,8 @@ h_name = "newdb.h" c_name = "newdb.c" h_template = """/* Generated from adventure.yaml - do not hand-hack! */ +#ifndef NEWDB_H +#define NEWDB_H #include @@ -61,6 +63,7 @@ extern hint_t hints[]; extern const size_t CLSSES; extern const int maximum_deaths; extern const int turn_threshold_count; +#define HINT_COUNT {} enum arbitrary_messages_refs {{ {} @@ -74,7 +77,7 @@ enum object_descriptions_refs {{ {} }}; -/* end */ +#endif /* end NEWDB_H */ """ c_template = """/* Generated from adventure.yaml - do not hand-hack! */ @@ -237,7 +240,8 @@ def get_hints(hnt, arb): """ hnt_str = "" md = dict(arb) - for item in hnt: + for member in hnt: + item = member["hint"] number = item["number"] penalty = item["penalty"] turns = item["turns"] @@ -253,6 +257,7 @@ if __name__ == "__main__": db = yaml.load(f) h = h_template.format( + len(db["hints"]), get_refs(db["arbitrary_messages"]), get_refs(db["locations"]), get_refs(db["object_descriptions"]),