shithub: pokecrystal

Download patch

ref: f5e5c110d1301745c4137e4c8c3fe66155a330d2
parent: fde936ac463bce1c5e36dc33b4596ce676da6deb
author: Bryan Bishop <[email protected]>
date: Fri May 4 17:05:59 EDT 2012

use inspect to gather members for text_command_classes

--- a/extras/crystal.py
+++ b/extras/crystal.py
@@ -2174,7 +2174,6 @@
     id = 0x15
     macro_name = "current_day"
     size = 1
-
 class TextJump(TextCommand):
     "16 = 3byte pointer to new text follows. Structure: [16][2byte pointer][bank]"
     id = 0x16
@@ -2183,6 +2182,11 @@
     param_types = {
         0: {"name": "text", "class": TextPointerLabelAfterBankParam},
     }
+
+text_command_classes = inspect.getmembers(sys.modules[__name__], \
+                       lambda obj: inspect.isclass(obj) and \
+                       issubclass(obj, TextCommand) and \
+                       obj != TextCommand)
 
 #byte: [name, [param1 name, param1 type], [param2 name, param2 type], ...]
 #0x9E: ["verbosegiveitem", ["item", ItemLabelByte], ["quantity", SingleByteParam]],