(svn r2573) Codechange: Removed WDF_RESTORE_DPARAM, it's not needed with the new string system.
authorludde
Fri, 15 Jul 2005 15:09:52 +0000
changeset 2064 e6a2b42d0b15
parent 2063 ae866a12f2df
child 2065 c3810847175d
(svn r2573) Codechange: Removed WDF_RESTORE_DPARAM, it's not needed with the new string system.
Also fixed a bug introduced in r2564, forgot to remove 4 global variables in network_gui.c.
network_gui.c
order_gui.c
player_gui.c
settings_gui.c
widget.c
window.h
--- a/network_gui.c	Fri Jul 15 14:53:44 2005 +0000
+++ b/network_gui.c	Fri Jul 15 15:09:52 2005 +0000
@@ -43,8 +43,6 @@
 	INVALID_STRING_ID
 };
 
-static StringID _str_map_name, _str_game_name, _str_server_version, _str_server_address;
-
 enum {
 	NET_PRC__OFFSET_TOP_WIDGET					= 74,
 	NET_PRC__OFFSET_TOP_WIDGET_COMPANY	= 42,
@@ -181,7 +179,7 @@
 		if (_selected_item == NULL) {
 			DrawStringMultiCenter(365, 40, STR_NETWORK_GAME_INFO, 0);
 		} else if (!_selected_item->online) {
-			SetDParam(0, _str_game_name);
+			SetDParamStr(0, _selected_item->info.server_name);
 			DrawStringMultiCenter(365, 42, STR_ORANGE, 2); // game name
 
 			DrawStringMultiCenter(365, 110, STR_NETWORK_SERVER_OFFLINE, 2); // server offline
@@ -397,7 +395,7 @@
 static const WindowDesc _network_game_window_desc = {
 	WDP_CENTER, WDP_CENTER, 490, 215,
 	WC_NETWORK_WINDOW,0,
-	WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESTORE_DPARAM,
+	WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
 	_network_game_window_widgets,
 	NetworkGameWindowWndProc,
 };
@@ -624,7 +622,7 @@
 static const WindowDesc _network_start_server_window_desc = {
 	WDP_CENTER, WDP_CENTER, 420, 200,
 	WC_NETWORK_WINDOW,0,
-	WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESTORE_DPARAM,
+	WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
 	_network_start_server_window_widgets,
 	NetworkStartServerWindowWndProc,
 };
@@ -681,7 +679,7 @@
 
 		DrawWindowWidgets(w);
 
-		SetDParam(0, _str_game_name);
+		SetDParamStr(0, _selected_item->info.server_name);
 		DrawString(10, 22, STR_NETWORK_PREPARE_TO_JOIN, 2);
 
 		// draw company list
--- a/order_gui.c	Fri Jul 15 14:53:44 2005 +0000
+++ b/order_gui.c	Fri Jul 15 15:09:52 2005 +0000
@@ -543,7 +543,7 @@
 static const WindowDesc _orders_train_desc = {
 	-1,-1, 385, 88,
 	WC_VEHICLE_ORDERS,WC_VEHICLE_VIEW,
-	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESTORE_DPARAM | WDF_RESIZABLE,
+	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE,
 	_orders_train_widgets,
 	OrdersWndProc
 };
@@ -568,7 +568,7 @@
 static const WindowDesc _orders_desc = {
 	-1,-1, 396, 88,
 	WC_VEHICLE_ORDERS,WC_VEHICLE_VIEW,
-	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESTORE_DPARAM | WDF_RESIZABLE,
+	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE,
 	_orders_widgets,
 	OrdersWndProc
 };
--- a/player_gui.c	Fri Jul 15 14:53:44 2005 +0000
+++ b/player_gui.c	Fri Jul 15 15:09:52 2005 +0000
@@ -182,7 +182,7 @@
 static const WindowDesc _player_finances_desc = {
 	-1,-1, 407, 216,
 	WC_FINANCES,0,
-	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESTORE_DPARAM | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON,
+	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON,
 	_player_finances_widgets,
 	PlayerFinancesWndProc
 };
@@ -190,7 +190,7 @@
 static const WindowDesc _player_finances_small_desc = {
 	-1,-1, 280, 60,
 	WC_FINANCES,0,
-	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESTORE_DPARAM | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON,
+	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON,
 	_player_finances_small_widgets,
 	PlayerFinancesWndProc
 };
@@ -198,7 +198,7 @@
 static const WindowDesc _other_player_finances_desc = {
 	-1,-1, 407, 204,
 	WC_FINANCES,0,
-	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESTORE_DPARAM | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON,
+	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON,
 	_other_player_finances_widgets,
 	PlayerFinancesWndProc
 };
@@ -206,7 +206,7 @@
 static const WindowDesc _other_player_finances_small_desc = {
 	-1,-1, 280, 48,
 	WC_FINANCES,0,
-	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESTORE_DPARAM | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON,
+	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON,
 	_other_player_finances_small_widgets,
 	PlayerFinancesWndProc
 };
--- a/settings_gui.c	Fri Jul 15 14:53:44 2005 +0000
+++ b/settings_gui.c	Fri Jul 15 15:09:52 2005 +0000
@@ -269,7 +269,7 @@
 static const WindowDesc _game_options_desc = {
 	WDP_CENTER, WDP_CENTER, 370, 239,
 	WC_GAME_OPTIONS,0,
-	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESTORE_DPARAM | WDF_UNCLICK_BUTTONS,
+	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
 	_game_options_widgets,
 	GameOptionsWndProc
 };
--- a/widget.c	Fri Jul 15 14:53:44 2005 +0000
+++ b/widget.c	Fri Jul 15 15:09:52 2005 +0000
@@ -157,12 +157,8 @@
 	const Widget *wi;
 	DrawPixelInfo *dpi = _cur_dpi;
 	Rect r;
-	uint32 dparam_backup[20];
 	uint32 cur_click, cur_disabled, cur_hidden;
 
-	if (w->desc_flags & WDF_RESTORE_DPARAM)
-		COPY_OUT_DPARAM(dparam_backup, 0, lengthof(dparam_backup));
-
 	wi = w->widget;
 
 	cur_click = w->click_state;
@@ -207,7 +203,7 @@
 
 			DrawStringCentered(((r.left + r.right + 1) >> 1) + clicked, ((r.top + r.bottom + 1) >> 1) - 5 + clicked, str, 0);
 			//DrawStringCentered((r.left + r.right+1)>>1, ((r.top+r.bottom + 1)>>1) - 5, str, 0);
-			goto restore_dparam;
+			goto draw_default;
 		}
 
 		case WWT_6: {
@@ -216,7 +212,6 @@
 
 			if ((str = wi->unkA) != 0) {
 				DrawString(r.left+2, r.top+1, str, 0);
-				goto restore_dparam;
 			}
 			goto draw_default;
 		}
@@ -396,7 +391,7 @@
 			GfxFillRect(r.left+1, r.bottom-1, r.right-1, r.bottom-1, c1);
 			GfxFillRect(r.left, r.bottom, r.right, r.bottom, c2);
 
-			goto restore_dparam;
+			goto draw_default;
 		}
 
 		case WWT_STICKYBOX: {
@@ -425,9 +420,6 @@
 			}
 
 			DrawStringCentered( (r.left+r.right+1)>>1, r.top+2, wi->unkA, 0x84);
