mirror of
https://github.com/vcmi/vcmi.git
synced 2025-02-03 13:01:33 +02:00
* version set to 0.61
* Splitting: when moving slider to the right so that 0 is left in old slot the army is moved.
This commit is contained in:
parent
78d5839f4c
commit
608dc62ee8
@ -644,7 +644,7 @@ int CCallback::splitStack(const CGObjectInstance *s1, const CGObjectInstance *s2
|
|||||||
if(!val)
|
if(!val)
|
||||||
return -1;
|
return -1;
|
||||||
CCreatureSet *S1 = const_cast<CCreatureSet*>(getGarrison(s1)), *S2 = const_cast<CCreatureSet*>(getGarrison(s2));
|
CCreatureSet *S1 = const_cast<CCreatureSet*>(getGarrison(s1)), *S2 = const_cast<CCreatureSet*>(getGarrison(s2));
|
||||||
if ((S1->slots[p1].second<=val) && (true /*we are allowed to*/))
|
if ((S1->slots[p1].second<val) && (true /*we are allowed to*/))
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -652,6 +652,8 @@ int CCallback::splitStack(const CGObjectInstance *s1, const CGObjectInstance *s2
|
|||||||
S2->slots[p2].first = S1->slots[p1].first;
|
S2->slots[p2].first = S1->slots[p1].first;
|
||||||
S2->slots[p2].second = val;
|
S2->slots[p2].second = val;
|
||||||
S1->slots[p1].second -= val;
|
S1->slots[p1].second -= val;
|
||||||
|
if(!S1->slots[p1].second) //if we've moved all creatures
|
||||||
|
S1->slots.erase(p1);
|
||||||
|
|
||||||
|
|
||||||
if(s1->tempOwner<PLAYER_LIMIT)
|
if(s1->tempOwner<PLAYER_LIMIT)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user