diff options
author | Juan J. Martinez <jjm@usebox.net> | 2023-06-21 23:13:46 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2023-06-21 23:13:46 +0100 |
commit | 39383806577fef2da1ad2db0c60c2cb4da9200fc (patch) | |
tree | 416513a4697b50f2c6366dcd698b8a278e901372 | |
parent | 50ec9fbf10e84965b8eac6b0be090f2a0b18fa81 (diff) | |
download | gold-mine-run-39383806577fef2da1ad2db0c60c2cb4da9200fc.tar.gz gold-mine-run-39383806577fef2da1ad2db0c60c2cb4da9200fc.zip |
Check for the total gold limit of 1 byte
-rwxr-xr-x | tools/map.py | 8 |
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 |