From dafc40d896cc2ed9bbc5d80adff94ed582ad6df4 Mon Sep 17 00:00:00 2001 From: Sandy Carter Date: Mon, 24 Aug 2015 20:43:10 -0400 Subject: [PATCH] Garrison: Fix selection behaviour when swapping with ally --- client/widgets/CGarrisonInt.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/client/widgets/CGarrisonInt.cpp b/client/widgets/CGarrisonInt.cpp index 3059d6101..3f514c4fc 100644 --- a/client/widgets/CGarrisonInt.cpp +++ b/client/widgets/CGarrisonInt.cpp @@ -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) {