1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

Fix crash with objects belonging players without state

This commit is contained in:
nordsoft
2022-11-06 03:26:13 +04:00
parent ae1d2c50e2
commit 0f35082024
15 changed files with 92 additions and 88 deletions

View File

@@ -1345,12 +1345,12 @@ void CCreatureHandler::buildBonusTreeForTiers()
for(CCreature * c : objects)
{
if(vstd::isbetween(c->level, 0, ARRAY_COUNT(creaturesOfLevel)))
c->attachTo(&creaturesOfLevel[c->level]);
c->attachTo(creaturesOfLevel[c->level]);
else
c->attachTo(&creaturesOfLevel[0]);
c->attachTo(creaturesOfLevel[0]);
}
for(CBonusSystemNode &b : creaturesOfLevel)
b.attachTo(&allCreatures);
b.attachTo(allCreatures);
}
void CCreatureHandler::afterLoadFinalization()