From 2a822b0d22b186eaa0a6e218f117a9924503e347 Mon Sep 17 00:00:00 2001
From: mr-russ <>
Date: Fri, 28 Feb 2003 10:18:22 +0000
Subject: [PATCH] Fixed bug #233900: Train new units in pause mode didn't work.

---
 doc/ChangeLog.html   |  2 ++
 src/ui/interface.cpp |  6 +++---
 src/ui/mouse.cpp     | 14 +++++++-------
 3 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/doc/ChangeLog.html b/doc/ChangeLog.html
index 606e184b6..9ec3d1a54 100644
--- a/doc/ChangeLog.html
+++ b/doc/ChangeLog.html
@@ -1101,6 +1101,8 @@
     <LI>Fixed "make buildit" (from Nehal Mistry).
     <LI>Fixed crash when middle clicking in a menu (from Nehal Mistry).
     <LI>Fixed crash on BSD (from Jimmy Salmon and ppl).
+    <LI>Fixed bug #233900: Train new units in pause mode didn't work.
+	(from Russell Smith).
     <LI>+++
     </UL>
 </UL>
diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp
index 4e15f143b..c9723f8d2 100644
--- a/src/ui/interface.cpp
+++ b/src/ui/interface.cpp
@@ -1068,12 +1068,12 @@ local int InputKey(int key)
     switch (key) {
 	case '\r':
 	    if (Input[0] == '(') {
-		if (!GameObserve) {
+		if (!GameObserve && !GamePaused) {
 		    CommandLog("input", NoUnitP,FlushCommands,-1,-1,NoUnitP,Input,-1);
 		    CclCommand(Input);
 		}
 	    } else if (NetworkFildes==-1) {
-		if (!GameObserve) {
+		if (!GameObserve && !GamePaused) {
 		    int ret;
 		    ret = HandleCheats(Input);
 		    if (ret) {
@@ -1259,7 +1259,7 @@ global void HandleKeyDown(unsigned key,unsigned keychar)
 	// If no modifier look if button bound
 	if( !(KeyModifiers&(ModifierControl|ModifierAlt
 		|ModifierSuper|ModifierHyper)) ) {
-	    if( !GameObserve ) {
+	    if( !GameObserve && !GamePaused ) {
 		if( DoButtonPanelKey(key) ) {
 		    return;
 		}
diff --git a/src/ui/mouse.cpp b/src/ui/mouse.cpp
index ede3af1a0..5afd250a8 100644
--- a/src/ui/mouse.cpp
+++ b/src/ui/mouse.cpp
@@ -1315,7 +1315,7 @@ global void UIHandleButtonDown(unsigned button)
     //	Selecting target. (Move,Attack,Patrol,... commands);
     //
     if( CursorState==CursorStateSelect ) {
-	if( !GameObserve ) {
+	if( !GameObserve && !GamePaused ) {
 	    UISelectStateButtonDown(button);
 	}
 	return;
@@ -1385,7 +1385,7 @@ global void UIHandleButtonDown(unsigned button)
 	    DebugLevel3("Cursor middle down %d,%d\n" _C_ CursorX _C_ CursorY);
 	    MustRedraw|=RedrawCursor;
 	} else if( MouseButtons&RightButton ) {
-	    if( !GameObserve ) {
+	    if( !GameObserve && !GamePaused ) {
 		Unit* unit;
 		// FIXME: Rethink the complete chaos of coordinates here
 		// FIXME: Johns: Perhaps we should use a pixel map coordinates
@@ -1423,7 +1423,7 @@ global void UIHandleButtonDown(unsigned button)
 	    ViewportCenterViewpoint(TheUI.SelectedViewport,
 		ScreenMinimap2MapX(CursorX), ScreenMinimap2MapY(CursorY));
 	} else if( MouseButtons&RightButton ) {
-	    if( !GameObserve ) {
+	    if( !GameObserve && !GamePaused ) {
 		MakeLocalMissile(MissileTypeGreenCross
 			,ScreenMinimap2MapX(CursorX)*TileSizeX+TileSizeX/2
 			,ScreenMinimap2MapY(CursorY)*TileSizeY+TileSizeY/2,0,0);
@@ -1440,7 +1440,7 @@ global void UIHandleButtonDown(unsigned button)
 	//	clicked on info panel - selection shown
 	//
 	if( NumSelected>1 && ButtonUnderCursor && ButtonUnderCursor<10 ) {
-	    if( !GameObserve ) {
+	    if( !GameObserve && !GamePaused ) {
 		DoSelectionButtons(ButtonUnderCursor-1,button);
 	    }
 	} else if( (MouseButtons&LeftButton) ) {
@@ -1464,7 +1464,7 @@ global void UIHandleButtonDown(unsigned button)
 	    //
 	    } else if( ButtonUnderCursor>3 && ButtonUnderCursor<10 ) {
 		if( NumSelected==1 && Selected[0]->Type->Transporter ) {
-		    if( !GameObserve ) {
+		    if( !GameObserve && !GamePaused ) {
 			if( Selected[0]->OnBoard[ButtonUnderCursor-4] ) {
 			    // FIXME: should check if valid here.
 			    SendCommandUnload(Selected[0]
@@ -1476,7 +1476,7 @@ global void UIHandleButtonDown(unsigned button)
 		}
 		else if( NumSelected==1 && Selected[0]->Type->Building &&
 		         Selected[0]->Orders[0].Action==UnitActionTrain) {
-		    if( !GameObserve ) {
+		    if( !GameObserve && !GamePaused ) {
 			int slotid = ButtonUnderCursor-4;
 			if ( Selected[0]->Data.Train.Count == 1 ) {
 			    // FIXME: ignore clicks that did not hit
@@ -1499,7 +1499,7 @@ global void UIHandleButtonDown(unsigned button)
 	    //	clicked on button panel
 	    //
 	    } else if( ButtonUnderCursor>9 ) {
-		if( !GameObserve ) {
+		if( !GameObserve && !GamePaused ) {
 		    DoButtonButtonClicked(ButtonUnderCursor-10);
 		}
 	    }