1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Little refactoring

This commit is contained in:
nordsoft 2023-09-11 14:27:37 +02:00
parent 94c6adb28c
commit 082e1194ff

View File

@ -87,11 +87,10 @@ std::string AbstractSettings::getTownName(const CMap & map, int objectIdx)
std::string name;
if(auto town = dynamic_cast<const CGTownInstance*>(map.objects[objectIdx].get()))
{
auto * ctown = town->town;
if(!ctown)
ctown = VLC->townh->randomTown;
name = ctown->faction ? town->getObjectName() : town->getNameTranslated() + ", (random)";
name = town->getNameTranslated();
if(name.empty())
name = town->getTown()->faction->getNameTranslated();
}
return name;
}