Fix command callback generation
This commit is contained in:
@@ -8,19 +8,20 @@ RX_COMMAND = re.compile(r'(?P<returns>CommandCost|std::tuple<CommandCost, [^>]*>
|
||||
RX_DEF_TRAIT = re.compile(r'DEF_CMD_TRAIT\((?P<constant>\w+),\s+(?P<function>\w+),\s+(?P<flags>[^,]*),\s+(?P<category>\w+)\)')
|
||||
RX_ARG = re.compile(r'(?P<type>(:?const |)[\w:]* &?)(?P<name>\w*)')
|
||||
RX_CALLBACK = re.compile(r'void\s+(?P<name>Cc\w+)\(Commands')
|
||||
RX_CALLBACK_REF = re.compile(r'CommandCallback\s+(?P<name>Cc\w+);')
|
||||
RX_CALLBACK_REF = re.compile(r'CommandCallback(?:Data|)\s+(?P<name>Cc\w+);')
|
||||
RX_CAMEL_TO_SNAKE = re.compile(r'(?<!^)(?=[A-Z])')
|
||||
RX_CMD_CONSTANT = re.compile(r'CMD_[\w_]+')
|
||||
|
||||
FILES = [
|
||||
'src/misc_cmd.h',
|
||||
'src/object_cmd.h',
|
||||
'src/order_cmd.h',
|
||||
'src/rail_cmd.h',
|
||||
'src/road_cmd.h',
|
||||
'src/station_cmd.h',
|
||||
'src/town_cmd.h',
|
||||
'src/tunnelbridge_cmd.h',
|
||||
'misc_cmd.h',
|
||||
'object_cmd.h',
|
||||
'order_cmd.h',
|
||||
'rail_cmd.h',
|
||||
'road_cmd.h',
|
||||
'station_cmd.h',
|
||||
'town_cmd.h',
|
||||
'tunnelbridge_cmd.h',
|
||||
'script/script_cmd.h',
|
||||
]
|
||||
|
||||
BASE_DIR = Path(__file__).parent
|
||||
@@ -96,7 +97,7 @@ def parse_commands():
|
||||
command_ids[cmd] = cid
|
||||
cid += 1
|
||||
|
||||
for f in glob.glob(str(BASE_DIR / 'src' / '*_cmd.h')):
|
||||
for f in glob.glob(str(BASE_DIR / 'src' / '*_cmd.h')) + glob.glob(str(BASE_DIR / 'src' / '*' / '*_cmd.h')):
|
||||
# for f in glob.glob(str(BASE_DIR / 'src' / 'group_cmd.h')):
|
||||
includes.append(Path(f).name)
|
||||
data = open(f).read()
|
||||
|
||||
Reference in New Issue
Block a user