X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=newdungeon.py;h=624ea865ed30f8f5901701199a25a2f99aad0eb4;hb=98b7434b0b67185c52ba388abc549386d819acd7;hp=dffb8d142b0d58d136c6234ca7ddfe68e780ad12;hpb=c8f6ff3701534e6c1ce59cf3e33aec5e824ed144;p=open-adventure.git diff --git a/newdungeon.py b/newdungeon.py index dffb8d1..624ea86 100755 --- a/newdungeon.py +++ b/newdungeon.py @@ -59,6 +59,7 @@ extern const class_t classes[]; extern turn_threshold_t turn_thresholds[]; extern obituary_t obituaries[]; extern hint_t hints[]; +extern long conditions[]; extern const size_t CLSSES; extern const int maximum_deaths; @@ -82,6 +83,7 @@ enum object_descriptions_refs {{ c_template = """/* Generated from adventure.yaml - do not hand-hack! */ +#include "common.h" #include "{}" const char* arbitrary_messages[] = {{ @@ -112,6 +114,10 @@ hint_t hints[] = {{ {} }}; +long conditions[] = {{ +{} +}}; + const size_t CLSSES = {}; const int maximum_deaths = {}; const int turn_threshold_count = {}; @@ -240,7 +246,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"] @@ -250,6 +257,25 @@ def get_hints(hnt, arb): hnt_str = hnt_str[:-1] # trim trailing newline return hnt_str +def get_condbits(locations): + cnd_str = "" + for (name, loc) in locations: + conditions = loc["conditions"] + hints = loc.get("hints") or [] + flaglist = [] + for flag in conditions: + if conditions[flag]: + flaglist.append(flag) + line = "|".join([("(1<