From bdfab71f75b32d291cf8adf54f4c032601bf7e3a Mon Sep 17 00:00:00 2001 From: Jon Date: Mon, 12 Aug 2024 03:27:15 +0100 Subject: [PATCH] Grouped pushpull items in a single folder to reduce pressure on concurrent spritegroup limit --- build.py | 47 +++++++++++++++---- .../{Diesel_Loco_Sprites => PushPull}/47.pnml | 0 .../PushPull}/86.pnml | 0 .../PushPull}/87.pnml | 0 .../PushPull}/90.pnml | 0 .../91.pnml | 0 .../PushPull}/BR047.pnml | 0 .../PushPull}/BR067.pnml | 0 .../PushPull}/BR068.pnml | 0 .../PushPull}/BR068_6Mk3.pnml | 0 .../PushPull}/BR068_Mk5a.pnml | 0 .../PushPull}/BR89.pnml | 0 .../PushPull}/BR91_IC225.pnml | 0 .../PushPull}/BR91_Standalone.pnml | 0 .../Mk2 => PushPull}/Mk2_DBSO_Spritesets.pnml | 0 .../Mk2 => PushPull}/Mk2_DBSO_Switches.pnml | 0 .../Mk3DVT.pnml | 0 .../Mk4DVT.pnml | 0 .../Mk5DVT.pnml | 0 .../_spriteset/{ => PushPull}/PushPull.pnml | 0 .../RM_TPO.pnml | 0 21 files changed, 38 insertions(+), 9 deletions(-) rename src/trains/_spriteset/{Diesel_Loco_Sprites => PushPull}/47.pnml (100%) rename src/trains/{electric_loco => _spriteset/PushPull}/86.pnml (100%) rename src/trains/{electric_loco => _spriteset/PushPull}/87.pnml (100%) rename src/trains/{electric_loco => _spriteset/PushPull}/90.pnml (100%) rename src/trains/_spriteset/{Electric_Loco_Sprites => PushPull}/91.pnml (100%) rename src/trains/{diesel_loco => _spriteset/PushPull}/BR047.pnml (100%) rename src/trains/{diesel_loco => _spriteset/PushPull}/BR067.pnml (100%) rename src/trains/{diesel_loco => _spriteset/PushPull}/BR068.pnml (100%) rename src/trains/{diesel_loco => _spriteset/PushPull}/BR068_6Mk3.pnml (100%) rename src/trains/{diesel_loco => _spriteset/PushPull}/BR068_Mk5a.pnml (100%) rename src/trains/{electric_loco => _spriteset/PushPull}/BR89.pnml (100%) rename src/trains/{electric_loco => _spriteset/PushPull}/BR91_IC225.pnml (100%) rename src/trains/{electric_loco => _spriteset/PushPull}/BR91_Standalone.pnml (100%) rename src/trains/_spriteset/{Rolling Stock_Sprites/Mk2 => PushPull}/Mk2_DBSO_Spritesets.pnml (100%) rename src/trains/_spriteset/{Rolling Stock_Sprites/Mk2 => PushPull}/Mk2_DBSO_Switches.pnml (100%) rename src/trains/_spriteset/{Rolling Stock_Sprites => PushPull}/Mk3DVT.pnml (100%) rename src/trains/_spriteset/{Rolling Stock_Sprites => PushPull}/Mk4DVT.pnml (100%) rename src/trains/_spriteset/{Rolling Stock_Sprites => PushPull}/Mk5DVT.pnml (100%) rename src/trains/_spriteset/{ => PushPull}/PushPull.pnml (100%) rename src/trains/_spriteset/{Rolling Stock_Sprites => PushPull}/RM_TPO.pnml (100%) diff --git a/build.py b/build.py index 4752299e..84eac20a 100644 --- a/build.py +++ b/build.py @@ -266,28 +266,57 @@ def main(grf_name, src_dir, lang_dir, gfx_dir, b_compile_grf, b_run_game): # Get a list of all the pnml files in src file_list = find_pnml_files(src_directory) print("Finished finding pnml files\n") + pushpull_files = list() + priority_files = list() pnml_files = list() append_files = list() # Priority folders: Read all the files in folders that begin with "_" into the internal nml for directory in file_list: + # Group pushpull files + if directory.startswith("PushPull"): + pushpull_files += file_list[directory] + continue + + # Grab priority files that need to be run first if directory.startswith("_"): - for file in file_list[directory]: - print("Reading '%s'" % (file.stem + file.suffix)) - nml_file = copy_file(file, nml_file) + priority_files += file_list[directory] + continue + + # Grab "append" files (that go at the end) + if directory == "append": + append_files += file_list[directory] + continue + + # Everything else else: - if directory == "append": - append_files += file_list[directory] - else: - pnml_files += file_list[directory] + pnml_files += file_list[directory] + + # Special pushpull file first + for file in sorted(pushpull_files): + if file.stem.startswith("PushPull"): + print("Found PushPull.pnml special item") + nml_file = copy_file(file, nml_file) + + # Read the other pushpull files + for file in sorted(pushpull_files): + if file.stem.startswith("PushPull"): + continue; + print("Reading pushpull file '%s'" % (file.stem + file.suffix)) + nml_file = copy_file(file, nml_file) + + # Read the priority files + for file in sorted(priority_files): + print("Reading priority file '%s'" % (file.stem + file.suffix)) + nml_file = copy_file(file, nml_file) # Read the regular files for file in sorted(pnml_files): - print("Reading '%s'" % (file.stem + file.suffix)) + # print("Reading '%s'" % (file.stem + file.suffix)) nml_file = copy_file(file, nml_file) # Read the append files (mostly switches to disable units) for file in sorted(append_files): - print("Reading '%s'" % (file.stem + file.suffix)) + # print("Reading '%s'" % (file.stem + file.suffix)) nml_file = copy_file(file, nml_file) print("Copied all files to internal buffer\n") diff --git a/src/trains/_spriteset/Diesel_Loco_Sprites/47.pnml b/src/trains/_spriteset/PushPull/47.pnml similarity index 100% rename from src/trains/_spriteset/Diesel_Loco_Sprites/47.pnml rename to src/trains/_spriteset/PushPull/47.pnml diff --git a/src/trains/electric_loco/86.pnml b/src/trains/_spriteset/PushPull/86.pnml similarity index 100% rename from src/trains/electric_loco/86.pnml rename to src/trains/_spriteset/PushPull/86.pnml diff --git a/src/trains/electric_loco/87.pnml b/src/trains/_spriteset/PushPull/87.pnml similarity index 100% rename from src/trains/electric_loco/87.pnml rename to src/trains/_spriteset/PushPull/87.pnml diff --git a/src/trains/electric_loco/90.pnml b/src/trains/_spriteset/PushPull/90.pnml similarity index 100% rename from src/trains/electric_loco/90.pnml rename to src/trains/_spriteset/PushPull/90.pnml diff --git a/src/trains/_spriteset/Electric_Loco_Sprites/91.pnml b/src/trains/_spriteset/PushPull/91.pnml similarity index 100% rename from src/trains/_spriteset/Electric_Loco_Sprites/91.pnml rename to src/trains/_spriteset/PushPull/91.pnml diff --git a/src/trains/diesel_loco/BR047.pnml b/src/trains/_spriteset/PushPull/BR047.pnml similarity index 100% rename from src/trains/diesel_loco/BR047.pnml rename to src/trains/_spriteset/PushPull/BR047.pnml diff --git a/src/trains/diesel_loco/BR067.pnml b/src/trains/_spriteset/PushPull/BR067.pnml similarity index 100% rename from src/trains/diesel_loco/BR067.pnml rename to src/trains/_spriteset/PushPull/BR067.pnml diff --git a/src/trains/diesel_loco/BR068.pnml b/src/trains/_spriteset/PushPull/BR068.pnml similarity index 100% rename from src/trains/diesel_loco/BR068.pnml rename to src/trains/_spriteset/PushPull/BR068.pnml diff --git a/src/trains/diesel_loco/BR068_6Mk3.pnml b/src/trains/_spriteset/PushPull/BR068_6Mk3.pnml similarity index 100% rename from src/trains/diesel_loco/BR068_6Mk3.pnml rename to src/trains/_spriteset/PushPull/BR068_6Mk3.pnml diff --git a/src/trains/diesel_loco/BR068_Mk5a.pnml b/src/trains/_spriteset/PushPull/BR068_Mk5a.pnml similarity index 100% rename from src/trains/diesel_loco/BR068_Mk5a.pnml rename to src/trains/_spriteset/PushPull/BR068_Mk5a.pnml diff --git a/src/trains/electric_loco/BR89.pnml b/src/trains/_spriteset/PushPull/BR89.pnml similarity index 100% rename from src/trains/electric_loco/BR89.pnml rename to src/trains/_spriteset/PushPull/BR89.pnml diff --git a/src/trains/electric_loco/BR91_IC225.pnml b/src/trains/_spriteset/PushPull/BR91_IC225.pnml similarity index 100% rename from src/trains/electric_loco/BR91_IC225.pnml rename to src/trains/_spriteset/PushPull/BR91_IC225.pnml diff --git a/src/trains/electric_loco/BR91_Standalone.pnml b/src/trains/_spriteset/PushPull/BR91_Standalone.pnml similarity index 100% rename from src/trains/electric_loco/BR91_Standalone.pnml rename to src/trains/_spriteset/PushPull/BR91_Standalone.pnml diff --git a/src/trains/_spriteset/Rolling Stock_Sprites/Mk2/Mk2_DBSO_Spritesets.pnml b/src/trains/_spriteset/PushPull/Mk2_DBSO_Spritesets.pnml similarity index 100% rename from src/trains/_spriteset/Rolling Stock_Sprites/Mk2/Mk2_DBSO_Spritesets.pnml rename to src/trains/_spriteset/PushPull/Mk2_DBSO_Spritesets.pnml diff --git a/src/trains/_spriteset/Rolling Stock_Sprites/Mk2/Mk2_DBSO_Switches.pnml b/src/trains/_spriteset/PushPull/Mk2_DBSO_Switches.pnml similarity index 100% rename from src/trains/_spriteset/Rolling Stock_Sprites/Mk2/Mk2_DBSO_Switches.pnml rename to src/trains/_spriteset/PushPull/Mk2_DBSO_Switches.pnml diff --git a/src/trains/_spriteset/Rolling Stock_Sprites/Mk3DVT.pnml b/src/trains/_spriteset/PushPull/Mk3DVT.pnml similarity index 100% rename from src/trains/_spriteset/Rolling Stock_Sprites/Mk3DVT.pnml rename to src/trains/_spriteset/PushPull/Mk3DVT.pnml diff --git a/src/trains/_spriteset/Rolling Stock_Sprites/Mk4DVT.pnml b/src/trains/_spriteset/PushPull/Mk4DVT.pnml similarity index 100% rename from src/trains/_spriteset/Rolling Stock_Sprites/Mk4DVT.pnml rename to src/trains/_spriteset/PushPull/Mk4DVT.pnml diff --git a/src/trains/_spriteset/Rolling Stock_Sprites/Mk5DVT.pnml b/src/trains/_spriteset/PushPull/Mk5DVT.pnml similarity index 100% rename from src/trains/_spriteset/Rolling Stock_Sprites/Mk5DVT.pnml rename to src/trains/_spriteset/PushPull/Mk5DVT.pnml diff --git a/src/trains/_spriteset/PushPull.pnml b/src/trains/_spriteset/PushPull/PushPull.pnml similarity index 100% rename from src/trains/_spriteset/PushPull.pnml rename to src/trains/_spriteset/PushPull/PushPull.pnml diff --git a/src/trains/_spriteset/Rolling Stock_Sprites/RM_TPO.pnml b/src/trains/_spriteset/PushPull/RM_TPO.pnml similarity index 100% rename from src/trains/_spriteset/Rolling Stock_Sprites/RM_TPO.pnml rename to src/trains/_spriteset/PushPull/RM_TPO.pnml