Skip to content

Commit

Permalink
qbsp: fix test failure from last commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ericwa committed Nov 4, 2024
1 parent 3d7916e commit 3120d5b
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions common/imglib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -329,14 +329,7 @@ qvec3b calculate_average(const std::vector<qvec4b> &pixels)
std::tuple<std::optional<img::texture>, fs::resolve_result, fs::data> load_texture(const std::string_view &name,
bool meta_only, const gamedef_t *game, const settings::common_settings &options, bool no_prefix, bool mip_only)
{
fs::path prefix{};

if (!no_prefix) {
if (game->id == GAME_QUAKE_II || !mip_only) {
prefix = "textures";
}
}

fs::path prefix{"textures"};
std::vector<extension_info_t> exts;

if (mip_only) {
Expand All @@ -346,7 +339,14 @@ std::tuple<std::optional<img::texture>, fs::resolve_result, fs::data> load_textu
}

for (auto &ext : exts) {
fs::path p = (no_prefix ? fs::path(name) : (prefix / name)) += ext.suffix;
fs::path p;
if (no_prefix || ext.id == ext::MIP) {
// never add "textures/" prefix when attemmpting to load from a .wad file
p = fs::path(name);
} else {
p = (prefix / name);
}
p += ext.suffix;

if (auto pos = fs::where(p, options.filepriority.value() == settings::search_priority_t::LOOSE)) {
if (auto data = fs::load(pos)) {
Expand Down

0 comments on commit 3120d5b

Please sign in to comment.