(svn r2276) - CodeChange: remove DebugProc() and make the ALT+0...4 codes only available in debug mode
authorDarkvater
Fri, 06 May 2005 20:38:18 +0000
changeset 1772 eae288f4fd35
parent 1771 4d5d79a10809
child 1773 6b23326e2eab
(svn r2276) - CodeChange: remove DebugProc() and make the ALT+0...4 codes only available in debug mode
main_gui.c
ttd.c
--- a/main_gui.c	Fri May 06 18:34:28 2005 +0000
+++ b/main_gui.c	Fri May 06 20:38:18 2005 +0000
@@ -2292,7 +2292,7 @@
 	StatusBarWndProc
 };
 
-extern void DebugProc(int i);
+extern void UpdateAllStationVirtCoord(void);
 
 static void MainWindowWndProc(Window *w, WindowEvent *e) {
 	int off_x;
@@ -2339,8 +2339,7 @@
 			break;
 		}
 
-		if (_game_mode == GM_MENU)
-			break;
+		if (_game_mode == GM_MENU) break;
 
 		switch (e->keypress.keycode) {
 		case 'C': case 'Z': {
@@ -2356,18 +2355,26 @@
 		case WKC_ESC: ResetObjectToPlace(); break;
 		case WKC_DELETE: DeleteNonVitalWindows(); break;
 		case WKC_DELETE | WKC_SHIFT: DeleteAllNonVitalWindows(); break;
-		case 'Q' | WKC_CTRL: AskExitGame(); break;
-		case 'Q' | WKC_META: AskExitGame(); break; // this enables command + Q on mac
+		case 'Q' | WKC_CTRL: case 'Q' | WKC_META: AskExitGame(); break; // this enables command + Q on mac
 		case 'R' | WKC_CTRL: MarkWholeScreenDirty(); break;
-		case '0' | WKC_ALT:
-		case '1' | WKC_ALT:
-		case '2' | WKC_ALT:
+#if defined(_DEBUG)
+		case '0' | WKC_ALT: /* Crash the game */
+			*(byte*)0 = 0;
+			break;
+		case '1' | WKC_ALT: /* Gimme money */
+			/* Server can not cheat in advertise mode either! */
+		#ifdef ENABLE_NETWORK
+			if (!_networking || !_network_server || !_network_advertise)
+		#endif
+				DoCommandP(0, -10000000, 0, NULL, CMD_MONEY_CHEAT);
+			break;
+		case '2' | WKC_ALT: /* Update the coordinates of all station signs */
+			UpdateAllStationVirtCoord();
+			break;
 		case '3' | WKC_ALT:
 		case '4' | WKC_ALT:
-#if defined(_DEBUG)
-			DebugProc(e->keypress.keycode - ('0' | WKC_ALT));
+			break;
 #endif
-			break;
 
 		case 'X':
 			_display_opt ^= DO_TRANS_BUILDINGS;
@@ -2375,15 +2382,12 @@
 			break;
 
 #ifdef ENABLE_NETWORK
-		case WKC_RETURN:
-		case 'T' | WKC_SHIFT:
-			if (_networking)
-				ShowNetworkChatQueryWindow(DESTTYPE_BROADCAST, 0);
+		case WKC_RETURN: case 'T' | WKC_SHIFT:
+			if (_networking) ShowNetworkChatQueryWindow(DESTTYPE_BROADCAST, 0);
 			break;
-#endif /* ENABLE_NETWORK */
-
-		default:
-			return;
+#endif
+
+		default: return;
 		}
 		e->keypress.cont = false;
 		break;
--- a/ttd.c	Fri May 06 18:34:28 2005 +0000
+++ b/ttd.c	Fri May 06 20:38:18 2005 +0000
@@ -1413,22 +1413,3 @@
 
 	return true;
 }
-
-void DebugProc(int i)
-{
-	switch(i) {
-	case 0:
-		*(byte*)0 = 0;
-		break;
-	case 1:
-		/* Server can not cheat in advertise mode either! */
-#ifdef ENABLE_NETWORK
-		if (!_networking || !_network_server || !_network_advertise)
-#endif /* ENABLE_NETWORK */
-			DoCommandP(0, -10000000, 0, NULL, CMD_MONEY_CHEAT);
-		break;
-	case 2:
-		UpdateAllStationVirtCoord();
-		break;
-	}
-}