You've already forked pokecrystal-board
mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-04-09 05:44:44 -07:00
get_label_for improvements (use script_parse_table if possible)
This commit is contained in:
@ -5965,10 +5965,21 @@ def get_label_for(address):
|
|||||||
global all_labels
|
global all_labels
|
||||||
if type(address) != int:
|
if type(address) != int:
|
||||||
raise Exception, "get_label_for requires an integer address"
|
raise Exception, "get_label_for requires an integer address"
|
||||||
|
|
||||||
|
#the old way
|
||||||
for thing in all_labels:
|
for thing in all_labels:
|
||||||
if thing["address"] == address:
|
if thing["address"] == address:
|
||||||
return thing["label"]
|
return thing["label"]
|
||||||
return None
|
|
||||||
|
#the new way
|
||||||
|
if is_script_already_parsed_at(address):
|
||||||
|
obj = script_parse_table[address]
|
||||||
|
if hasattr(obj, "label"):
|
||||||
|
return getattr(obj, "label")
|
||||||
|
else:
|
||||||
|
return "AlreadyParsedNoDefaultUnknownLabel_" + hex(address)
|
||||||
|
|
||||||
|
return "NotYetParsed_"+hex(address)
|
||||||
|
|
||||||
def remove_quoted_text(line):
|
def remove_quoted_text(line):
|
||||||
"""get rid of content inside quotes
|
"""get rid of content inside quotes
|
||||||
|
Reference in New Issue
Block a user