X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=locbit.py;h=499e70514eaa52b468794bf135ba7844fe48a2e6;hb=e4b2877733ddc4dcbc6a5c56dee278c1beec2f29;hp=b50c7ef0c32baa7d04b4a88b9f9e6470e6071ded;hpb=4aa006368d131ae42ea8cf096fa5237657219e98;p=open-adventure.git diff --git a/locbit.py b/locbit.py index b50c7ef..499e705 100755 --- a/locbit.py +++ b/locbit.py @@ -3,13 +3,13 @@ # Enhance adventure.yaml entries with explicit properties based on Section 9 # of adventure.text and the kludgy macro definitions in advent.h. # +# The FORCED bit can't be set here. That has to be done fom the travel arrays. +# # This script is meant to be gotten right, used once, and then discarded. # We'll leave a copy in the repository history for reference # # When in doubt, make the code dumber and the data smarter. # -# It bothers me that I don't know why FORCED is checking the fluid bit. -# import sys, yaml # This is the original location-attribute data from section 9 of adventure.text @@ -52,7 +52,7 @@ attrnames = ( "FLUID", # 2 "NOARRR", # 3 "NOBACK", # 4 - "FORCED", # 5 # New + "", # 5 "FOREST", # 6 # New "ABOVE", # 7 # New "DEEP", # 8 # New @@ -77,7 +77,6 @@ sapphireloc = 167 # For reference from advent.h: # -# define FORCED(LOC) (COND[LOC] == 2) # define FOREST(LOC) ((LOC) >= LOC_FOREST1 && (LOC) <= LOC_FOREST22) # #/* The following two functions were added to fix a bug (game.clock1 decremented @@ -89,25 +88,22 @@ sapphireloc = 167 # define INDEEP(LOC) ((LOC) >= LOC_MISTHALL && !OUTSID(LOC) && (LOC) != LOC_FOOF1) def genline(loc): - attrs = [] + attrs = {} name = locnames[loc] for props in section12: if loc in props[1:]: if props[0] not in attrs: - attrs.append(props[0]) + attrs[attrnames[props[0]]] = True # Adod new attributes. These are computed the same way as the - # INDEEP(), OUTSID(), and FORCED macros in advent.h. - # FORCED is on only if COND == 2 - if attrs == [2]: - attrs.append(5) # FORCED + # INDEEP(), OUTSID(), and FOREST() macros in advent.h. if "FOREST" in name: - attrs.append(6) # FOREST + attrs["FOREST"] = True # 167 is the sapphire's start location if loc in range(1, grate+1) or name in ("FOOF2", "FOOF4") or name == sapphireloc: - attrs.append(7) # ABOVE + attrs["ABOVE"] = True if not loc in range(0, misthall+1) and name != "FOOF1" and 6 not in attrs: - attrs.append(8) # DEEP - names = str([attrnames[n] for n in attrs]).replace("'", "") + attrs["DEEP"] = True + naqmes = str(attrs).replace("'", "").replace("True", "true").replace("False", "false") return " conditions: %s\n" % (names,) if __name__ == "__main__":