summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorludde <ludde@openttd.org>2005-07-15 15:09:52 +0000
committerludde <ludde@openttd.org>2005-07-15 15:09:52 +0000
commita069876725080c783a7def816081867a2574d3a0 (patch)
tree37eff27994a6fc0a501ac19e29cb3cefde9dc65b
parent2fa79c9b4d140f78e5e6392aded7beebeec5c230 (diff)
downloadopenttd-a069876725080c783a7def816081867a2574d3a0.tar.xz
(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.
-rw-r--r--network_gui.c10
-rw-r--r--order_gui.c4
-rw-r--r--player_gui.c8
-rw-r--r--settings_gui.c2
-rw-r--r--widget.c12
-rw-r--r--window.h2
6 files changed, 14 insertions, 24 deletions
diff --git a/network_gui.c b/network_gui.c
index 0f33962d2..e1dad6e8c 100644
--- a/network_gui.c
+++ b/network_gui.c
@@ -43,8 +43,6 @@ static const StringID _lan_internet_types_dropdown[] = {
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 @@ static void NetworkGameWindowWndProc(Window *w, WindowEvent *e)
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 Widget _network_game_window_widgets[] = {
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 Widget _network_start_server_window_widgets[] = {
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 @@ static void NetworkLobbyWindowWndProc(Window *w, WindowEvent *e)
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
diff --git a/order_gui.c b/order_gui.c
index a125403be..f0dd46538 100644
--- a/order_gui.c
+++ b/order_gui.c
@@ -543,7 +543,7 @@ static const Widget _orders_train_widgets[] = {
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 Widget _orders_widgets[] = {
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
};
diff --git a/player_gui.c b/player_gui.c
index d58eb0360..e3f21768f 100644
--- a/player_gui.c
+++ b/player_gui.c
@@ -182,7 +182,7 @@ static void PlayerFinancesWndProc(Window *w, WindowEvent *e)
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_desc = {
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 _player_finances_small_desc = {
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_desc = {
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
};
diff --git a/settings_gui.c b/settings_gui.c
index c2e7944ae..5833635e1 100644
--- a/settings_gui.c
+++ b/settings_gui.c
@@ -269,7 +269,7 @@ static const Widget _game_options_widgets[] = {
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
};
diff --git a/widget.c b/widget.c
index 7518938f2..3d0d0a796 100644
--- a/widget.c
+++ b/widget.c
@@ -157,12 +157,8 @@ void DrawWindowWidgets(Window *w)
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 @@ void DrawWindowWidgets(Window *w)
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 @@ void DrawWindowWidgets(Window *w)
if ((str = wi->unkA) != 0) {
DrawString(r.left+2, r.top+1, str, 0);
- goto restore_dparam;
}
goto draw_default;
}
@@ -396,7 +391,7 @@ void DrawWindowWidgets(Window *w)
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 @@ void DrawWindowWidgets(Window *w)
}
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);
diff --git a/window.h b/window.h
index 25a0c6c90..987d386a6 100644
--- a/window.h
+++ b/window.h
@@ -229,7 +229,7 @@ enum {
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 */