X-Git-Url: https://jxself.org/git/?p=open-adventure.git;a=blobdiff_plain;f=newdungeon.py;h=092c342e52038588bc08550cc985fb3bbca5e4d0;hp=193fe03afffbe49abfc359b02959f55320cbc9f9;hb=537c4511e2f3802421f79aed7b6af16d66adb518;hpb=94d1aa5183c4dde59f6a8789e06ccfcaf1e1e1b2 diff --git a/newdungeon.py b/newdungeon.py index 193fe03..092c342 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 const 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[] = {{ {} }}; +const 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<