1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Minor fixes

This commit is contained in:
Dmitry Orlov 2021-12-20 02:34:35 +03:00 committed by Andrii Danylchenko
parent 8cae3398ba
commit 9e3c4b69c4
2 changed files with 9 additions and 5 deletions

View File

@ -1931,9 +1931,13 @@ const std::string CGTownBuilding::getVisitingBonusGreeting() const
bonusGreeting = std::string(VLC->generaltexth->localizedTexts["townHall"]["greetingDefence"].String());
break;
}
assert(!bonusGreeting.empty());
auto buildingName = town->town->getSpecialBuilding(bType)->Name();
if(bonusGreeting.empty())
{
bonusGreeting = "Error: Bonus greeting for '%s' is not localized.";
logGlobal->error("'%s' building of '%s' faction has not localized bonus greeting.", buildingName, town->town->getLocalizedFactionName());
}
boost::algorithm::replace_first(bonusGreeting, "%s", buildingName);
town->town->setGreeting(bType, bonusGreeting);
return bonusGreeting;

View File

@ -216,14 +216,14 @@ void CMapLoaderH3M::readPlayerInfo()
ui16 totalFactions = GameConstants::F_NUMBER;
if(mapHeader->version != EMapFormat::ROE)
allowedFactions += reader.readUInt8() * 256;
allowedFactions += reader.readUInt8() * 256; // 256 = 2^8 = 0b100000000
else
totalFactions--; //exclude conflux for ROE
const bool isFactionRandom = mapHeader->players[i].isFactionRandom = reader.readBool();
const ui16 allFactionsMask = (mapHeader->version == EMapFormat::ROE)
? 0b1111111
: 0b11111111;
? 0b11111111 // 8 towns for ROE
: 0b111111111; // 8 towns + Conflux
const bool allFactionsAllowed = mapHeader->version == EMapFormat::VCMI
|| (isFactionRandom && ((allowedFactions & allFactionsMask) == allFactionsMask));