(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.
This commit is contained in:
ludde 2005-07-15 15:09:52 +00:00
parent 2fa79c9b4d
commit a069876725
6 changed files with 14 additions and 24 deletions

View File

@ -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

View File

@ -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
};

View File

@ -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
};

View File

@ -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
};

View File

@ -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);

View File

@ -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 */