1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Garrison: Move all but one creature when last slot

This commit is contained in:
Sandy Carter 2015-08-24 20:43:52 -04:00
parent dafc40d896
commit a79ade7d44

View File

@ -299,10 +299,22 @@ void CGarrisonSlot::clickLeft(tribool down, bool previousState)
refr = split();
// swap
else if(creature != selection->creature)
{
const CArmedInstance * selectedObj = owner->armedObjs[selection->upg];
if (!creature && selectedObj->stacksCount() == 1)
LOCPLINT->cb->splitStack(selectedObj, owner->armedObjs[upg], selection->ID, ID, myStack->count - 1);
else
LOCPLINT->cb->swapCreatures(owner->armedObjs[upg], owner->armedObjs[selection->upg], ID, selection->ID);
}
// merge
else
{
const CArmedInstance * selectedObj = owner->armedObjs[selection->upg];
if (selectedObj->stacksCount() == 1)
LOCPLINT->cb->splitStack(owner->armedObjs[upg], selectedObj, selection->ID, ID, 1);
else
LOCPLINT->cb->mergeStacks(owner->armedObjs[selection->upg], owner->armedObjs[upg], selection->ID, ID);
}
if(refr)
{
// Refresh Statusbar