diff options
author | Bryan Bishop <kanzure@gmail.com> | 2012-05-22 11:44:42 -0500 |
---|---|---|
committer | Bryan Bishop <kanzure@gmail.com> | 2012-05-22 11:44:42 -0500 |
commit | dfe7d7ce34a06e769dae462b6fcf5477c5322d02 (patch) | |
tree | f07f141dad60b6fd0c842e67797398a598663e81 /crystal.py | |
parent | 40b3d689e790db8e6c7beae067288081a7d8d0c8 (diff) |
check if trainer_names has been set yet before using that key
original-commit-id: cb5eae3e9de8c1a79ce6b69a70fb4a5dd0b73d9b
Diffstat (limited to 'crystal.py')
-rw-r--r-- | crystal.py | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -1719,7 +1719,8 @@ class TrainerIdParam(SingleByteParam): trainer_group_id = self.parent.params[foundit].byte # check the rule to see whether to use an id or not - if "uses_numeric_trainer_ids" in trainer_group_names[trainer_group_id].keys(): + if ("uses_numeric_trainer_ids" in trainer_group_names[trainer_group_id].keys()) or \ + (not "trainer_names" in trainer_group_names[trainer_group_id].keys()): return str(self.byte) else: return trainer_group_names[trainer_group_id]["trainer_names"][self.byte-1] @@ -1743,6 +1744,7 @@ class MenuDataPointerParam(PointerLabelParam): pass +string_to_text_texts = [] class RawTextPointerLabelParam(PointerLabelParam): #not sure if these are always to a text script or raw text? def parse(self): @@ -1754,6 +1756,8 @@ class RawTextPointerLabelParam(PointerLabelParam): #self.text = TextScript(address, map_group=self.map_group, map_id=self.map_id, debug=self.debug) self.text = parse_text_engine_script_at(address, map_group=self.map_group, map_id=self.map_id, debug=self.debug) + string_to_text_texts.append(self.text) + def get_dependencies(self, recompute=False, global_dependencies=set()): global_dependencies.add(self.text) return [self.text] @@ -3439,9 +3443,11 @@ class TrainerFragment(Command): # give this object a possibly better label label = "Trainer" - if "uses_numeric_trainer_ids" in trainer_group_names[trainer_group].keys(): + if ("uses_numeric_trainer_ids" in trainer_group_names[trainer_group].keys()) \ + or ("trainer_names" not in trainer_group_names[trainer_group].keys()): label += string.capwords(trainer_group_names[trainer_group]["constant"]) - if len(trainer_group_names[trainer_group]["trainer_names"]) > 1: + if "trainer_names" in trainer_group_names[trainer_group].keys() \ + and len(trainer_group_names[trainer_group]["trainer_names"]) > 1: label += str(trainer_id) else: label += string.capwords(trainer_group_names[trainer_group]["constant"]) + \ |