X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=newdungeon.py;h=624ea865ed30f8f5901701199a25a2f99aad0eb4;hb=51494657fd3689a4202e3ed6db41f5bcded9e2c6;hp=193fe03afffbe49abfc359b02959f55320cbc9f9;hpb=94d1aa5183c4dde59f6a8789e06ccfcaf1e1e1b2;p=open-adventure.git diff --git a/newdungeon.py b/newdungeon.py index 193fe03..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 = {}; @@ -251,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<