1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

lib/BasicTypes.cpp: Remove the unary minus operator or change the expression's underlying type.

Unary minus should not be applied to an unsigned expression
This commit is contained in:
Alexander Wilms 2023-10-27 14:47:09 +00:00
parent 2b21001743
commit 70acf987b4

View File

@ -111,7 +111,7 @@ int AFactionMember::moraleValAndBonusList(TConstBonusListPtr & bonusList) const
bonusList = getBonusBearer()->getBonuses(moraleSelector, cachingStrMor);
int32_t maxGoodMorale = VLC->settings()->getVector(EGameSettings::COMBAT_GOOD_MORALE_DICE).size();
int32_t maxBadMorale = -VLC->settings()->getVector(EGameSettings::COMBAT_BAD_MORALE_DICE).size();
int32_t maxBadMorale = - (int32_t) VLC->settings()->getVector(EGameSettings::COMBAT_BAD_MORALE_DICE).size();
return std::clamp(bonusList->totalValue(), maxBadMorale, maxGoodMorale);
}
@ -130,7 +130,7 @@ int AFactionMember::luckValAndBonusList(TConstBonusListPtr & bonusList) const
bonusList = getBonusBearer()->getBonuses(luckSelector, cachingStrLuck);
int32_t maxGoodLuck = VLC->settings()->getVector(EGameSettings::COMBAT_GOOD_LUCK_DICE).size();
int32_t maxBadLuck = -VLC->settings()->getVector(EGameSettings::COMBAT_BAD_LUCK_DICE).size();
int32_t maxBadLuck = - (int32_t) VLC->settings()->getVector(EGameSettings::COMBAT_BAD_LUCK_DICE).size();
return std::clamp(bonusList->totalValue(), maxBadLuck, maxGoodLuck);
}