mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
pass 'recompute' parameter through get_dependencies() calls
This commit is contained in:
parent
39a71c55c7
commit
7ed1bebc01
@ -714,7 +714,9 @@ class TextScript:
|
|||||||
self.size = self.byte_count = self.last_address - original_address
|
self.size = self.byte_count = self.last_address - original_address
|
||||||
return commands
|
return commands
|
||||||
|
|
||||||
def get_dependencies(self):
|
def get_dependencies(self, recompute=False):
|
||||||
|
if recompute:
|
||||||
|
raise NotImplementedError, bryan_message
|
||||||
return self.dependencies
|
return self.dependencies
|
||||||
|
|
||||||
def to_asm(self, label=None):
|
def to_asm(self, label=None):
|
||||||
@ -916,7 +918,7 @@ class EncodedText:
|
|||||||
self.parse()
|
self.parse()
|
||||||
script_parse_table[self.address : self.last_address] = self
|
script_parse_table[self.address : self.last_address] = self
|
||||||
|
|
||||||
def get_dependencies(self):
|
def get_dependencies(self, recompute=False):
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def parse(self):
|
def parse(self):
|
||||||
@ -1184,7 +1186,8 @@ class SingleByteParam():
|
|||||||
|
|
||||||
def parse(self): self.byte = ord(rom[self.address])
|
def parse(self): self.byte = ord(rom[self.address])
|
||||||
|
|
||||||
def get_dependencies(self): return []
|
def get_dependencies(self, recompute=False):
|
||||||
|
return []
|
||||||
|
|
||||||
def to_asm(self):
|
def to_asm(self):
|
||||||
if not self.should_be_decimal: return hex(self.byte).replace("0x", "$")
|
if not self.should_be_decimal: return hex(self.byte).replace("0x", "$")
|
||||||
@ -1233,7 +1236,7 @@ class MultiByteParam():
|
|||||||
else:
|
else:
|
||||||
self.parsed_address = calculate_pointer_from_bytes_at(self.address, bank=None)
|
self.parsed_address = calculate_pointer_from_bytes_at(self.address, bank=None)
|
||||||
|
|
||||||
def get_dependencies(self):
|
def get_dependencies(self, recompute=False):
|
||||||
return []
|
return []
|
||||||
|
|
||||||
#you won't actually use this to_asm because it's too generic
|
#you won't actually use this to_asm because it's too generic
|
||||||
@ -1285,7 +1288,7 @@ class PointerLabelParam(MultiByteParam):
|
|||||||
if self.debug:
|
if self.debug:
|
||||||
print "parsed address is: " + hex(self.parsed_address) + " with label: " + thing.label.name + " of type: " + str(thing.__class__)
|
print "parsed address is: " + hex(self.parsed_address) + " with label: " + thing.label.name + " of type: " + str(thing.__class__)
|
||||||
dependencies.append(thing)
|
dependencies.append(thing)
|
||||||
dependencies.extend(thing.get_dependencies())
|
dependencies.extend(thing.get_dependencies(recompute=recompute))
|
||||||
self.dependencies = dependencies
|
self.dependencies = dependencies
|
||||||
return dependencies
|
return dependencies
|
||||||
|
|
||||||
@ -1480,7 +1483,7 @@ class RawTextPointerLabelParam(PointerLabelParam):
|
|||||||
self.calculated_address = address
|
self.calculated_address = address
|
||||||
self.text = TextScript(address, map_group=self.map_group, map_id=self.map_id, debug=self.debug)
|
self.text = TextScript(address, map_group=self.map_group, map_id=self.map_id, debug=self.debug)
|
||||||
|
|
||||||
def get_dependencies(self):
|
def get_dependencies(self, recompute=False):
|
||||||
return [self.text]
|
return [self.text]
|
||||||
|
|
||||||
class TextPointerLabelParam(PointerLabelParam):
|
class TextPointerLabelParam(PointerLabelParam):
|
||||||
@ -1546,7 +1549,7 @@ class Command:
|
|||||||
return self.dependencies
|
return self.dependencies
|
||||||
for (key, param) in self.params.items():
|
for (key, param) in self.params.items():
|
||||||
if hasattr(param, "get_dependencies") and param != self:
|
if hasattr(param, "get_dependencies") and param != self:
|
||||||
deps = param.get_dependencies()
|
deps = param.get_dependencies(recompute=recompute)
|
||||||
if deps != None and not self in deps:
|
if deps != None and not self in deps:
|
||||||
dependencies.extend(deps)
|
dependencies.extend(deps)
|
||||||
self.dependencies = dependencies
|
self.dependencies = dependencies
|
||||||
@ -2069,7 +2072,7 @@ class Script:
|
|||||||
return self.dependencies
|
return self.dependencies
|
||||||
dependencies = []
|
dependencies = []
|
||||||
for command in self.commands:
|
for command in self.commands:
|
||||||
deps = command.get_dependencies()
|
deps = command.get_dependencies(recompute=recompute)
|
||||||
dependencies.extend(deps)
|
dependencies.extend(deps)
|
||||||
self.dependencies = dependencies
|
self.dependencies = dependencies
|
||||||
return dependencies
|
return dependencies
|
||||||
@ -2148,7 +2151,7 @@ class Warp(Command):
|
|||||||
script_parse_table[kwargs["address"] : kwargs["address"] + self.size] = self
|
script_parse_table[kwargs["address"] : kwargs["address"] + self.size] = self
|
||||||
Command.__init__(self, *args, **kwargs)
|
Command.__init__(self, *args, **kwargs)
|
||||||
|
|
||||||
def get_dependencies(self):
|
def get_dependencies(self, recompute=False):
|
||||||
return []
|
return []
|
||||||
|
|
||||||
all_warps = []
|
all_warps = []
|
||||||
@ -2295,10 +2298,10 @@ class ItemFragmentParam(PointerLabelParam):
|
|||||||
itemfrag = ItemFragment(address=address, map_group=self.map_group, map_id=self.map_id, debug=self.debug)
|
itemfrag = ItemFragment(address=address, map_group=self.map_group, map_id=self.map_id, debug=self.debug)
|
||||||
self.itemfrag = itemfrag
|
self.itemfrag = itemfrag
|
||||||
|
|
||||||
self.dependencies = [itemfrag].extend(itemfrag.get_dependencies())
|
def get_dependencies(self, recompute=False):
|
||||||
|
if self.dependencies != None and not recompute:
|
||||||
def get_dependencies(self):
|
return self.dependencies
|
||||||
#self.dependencies = [itemfrag].extend(itemfrag.get_dependencies())
|
self.dependencies = [self.itemfrag].extend(self.itemfrag.get_dependencies(recompute=recompute))
|
||||||
return self.dependencies
|
return self.dependencies
|
||||||
|
|
||||||
class TrainerFragment(Command):
|
class TrainerFragment(Command):
|
||||||
@ -2353,13 +2356,13 @@ class TrainerFragment(Command):
|
|||||||
if self.dependencies != None and not recompute:
|
if self.dependencies != None and not recompute:
|
||||||
return self.dependencies
|
return self.dependencies
|
||||||
deps.append(self.params[3])
|
deps.append(self.params[3])
|
||||||
deps.extend(self.params[3].get_dependencies())
|
deps.extend(self.params[3].get_dependencies(recompute=recompute))
|
||||||
deps.append(self.params[4])
|
deps.append(self.params[4])
|
||||||
deps.extend(self.params[4].get_dependencies())
|
deps.extend(self.params[4].get_dependencies(recompute=recompute))
|
||||||
deps.append(self.params[5])
|
deps.append(self.params[5])
|
||||||
deps.extend(self.params[5].get_dependencies())
|
deps.extend(self.params[5].get_dependencies(recompute=recompute))
|
||||||
deps.append(self.params[6])
|
deps.append(self.params[6])
|
||||||
deps.extend(self.params[6].get_dependencies())
|
deps.extend(self.params[6].get_dependencies(recompute=recompute))
|
||||||
self.dependencies = dep
|
self.dependencies = dep
|
||||||
return deps
|
return deps
|
||||||
|
|
||||||
@ -2398,7 +2401,7 @@ class TrainerFragmentParam(PointerLabelParam):
|
|||||||
return self.dependencies
|
return self.dependencies
|
||||||
deps.extend(self.dependencies)
|
deps.extend(self.dependencies)
|
||||||
if len(self.dependencies) > 0:
|
if len(self.dependencies) > 0:
|
||||||
deps.extend(self.dependencies[0].get_dependencies())
|
deps.extend(self.dependencies[0].get_dependencies(recompute=recompute))
|
||||||
self.dependencies = deps
|
self.dependencies = deps
|
||||||
return deps
|
return deps
|
||||||
|
|
||||||
@ -2661,7 +2664,7 @@ class SignpostRemoteBase:
|
|||||||
if self.dependencies != None and not recompute:
|
if self.dependencies != None and not recompute:
|
||||||
return self.dependencies
|
return self.dependencies
|
||||||
for p in self.params:
|
for p in self.params:
|
||||||
deps = p.get_dependencies()
|
deps = p.get_dependencies(recompute=recompute)
|
||||||
dependencies.extend(deps)
|
dependencies.extend(deps)
|
||||||
self.dependencies = dependencies
|
self.dependencies = dependencies
|
||||||
return dependencies
|
return dependencies
|
||||||
@ -2905,7 +2908,7 @@ class Signpost(Command):
|
|||||||
if self.dependencies != None and not recompute:
|
if self.dependencies != None and not recompute:
|
||||||
return self.dependencies
|
return self.dependencies
|
||||||
for p in self.params:
|
for p in self.params:
|
||||||
dependencies.extend(p.get_dependencies())
|
dependencies.extend(p.get_dependencies(recompute=recompute))
|
||||||
self.dependencies = dependencies
|
self.dependencies = dependencies
|
||||||
return dependencies
|
return dependencies
|
||||||
|
|
||||||
@ -3026,7 +3029,7 @@ class MapHeader:
|
|||||||
if self.dependencies != None and not recompute:
|
if self.dependencies != None and not recompute:
|
||||||
return self.dependencies
|
return self.dependencies
|
||||||
dependencies = [self.second_map_header]
|
dependencies = [self.second_map_header]
|
||||||
dependencies.append(self.second_map_header.get_dependencies())
|
dependencies.append(self.second_map_header.get_dependencies(recompute=recompute))
|
||||||
self.dependencies = dependencies
|
self.dependencies = dependencies
|
||||||
return dependencies
|
return dependencies
|
||||||
|
|
||||||
@ -3162,8 +3165,8 @@ class SecondMapHeader:
|
|||||||
if self.dependencies != None and not recompute:
|
if self.dependencies != None and not recompute:
|
||||||
return self.dependencies
|
return self.dependencies
|
||||||
dependencies = [self.script_header, self.event_header, self.blockdata]
|
dependencies = [self.script_header, self.event_header, self.blockdata]
|
||||||
dependencies.append(self.script_header.get_dependencies())
|
dependencies.append(self.script_header.get_dependencies(recompute=recompute))
|
||||||
dependencies.append(self.event_header.get_dependencies())
|
dependencies.append(self.event_header.get_dependencies(recompute=recompute))
|
||||||
self.dependencies = dependencies
|
self.dependencies = dependencies
|
||||||
return dependencies
|
return dependencies
|
||||||
|
|
||||||
@ -3347,7 +3350,7 @@ class MapEventHeader:
|
|||||||
|
|
||||||
dependencies = []
|
dependencies = []
|
||||||
for p in bases:
|
for p in bases:
|
||||||
dependencies.extend(p.get_dependencies())
|
dependencies.extend(p.get_dependencies(recompute=recompute))
|
||||||
self.dependencies = dependencies
|
self.dependencies = dependencies
|
||||||
return dependencies
|
return dependencies
|
||||||
|
|
||||||
@ -3548,10 +3551,10 @@ class MapScriptHeader:
|
|||||||
dependencies = []
|
dependencies = []
|
||||||
for p in list(self.triggers):
|
for p in list(self.triggers):
|
||||||
#dependencies.append(p[0])
|
#dependencies.append(p[0])
|
||||||
dependencies.extend(p[0].get_dependencies())
|
dependencies.extend(p[0].get_dependencies(recompute=recompute))
|
||||||
for callback in self.callbacks:
|
for callback in self.callbacks:
|
||||||
dependencies.append(callback["callback"])
|
dependencies.append(callback["callback"])
|
||||||
dependencies.extend(callback["callback"].get_dependencies())
|
dependencies.extend(callback["callback"].get_dependencies(recompute=recompute))
|
||||||
self.dependencies = dependencies
|
self.dependencies = dependencies
|
||||||
return dependencies
|
return dependencies
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user