Change waypoint 0

Bodge fix to #1, should probably find a cleaner solution.
This commit is contained in:
BCDeshiG 2022-09-11 14:19:06 +01:00
parent f7a15b23f0
commit a75086c77a
3 changed files with 13 additions and 5 deletions

1
.gitignore vendored
View file

@ -2,3 +2,4 @@ beta/
__pycache__/
*.pyc
*.qc
*.way

View file

@ -37,7 +37,7 @@ target7 =
target8 =
}
field set to ' ' if absent
field set to '' if absent
fixed length of 14 with new line separation
8 links maximum
id starts at 1
@ -59,6 +59,8 @@ waypoint
absent fields are excluded
variable length with new line separation
no limit on number of links
no limit on number of links in theory (in practice 8)
id starts at 0
header uses lower case 'w'
header uses lower case 'w'
In general max number of waypoints is 256

View file

@ -126,8 +126,12 @@ def parsePC(oldWayFile):
"origin": tempArray[3][8:],
"id": tempArray[2][4:],
"door": tempArray[4],
"targets": tempArray[7:-2]
# Replace links to waypoint 0
"targets": ["255" if value == "0" else value for value in tempArray[7:-2]]
}
# Replace id 0
if waydict["id"] == "0":
waydict["id"] = "255" # I sure do hope nobody has this many waypoints
tempArray.clear() # Clear temporary array for next waypoint
wayArray.append(waydict) # Add waypoint to array
return wayArray
@ -153,7 +157,8 @@ def saveBETA(wayArray, outputFile):
[outF.write(waypoint["targets"][i] + "\n") for i in range(4)]
def savePSP(wayArray, outputFile):
print("WARNING: PSP format is limited to 8 links per waypoint")
# Come to think of it, who needs more than 8 links anyways?
#print("WARNING: PSP format is limited to 8 links per waypoint")
with open(outputFile, "w") as outF:
for waypoint in wayArray:
outF.write("Waypoint\n{\n") # Header