mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Fix possible overflow errors on leveling up beyond int64_t limit
- added separate giveExperience method instead of weird changePrimSkill - experience is now always used in form of int64_t - max supported level reduced from 201 to 197 to fit into int64_t - fixed undefined behavior in experience calculation
This commit is contained in:
@@ -1138,7 +1138,7 @@ void CGSirens::onHeroVisit( const CGHeroInstance * h ) const
|
||||
xp = h->calculateXp(static_cast<int>(xp));
|
||||
iw.text.appendLocalString(EMetaText::ADVOB_TXT,132);
|
||||
iw.text.replaceNumber(static_cast<int>(xp));
|
||||
cb->changePrimSkill(h, PrimarySkill::EXPERIENCE, xp, false);
|
||||
cb->giveExperience(h, xp);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user