1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-14 02:33:51 +02:00

Fixed crash when starting a game with new creatures on map using „Creature N” placeholders in armies.

This commit is contained in:
Michał W. Urbańczyk 2012-09-28 10:17:07 +00:00
parent 40624f96d9
commit 1fce4770fb

View File

@ -6855,11 +6855,9 @@ void CArmedInstance::randomizeArmy(int type)
int randID = j->second->idRand;
if(randID > max)
{
if(randID % 2)
j->second->setType(VLC->townh->towns[type].creatures[(randID-197) / 2 -1][0]);
else
j->second->setType(VLC->townh->towns[type].creatures[(randID-197) / 2 -1][1]);
int level = (randID-VLC->creh->creatures.size()) / 2 -1;
bool upgrade = !(randID % 2);
j->second->setType(VLC->townh->towns[type].creatures[level][upgrade]);
randID = -1;
}