X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=make_dungeon.py;h=bae97f210ad7a9759bb8b10c27a034a2f23840d0;hb=f0119f8431be30713e29ef89a63a45d0fa28111c;hp=0d224d3f2081fc52a1d450f007ba87443229374f;hpb=25230068fe3afb9d1faa9c606413784294700cef;p=open-adventure.git diff --git a/make_dungeon.py b/make_dungeon.py index 0d224d3..bae97f2 100755 --- a/make_dungeon.py +++ b/make_dungeon.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# SPDX-FileCopyrightText: Eric S. Raymond +# SPDX-FileCopyrightText: Eric S. Raymond # SPDX-License-Identifier: BSD-2-Clause """ This is the open-adventure dungeon generator. It consumes a YAML description of @@ -136,6 +136,7 @@ def get_objects(obj): }}, }}, """ + max_state = 0 obj_str = "" for (i, item) in enumerate(obj): attr = item[1] @@ -159,6 +160,7 @@ def get_objects(obj): statedefines += "/* States for %s */\n" % item[0] for (n, label) in enumerate(labels): statedefines += "#define %s\t%d\n" % (label, n) + max_state = max(max_state, n) statedefines += "\n" sounds_str = "" if attr.get("sounds") is None: @@ -192,6 +194,7 @@ def get_objects(obj): treasure = "true" if attr.get("treasure") else "false" obj_str += template.format(i, item[0], words_str, i_msg, locs[0], locs[1], treasure, descriptions_str, sounds_str, texts_str, changes_str) obj_str = obj_str[:-1] # trim trailing newline + statedefines += "/* Maximum state value */\n#define MAX_STATE %d\n" % max_state return obj_str def get_obituaries(obit):