Browse Source

UI now correctly blocks stack rearrangement when it is not our turn

Ivan Savenko 1 year ago
parent
commit
1775caa872
1 changed files with 9 additions and 1 deletions
  1. 9 1
      client/widgets/CGarrisonInt.cpp

+ 9 - 1
client/widgets/CGarrisonInt.cpp

@@ -269,14 +269,22 @@ bool CGarrisonSlot::mustForceReselection() const
 {
 	const CGarrisonSlot * selection = owner->getSelection();
 	bool withAlly = selection->our() ^ our();
+
+	// not our turn - actions are blocked
+	if (!LOCPLINT->makingTurn)
+		return true;
+
 	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)
 	{
 		if (selection->upg == EGarrisonType::UPPER)
@@ -315,7 +323,7 @@ void CGarrisonSlot::clickPressed(const Point & cursorPosition)
 		{
 			if(creature)
 				owner->selectSlot(this);
-			redraw();
+			owner->redraw();
 			refr = true;
 		}
 		else