-restore_dparam:;
-			if (w->desc_flags & WDF_RESTORE_DPARAM)
-				COPY_IN_DPARAM(0, dparam_backup, lengthof(dparam_backup));
 draw_default:;
 			if (cur_disabled & 1) {
 				GfxFillRect(r.left+1, r.top+1, r.right-1, r.bottom-1, _color_list[wi->color&0xF].unk2 | 0x8000);
--- a/window.h	Fri Jul 15 14:53:44 2005 +0000
+++ b/window.h	Fri Jul 15 15:09:52 2005 +0000
@@ -229,7 +229,7 @@
 	WDF_STD_TOOLTIPS   = 1, /* use standard routine when displaying tooltips */
 	WDF_DEF_WIDGET     = 2,	/* default widget control for some widgets in the on click event */
 	WDF_STD_BTN        = 4,	/* default handling for close and drag widgets (widget no 0 and 1) */
-	WDF_RESTORE_DPARAM = 8, /* when drawing widgets, restore the dparam so all widgets recieve the same set of them */
+
 	WDF_UNCLICK_BUTTONS=16, /* Unclick buttons when the window event times out */
 	WDF_STICKY_BUTTON  =32, /* Set window to sticky mode; they are not closed unless closed with 'X' (widget 2) */
 	WDF_RESIZABLE      =64, /* A window can be resized */