1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

Fixed the stables crash #799.

This commit is contained in:
Michał W. Urbańczyk 2011-09-02 05:44:53 +00:00
parent bcce343b6c
commit 5072bda7e6

View File

@ -4789,23 +4789,24 @@ void CGBonusingObject::onHeroVisit( const CGHeroInstance * h ) const
break;
case 94: //Stables
sound = soundBase::horse20;
CCreatureSet creatures;
bool someUpgradeDone = false;
for (TSlots::const_iterator i = h->Slots().begin(); i != h->Slots().end(); ++i)
{
if(i->second->type->idNumber == 10)
creatures.stacks.insert(*i);
{
cb->changeStackType(StackLocation(h, i->first), VLC->creh->creatures[11]);
someUpgradeDone = true;
}
}
if (creatures.stacks.size())
if (someUpgradeDone)
{
messageID = 138;
iw.components.push_back(Component(Component::CREATURE,11,0,1));
for (TSlots::const_iterator i = creatures.stacks.begin(); i != creatures.stacks.end(); ++i)
{
cb->changeStackType(StackLocation(h, i->first), VLC->creh->creatures[11]);
}
}
else
messageID = 137;
gbonus.bonus.type = Bonus::LAND_MOVEMENT;
gbonus.bonus.val = 600;
bonusMove = 600;