X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=make_dungeon.py;h=7e18d76c41da7851a2c0b9deaa5989dc5a18ad88;hb=a6d1f9228ba069d1f33dd6d76091fddd0049b08e;hp=6f4715238a5465c7fe51e2cb32563f3063625a67;hpb=db281a96d70a43c6a6d5b516eceb6e4f67637c57;p=open-adventure.git diff --git a/make_dungeon.py b/make_dungeon.py index 6f47152..7e18d76 100755 --- a/make_dungeon.py +++ b/make_dungeon.py @@ -506,18 +506,6 @@ def get_condbits(locations): cnd_str += " " + line + ",\t// " + name + "\n" return cnd_str -def recompose(type_word, value): - "Compose the internal code for a vocabulary word from its YAML entry" - parts = ("motion", "action", "object", "special") - try: - return value + 1000 * parts.index(type_word) - except KeyError: - sys.stderr.write("dungeon: %s is not a known word\n" % word) - sys.exit(1) - except IndexError: - sys.stderr.write("%s is not a known word classifier\n" % attrs["type"]) - sys.exit(1) - def get_motions(motions): template = """ {{ .words = {}, @@ -568,12 +556,15 @@ def bigdump(arr): out = out[:-2] + "\n" return out -def buildtravel(locs, objs, voc): +def buildtravel(locs, objs): ltravel = [] verbmap = {} - for entry in db["vocabulary"]: - if entry["type"] == "motion" and entry["value"] not in verbmap: - verbmap[entry["word"]] = entry["value"] + for i, motion in enumerate(db["motions"]): + try: + for word in motion[1]["words"]: + verbmap[word.upper()] = i + except TypeError: + pass def dencode(action, name): "Decode a destination number" if action[0] == "goto": @@ -705,8 +696,7 @@ if __name__ == "__main__": objnames = [el[0] for el in db["objects"]] (travel, tkey) = buildtravel(db["locations"], - db["objects"], - db["vocabulary"]) + db["objects"]) c = c_template.format( h_name,