aboutsummaryrefslogtreecommitdiff
path: root/tools/map.py
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2023-06-21 23:13:46 +0100
committerJuan J. Martinez <jjm@usebox.net>2023-06-21 23:13:46 +0100
commit39383806577fef2da1ad2db0c60c2cb4da9200fc (patch)
tree416513a4697b50f2c6366dcd698b8a278e901372 /tools/map.py
parent50ec9fbf10e84965b8eac6b0be090f2a0b18fa81 (diff)
downloadgold-mine-run-39383806577fef2da1ad2db0c60c2cb4da9200fc.tar.gz
gold-mine-run-39383806577fef2da1ad2db0c60c2cb4da9200fc.zip
Check for the total gold limit of 1 byte
Diffstat (limited to 'tools/map.py')
-rwxr-xr-xtools/map.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/map.py b/tools/map.py
index d4a23a0..5522a9e 100755
--- a/tools/map.py
+++ b/tools/map.py
@@ -45,6 +45,14 @@ def main():
out = list(map(lambda x: (x - tileset["firstgid"]) & 0xFF, map_layer["data"]))
gold_layer = get_layer(data, "Gold")
+
+ total_gold = 0
+ for t in gold_layer["data"]:
+ if t != 0:
+ total_gold += 1
+ if total_gold > 255:
+ parser.error("There are more than 255 gold pieces on the screen")
+
out.extend(map(lambda x: (x - tileset["firstgid"]) & 0xFF, gold_layer["data"]))
# TODO: process map entities