1
0
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:
Dydzio 2023-12-23 15:32:21 +01:00
parent 20ede710c2
commit bcda68abef

View File

@ -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;