1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Additional check

This commit is contained in:
DjWarmonger 2015-02-22 18:36:13 +01:00
parent 9427dacc5d
commit 6797c374ed

View File

@ -2310,13 +2310,19 @@ bool CGameHandler::arrangeStacks( ObjectInstanceID id1, ObjectInstanceID id2, ui
if(what==1) //swap
{
if ( ((s1->tempOwner != player && s1->tempOwner != PlayerColor::UNFLAGGABLE) && s1->getStackCount(p1)) //why 254??
if ( ((s1->tempOwner != player && s1->tempOwner != PlayerColor::UNFLAGGABLE) && s1->getStackCount(p1))
|| ((s2->tempOwner != player && s2->tempOwner != PlayerColor::UNFLAGGABLE) && s2->getStackCount(p2)))
{
complain("Can't take troops from another player!");
return false;
}
if (sl1.army == sl2.army && sl1.slot == sl2.slot)
{
complain("Cannot swap stacks - slots are the same!");
return false;
}
swapStacks(sl1, sl2);
}
else if(what==2)//merge