Skip to content

Commit

Permalink
Merge pull request #560 from Wargus/loadStratagusMap_extension
Browse files Browse the repository at this point in the history
Fix regression of `LoadStratagusMap` for compression extension.
  • Loading branch information
Jarod42 authored Nov 11, 2023
2 parents 10f0428 + f3d3adb commit 05bbc3b
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/game/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,20 @@ static void LoadStratagusMap(const fs::path &smpdir, const fs::path &mapname)
fs::path(StratagusLibPath) / smpdir / mapname,
fs::path(StratagusLibPath) / mapname,
fs::path(mapname)}) {
if (fs::exists(candidate)) {
const std::string_view extra_extensions[] = {
"",
#ifdef USE_ZLIB
".gz",
#endif
#ifdef USE_BZ2LIB
".bz2",
#endif
};
if (ranges::any_of(extra_extensions, [&](const auto extension) {
auto extra_candidate = candidate;
extra_candidate.replace_extension(candidate.extension().string() + extension.data());
return fs::exists(extra_candidate);
})) {
mapfull = candidate;
break;
}
Expand Down

0 comments on commit 05bbc3b

Please sign in to comment.