summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan Bishop <kanzure@gmail.com>2013-11-23 01:16:14 -0600
committerBryan Bishop <kanzure@gmail.com>2013-11-23 01:16:14 -0600
commit0099da43b0ff1d7453715a771b0769b58d4c1b5b (patch)
treecf9aeea04ee87b58bf9d80f02c87819e0188627d
parent6e1eb898b872d3abe4997975efcb99cd7506d935 (diff)
make a way to remember if parse_rom called
-rw-r--r--pokemontools/crystal.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/pokemontools/crystal.py b/pokemontools/crystal.py
index 5e16056..2b16284 100644
--- a/pokemontools/crystal.py
+++ b/pokemontools/crystal.py
@@ -6976,6 +6976,8 @@ def add_map_offsets_into_map_names(map_group_offsets, map_names=None):
# add the offsets into our map structure, why not (johto maps only)
return [map_names[map_group_id+1].update({"offset": offset}) for map_group_id, offset in enumerate(map_group_offsets)]
+rom_parsed = False
+
def parse_rom(rom=None):
if not rom:
# read the rom and figure out the offsets for maps
@@ -7004,7 +7006,18 @@ def parse_rom(rom=None):
# improve duplicate trainer names
make_trainer_group_name_trainer_ids(trainer_group_table)
+ rom_parsed = True
+
return map_names
+def cachably_parse_rom(rom=None):
+ """
+ Calls parse_rom if it hasn't been called and completed yet.
+ """
+ if not rom_parsed:
+ return parse_rom(rom=rom)
+ else:
+ return map_names
+
if __name__ == "crystal":
pass