Filepaths - #5095
Draft
PieterVdc wants to merge 4 commits into
Draft
Conversation
PieterVdc
marked this pull request as ready for review
August 6, 2026 10:15
PieterVdc
marked this pull request as draft
August 6, 2026 10:15
There was a problem hiding this comment.
Pull request overview
Adds a new priority-based filepath resolver intended to simplify “mod/campaign override” lookups by centralizing selection logic, then starts migrating a couple of asset loaders to use it.
Changes:
- Introduces
src/filepaths.cpp/.hwith a file-map-based “highest priority existing file” lookup API. - Switches swipe sprite loading and texture-map loading to use
prepare_file_fmtpath_prio(...)instead of per-file mod/campaign fallback logic. - Adjusts file group enums / resolution cases and updates build objects to include the new module.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| src/thing_creature.c | Uses the new priority-based path formatter for swipe sprite sheets. |
| src/filepaths.h | Declares the new file-map builder + priority-based path APIs. |
| src/filepaths.cpp | Implements file scanning, priority selection, and the new path APIs. |
| src/engine_textures.c | Replaces bespoke mod-search logic with the new priority-based resolver. |
| src/config.h | Updates TbFileGroups (removes old groups, adds FGrp_Mods). |
| src/config.c | Removes resolver cases for deleted file groups. |
| src/config_mods.c | Switches mods-order config lookup to FGrp_Mods. |
| Makefile | Adds filepaths object to the build. |
Suppressed comments (1)
src/filepaths.cpp:140
- These loops call
load_dirs()with too many arguments and also pass an incorrect directory path (missingMODS_DIR_NAME, and&nameis wrong). This will not compile and won’t scan mod directories correctly.
for (int i = 0; i < mods_conf.after_campaign_cnt; i++)
load_dirs(&mods_conf.after_campaign_item[i].name, FP_Mod_after_campaign, FP_Mod_after_campaign);
for (int i = 0; i < mods_conf.after_map_cnt; i++)
load_dirs(&mods_conf.after_map_item[i].name, FP_Mod_after_map, FP_Mod_after_map);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
for files that can be overridden by mods,
add a new prepare_file_fmtpath_prio, functions similar to the base prepare_file_fmtpath but will return the highest existing priority version of said file so no more mod specific logic needed for each file other than calling this one instead,
atm just files that get overriden completely, partial loaded files not covered here yet