1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-02-03 13:01:33 +02:00

Garrison: Fix selection behaviour when swapping with ally

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

View File

@ -241,14 +241,21 @@ bool CGarrisonSlot::split()
/// If certain creates cannot be moved, the selection should change
/// Force reselection in these cases
/// * When attempting to take creatures from ally
/// * When attempting to swap creatures with an ally
/// * When attempting to take unremovable units
/// @return Whether reselection must be done
bool CGarrisonSlot::mustForceReselection() const
{
const CGarrisonSlot * selection = owner->getSelection();
// Attempt to swap creatures with ally
if (selection->creature != creature && !selection->our())
bool withAlly = selection->our() ^ our();
if (!creature || !selection->creature)
return false;
// Attempt to take creatures from ally (select theirs first)
if (!selection->our())
return true;
// Attempt to swap creatures with ally (select ours first)
if (selection->creature != creature && withAlly)
return true;
if (!owner->removableUnits)
{