Skip to content

Commit

Permalink
use preferredEqual to find the level title
Browse files Browse the repository at this point in the history
fixes CE-639
  • Loading branch information
stohrendorf committed Jul 29, 2023
1 parent 36a93c8 commit 6ab5e00
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/menu/savegamelistmenustate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -615,13 +615,19 @@ void SavegameListMenuState::updateSavegameInfos(const engine::world::World& worl
std::string levelTitle;
if(slot.has_value())
{
const auto& titles = levelFilepathsTitles.at(info.meta.filename);
auto titleIt = titles.find(world.getEngine().getLocaleWithoutEncoding());
if(titleIt == titles.end())
const auto titlesIt = std::find_if(levelFilepathsTitles.cbegin(),
levelFilepathsTitles.cend(),
[&info](const auto& entry)
{
return util::preferredEqual(entry.first, info.meta.filename);
});
gsl_Assert(titlesIt != levelFilepathsTitles.cend());
auto titleIt = titlesIt->second.find(world.getEngine().getLocaleWithoutEncoding());
if(titleIt == titlesIt->second.end())
{
titleIt = titles.find("en_GB");
titleIt = titlesIt->second.find("en_GB");
}
gsl_Assert(titleIt != titles.end());
gsl_Assert(titleIt != titlesIt->second.end());
levelTitle = titleIt->second;
}
else
Expand Down

0 comments on commit 6ab5e00

Please sign in to comment.