mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-26 03:52:01 +02:00
One more file.
This commit is contained in:
parent
56cd172b82
commit
f758d13a22
@ -2153,20 +2153,16 @@ void CGameHandler::giveCreatures (int objid, const CGHeroInstance * h, CCreature
|
|||||||
heroArmy.addToSlot(slot, creatures.slots.begin()->second);
|
heroArmy.addToSlot(slot, creatures.slots.begin()->second);
|
||||||
creatures.slots.erase (creatures.slots.begin());
|
creatures.slots.erase (creatures.slots.begin());
|
||||||
}
|
}
|
||||||
|
//move all matching creatures to hero's army
|
||||||
|
SetGarrisons sg;
|
||||||
|
sg.garrs[h->id] = heroArmy;
|
||||||
|
//garrisons need to be synchronized after this, even if object vanishes
|
||||||
|
sg.garrs[objid] = creatures;
|
||||||
|
sendAndApply (&sg);
|
||||||
|
|
||||||
if (creatures.stacksCount() == 0) //all creatures can be moved to hero army - do that
|
if (creatures.stacksCount()) //show garrison window and let player pick remaining creatures
|
||||||
{
|
{
|
||||||
SetGarrisons sg;
|
|
||||||
sg.garrs[h->id] = heroArmy;
|
|
||||||
sendAndApply(&sg);
|
|
||||||
}
|
|
||||||
else //show garrison window and let player pick creatures
|
|
||||||
{
|
|
||||||
SetGarrisons sg;
|
|
||||||
sg.garrs[objid] = creatures;
|
|
||||||
sendAndApply (&sg);
|
|
||||||
showGarrisonDialog (objid, h->id, true, 0);
|
showGarrisonDialog (objid, h->id, true, 0);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void CGameHandler::takeCreatures (int objid, TSlots creatures) //probably we could use ArmedInstance as well
|
void CGameHandler::takeCreatures (int objid, TSlots creatures) //probably we could use ArmedInstance as well
|
||||||
|
Loading…
x
Reference in New Issue
Block a user