From 9e3c4b69c40c8b1744d74e912b228a9a0fca1af6 Mon Sep 17 00:00:00 2001 From: Dmitry Orlov Date: Mon, 20 Dec 2021 02:34:35 +0300 Subject: [PATCH] Minor fixes --- lib/mapObjects/CGTownInstance.cpp | 8 ++++++-- lib/mapping/MapFormatH3M.cpp | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/mapObjects/CGTownInstance.cpp b/lib/mapObjects/CGTownInstance.cpp index 9dd039fa0..c93e11b42 100644 --- a/lib/mapObjects/CGTownInstance.cpp +++ b/lib/mapObjects/CGTownInstance.cpp @@ -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; diff --git a/lib/mapping/MapFormatH3M.cpp b/lib/mapping/MapFormatH3M.cpp index 5b756d625..09cdb5ef7 100644 --- a/lib/mapping/MapFormatH3M.cpp +++ b/lib/mapping/MapFormatH3M.cpp @@ -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));