mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Fix crash on giving WoG experience - quantity 0 unit on army transfer
This commit is contained in:
parent
20ede710c2
commit
bcda68abef
@ -1973,7 +1973,9 @@ bool CGameHandler::bulkMoveArmy(ObjectInstanceID srcArmy, ObjectInstanceID destA
|
||||
{
|
||||
const bool needsLastStack = armySrc->needsLastStack();
|
||||
const auto quantity = setSrc.getStackCount(srcSlot) - (needsLastStack ? 1 : 0);
|
||||
moves.insert(std::make_pair(srcSlot, std::make_pair(slotToMove, quantity)));
|
||||
|
||||
if(quantity > 0) //0 may happen when we need last creature and we have exactly 1 amount of that creature - amount of "rest we can transfer" becomes 0
|
||||
moves.insert(std::make_pair(srcSlot, std::make_pair(slotToMove, quantity)));
|
||||
}
|
||||
}
|
||||
BulkRebalanceStacks bulkRS;
|
||||
|
Loading…
Reference in New Issue
Block a user