1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-15 01:24:45 +02:00

More fixes for map-specific crashes, fixes #1427 and #733

- if special victory condition is present AND there is only one player
normal victory condition will be disabled
- added new triggered condition, constant value
- if target of CONTROL/DESTROY condition is removed from map, triggered
condition will be replaced with constant
- fixed randomization of armies with random stacks
This commit is contained in:
Ivan Savenko
2014-02-09 12:10:02 +00:00
parent 30aa07f86c
commit 7f07a30d7d
9 changed files with 59 additions and 15 deletions

View File

@ -7162,17 +7162,18 @@ void CGLighthouse::giveBonusTo( PlayerColor player ) const
void CArmedInstance::randomizeArmy(int type)
{
int max = VLC->creh->creatures.size();
for (auto & elem : stacks)
{
int randID = elem.second->idRand;
if(randID > max)
int & randID = elem.second->idRand;
if(randID >= 0)
{
int level = (randID-VLC->creh->creatures.size()) / 2 -1;
bool upgrade = !(randID % 2);
int level = randID / 2;
bool upgrade = randID % 2;
elem.second->setType(VLC->townh->factions[type]->town->creatures[level][upgrade]);
}
randID = -1;
}
assert(elem.second->valid(false));
assert(elem.second->armyObj == this);
}
return;