Skip to content

Filepaths - #5095

Draft
PieterVdc wants to merge 4 commits into
dkfans:masterfrom
PieterVdc:filepaths
Draft

Filepaths#5095
PieterVdc wants to merge 4 commits into
dkfans:masterfrom
PieterVdc:filepaths

Conversation

@PieterVdc

@PieterVdc PieterVdc commented Aug 5, 2026

Copy link
Copy Markdown
Member

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

@PieterVdc
PieterVdc marked this pull request as ready for review August 6, 2026 10:15
Copilot AI lite review requested due to automatic review settings August 6, 2026 10:15
@PieterVdc
PieterVdc marked this pull request as draft August 6, 2026 10:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/.h with 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 (missing MODS_DIR_NAME, and &name is 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.

Comment thread src/filepaths.h
Comment thread src/filepaths.h
Comment thread src/filepaths.h
Comment thread src/filepaths.cpp
Comment thread src/filepaths.cpp
Comment thread src/filepaths.cpp
Comment thread src/engine_textures.c
Comment thread src/filepaths.h
Comment thread src/engine_textures.c
Comment thread src/filepaths.cpp
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants