X-Git-Url: https://jxself.org/git/?p=open-adventure.git;a=blobdiff_plain;f=make_dungeon.py;h=63eee94ed241863772ee71465c6a25b7d07e7c7c;hp=6ac5ba15dc9c90dcf4e54dfe82c96237ffda951b;hb=2ad0fc148bb0e509b8ef86a8746679503e395a91;hpb=319c5830c835b86cdcaa56e2ba9bdb50549e9186 diff --git a/make_dungeon.py b/make_dungeon.py index 6ac5ba1..63eee94 100755 --- a/make_dungeon.py +++ b/make_dungeon.py @@ -6,6 +6,9 @@ # The nontrivial part of this is the compilation of the YAML for # movement rules to the travel array that's actually used by # playermove(). +# +# Copyright (c) 2017 by Eric S. Raymond +# SPDX-License-Identifier: BSD-2-clause import sys, yaml @@ -152,8 +155,8 @@ def get_objects(obj): if labels: global statedefines statedefines += "/* States for %s */\n" % item[0] - for (j, label) in enumerate(labels): - statedefines += "#define %s\t%d\n" % (label, j) + for (n, label) in enumerate(labels): + statedefines += "#define %s\t%d\n" % (label, n) statedefines += "\n" sounds_str = "" if attr.get("sounds") == None: @@ -203,7 +206,7 @@ def get_obituaries(obit): obit_str = obit_str[:-1] # trim trailing newline return obit_str -def get_hints(hnt, arb): +def get_hints(hnt): template = """ {{ .number = {}, .penalty = {}, @@ -213,7 +216,6 @@ def get_hints(hnt, arb): }}, """ hnt_str = "" - md = dict(arb) for member in hnt: item = member["hint"] number = item["number"] @@ -317,7 +319,7 @@ def buildtravel(locs, objs): # THIS CODE IS WAAAY MORE COMPLEX THAN IT NEEDS TO BE. It's the # result of a massive refactoring exercise that concentrated all # the old nastiness in one spot. It hasn't been finally simplified - # because there's no need to do it until one of the asserions + # because there's no need to do it until one of the assertions # fails. Hint: if you try cleaning this up, the acceptance test is # simple - the output dungeon.c must not change. # @@ -438,7 +440,7 @@ def buildtravel(locs, objs): # At this point the ltravel data is in the Section 3 # representation from the FORTRAN version. Next we perform the - # same mapping into wgat used to be the runtime format. + # same mapping into what used to be the runtime format. travel = [[0, "LOC_NOWHERE", 0, 0, 0, 0, 0, 0, "false", "false"]] tkey = [0] @@ -550,7 +552,7 @@ if __name__ == "__main__": locations = get_locations(db["locations"]), objects = get_objects(db["objects"]), obituaries = get_obituaries(db["obituaries"]), - hints = get_hints(db["hints"], db["arbitrary_messages"]), + hints = get_hints(db["hints"]), conditions = get_condbits(db["locations"]), motions = get_motions(db["motions"]), actions = get_actions(db["actions"]),