Przeglądaj źródła

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

Ivan Savenko 1 rok temu
rodzic
commit
1775caa872
1 zmienionych plików z 9 dodań i 1 usunięć
  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();
 	const CGarrisonSlot * selection = owner->getSelection();
 	bool withAlly = selection->our() ^ our();
 	bool withAlly = selection->our() ^ our();
+
+	// not our turn - actions are blocked
+	if (!LOCPLINT->makingTurn)
+		return true;
+
 	if (!creature || !selection->creature)
 	if (!creature || !selection->creature)
 		return false;
 		return false;
+
 	// Attempt to take creatures from ally (select theirs first)
 	// Attempt to take creatures from ally (select theirs first)
 	if (!selection->our())
 	if (!selection->our())
 		return true;
 		return true;
+
 	// Attempt to swap creatures with ally (select ours first)
 	// Attempt to swap creatures with ally (select ours first)
 	if (selection->creature != creature && withAlly)
 	if (selection->creature != creature && withAlly)
 		return true;
 		return true;
+
 	if (!owner->removableUnits)
 	if (!owner->removableUnits)
 	{
 	{
 		if (selection->upg == EGarrisonType::UPPER)
 		if (selection->upg == EGarrisonType::UPPER)
@@ -315,7 +323,7 @@ void CGarrisonSlot::clickPressed(const Point & cursorPosition)
 		{
 		{
 			if(creature)
 			if(creature)
 				owner->selectSlot(this);
 				owner->selectSlot(this);
-			redraw();
+			owner->redraw();
 			refr = true;
 			refr = true;
 		}
 		}
 		else
 		else