1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Do not use floating point equality checks

This commit is contained in:
Ivan Savenko
2024-02-13 23:42:05 +02:00
parent 9ebd194ab1
commit 7359b66f99
10 changed files with 42 additions and 48 deletions

View File

@@ -844,8 +844,8 @@ void CCreatureHandler::loadUnitAnimInfo(JsonNode & graphics, CLegacyConfigParser
missile["attackClimaxFrame"].Float() = parser.readNumber();
// assume that creature is not a shooter and should not have whole missile field
if (missile["frameAngles"].Vector()[0].Float() == 0 &&
missile["attackClimaxFrame"].Float() == 0)
if (missile["frameAngles"].Vector()[0].Integer() == 0 &&
missile["attackClimaxFrame"].Integer() == 0)
graphics.Struct().erase("missile");
}
@@ -987,10 +987,10 @@ void CCreatureHandler::loadStackExperience(CCreature * creature, const JsonNode
int lastVal = 0;
for (const JsonNode &val : values)
{
if (val.Float() != lastVal)
if (val.Integer() != lastVal)
{
JsonNode bonusInput = exp["bonus"];
bonusInput["val"].Float() = static_cast<int>(val.Float()) - lastVal;
bonusInput["val"].Float() = val.Integer() - lastVal;
auto bonus = JsonUtils::parseBonus (bonusInput);
bonus->source = BonusSource::STACK_EXPERIENCE;