make map header labels use better rules

This commit is contained in:
Bryan Bishop 2012-05-20 09:32:59 -05:00
parent 1286f37a85
commit 2c73f020a6
1 changed files with 13 additions and 19 deletions

View File

@ -3521,8 +3521,7 @@ class TrainerGroupTable:
self.headers = [] self.headers = []
self.parse() self.parse()
# TODO: add this to script_parse_table script_parse_table[self.address : self.last_address] = self
#script_parse_table[address : self.last_address] = self
def get_dependencies(self, recompute=False, global_dependencies=set()): def get_dependencies(self, recompute=False, global_dependencies=set()):
global_dependencies.update(self.headers) global_dependencies.update(self.headers)
@ -3960,7 +3959,7 @@ def trainer_group_report():
output += "total trainers: " + str(total) output += "total trainers: " + str(total)
return output return output
def make_trainer_group_name_trainer_ids(debug=True): def make_trainer_group_name_trainer_ids(trainer_group_table, debug=True):
""" Edits trainer_group_names and sets the trainer names. """ Edits trainer_group_names and sets the trainer names.
For instance, "AMY & MAY" becomes "AMY_AND_MAY1" and "AMY_AND_MAY2" For instance, "AMY & MAY" becomes "AMY_AND_MAY1" and "AMY_AND_MAY2"
@ -4629,9 +4628,8 @@ class MapHeader:
self.bank = bank self.bank = bank
self.debug = debug self.debug = debug
self.dependencies = None self.dependencies = None
if not label: label = self.make_label()
label = self.base_label + hex(address) self.label = Label(name=label, address=address, object=self)
self.label = Label(address=address, object=self)
self.last_address = address + 9 self.last_address = address + 9
script_parse_table[address : self.last_address] = self script_parse_table[address : self.last_address] = self
self.parse() self.parse()
@ -4727,9 +4725,8 @@ class SecondMapHeader:
self.debug = debug self.debug = debug
self.bank = bank self.bank = bank
self.dependencies = None self.dependencies = None
if not label: label = self.make_label()
label = self.base_label + hex(address) self.label = Label(name=label, address=address, object=self)
self.label = Label(address=address, object=self)
self.last_address = address+12 self.last_address = address+12
#i think it's always a static size? #i think it's always a static size?
script_parse_table[address : self.last_address] = self script_parse_table[address : self.last_address] = self
@ -4881,9 +4878,8 @@ class MapBlockData:
self.height = height self.height = height
else: else:
raise Exception, "MapBlockData needs to know the width/height of its map" raise Exception, "MapBlockData needs to know the width/height of its map"
if not label: label = self.make_label()
label = self.base_label + hex(address) self.label = Label(name=label, address=address, object=self)
self.label = Label(address=address, object=self)
self.last_address = self.address + (self.width.byte * self.height.byte) self.last_address = self.address + (self.width.byte * self.height.byte)
script_parse_table[address : self.last_address] = self script_parse_table[address : self.last_address] = self
self.parse() self.parse()
@ -4922,8 +4918,7 @@ class MapEventHeader:
self.debug = debug self.debug = debug
self.bank = bank self.bank = bank
self.dependencies = None self.dependencies = None
if not label: label = self.make_label()
label = self.base_label + hex(address)
self.label = Label(address=address, object=self) self.label = Label(address=address, object=self)
self.parse() self.parse()
script_parse_table[address : self.last_address] = self script_parse_table[address : self.last_address] = self
@ -5148,9 +5143,8 @@ class MapScriptHeader:
self.debug = debug self.debug = debug
self.bank = bank self.bank = bank
self.dependencies = None self.dependencies = None
if not label: label = self.make_label()
label = self.base_label + hex(address) self.label = Label(name=label, address=address, object=self)
self.label = Label(address=address, object=self)
self.parse() self.parse()
script_parse_table[address : self.last_address] = self script_parse_table[address : self.last_address] = self
@ -8105,10 +8099,10 @@ def run_main():
# and parse the main TrainerGroupTable once we know the max number of trainers # and parse the main TrainerGroupTable once we know the max number of trainers
#global trainer_group_table #global trainer_group_table
#trainer_group_table = TrainerGroupTable() trainer_group_table = TrainerGroupTable()
# improve duplicate trainer names # improve duplicate trainer names
make_trainer_group_name_trainer_ids() make_trainer_group_name_trainer_ids(trainer_group_table)
#just a helpful alias #just a helpful alias
main=run_main main=run_main