1
0
Fork 0

(svn r12976) -Codechange: use w->SetDirty() instead of SetWindowDirty(w) when it's certain that w != NULL.

release/0.7
rubidium 2008-05-06 22:08:18 +00:00
parent e6c944a6c4
commit 9bf519f26b
34 changed files with 241 additions and 246 deletions

View File

@ -205,9 +205,9 @@ static void BuildAirportPickerWndProc(Window *w, WindowEvent *e)
int text_end = DrawStationCoverageAreaText(2, 206, SCT_ALL, rad, false); int text_end = DrawStationCoverageAreaText(2, 206, SCT_ALL, rad, false);
text_end = DrawStationCoverageAreaText(2, text_end + 4, SCT_ALL, rad, true) + 4; text_end = DrawStationCoverageAreaText(2, text_end + 4, SCT_ALL, rad, true) + 4;
if (text_end != w->widget[BAW_BOTTOMPANEL].bottom) { if (text_end != w->widget[BAW_BOTTOMPANEL].bottom) {
SetWindowDirty(w); w->SetDirty();
ResizeWindowForWidget(w, BAW_BOTTOMPANEL, 0, text_end - w->widget[BAW_BOTTOMPANEL].bottom); ResizeWindowForWidget(w, BAW_BOTTOMPANEL, 0, text_end - w->widget[BAW_BOTTOMPANEL].bottom);
SetWindowDirty(w); w->SetDirty();
} }
break; break;
} }
@ -221,7 +221,7 @@ static void BuildAirportPickerWndProc(Window *w, WindowEvent *e)
_selected_airport_type = e->we.click.widget - BAW_SMALL_AIRPORT; _selected_airport_type = e->we.click.widget - BAW_SMALL_AIRPORT;
w->LowerWidget(_selected_airport_type + BAW_SMALL_AIRPORT); w->LowerWidget(_selected_airport_type + BAW_SMALL_AIRPORT);
SndPlayFx(SND_15_BEEP); SndPlayFx(SND_15_BEEP);
SetWindowDirty(w); w->SetDirty();
break; break;
case BAW_BTN_DONTHILIGHT: case BAW_BTN_DOHILIGHT: case BAW_BTN_DONTHILIGHT: case BAW_BTN_DOHILIGHT:
@ -229,7 +229,7 @@ static void BuildAirportPickerWndProc(Window *w, WindowEvent *e)
w->SetWidgetLoweredState(BAW_BTN_DONTHILIGHT, !_station_show_coverage); w->SetWidgetLoweredState(BAW_BTN_DONTHILIGHT, !_station_show_coverage);
w->SetWidgetLoweredState(BAW_BTN_DOHILIGHT, _station_show_coverage); w->SetWidgetLoweredState(BAW_BTN_DOHILIGHT, _station_show_coverage);
SndPlayFx(SND_15_BEEP); SndPlayFx(SND_15_BEEP);
SetWindowDirty(w); w->SetDirty();
break; break;
} }
} break; } break;

View File

@ -368,9 +368,9 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e)
int text_end = DrawVehiclePurchaseInfo(wi->left + 2, wi->top + 1, wi->right - wi->left - 2, WP(w, replaceveh_d).sel_engine[i]); int text_end = DrawVehiclePurchaseInfo(wi->left + 2, wi->top + 1, wi->right - wi->left - 2, WP(w, replaceveh_d).sel_engine[i]);
if (text_end > wi->bottom) { if (text_end > wi->bottom) {
SetWindowDirty(w); w->SetDirty();
ResizeWindowForWidget(w, i == 0 ? RVW_WIDGET_LEFT_DETAILS : RVW_WIDGET_RIGHT_DETAILS, 0, text_end - wi->bottom); ResizeWindowForWidget(w, i == 0 ? RVW_WIDGET_LEFT_DETAILS : RVW_WIDGET_RIGHT_DETAILS, 0, text_end - wi->bottom);
SetWindowDirty(w); w->SetDirty();
} }
} }
} }
@ -383,7 +383,7 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e)
WP(w, replaceveh_d).wagon_btnstate = !(WP(w, replaceveh_d).wagon_btnstate); WP(w, replaceveh_d).wagon_btnstate = !(WP(w, replaceveh_d).wagon_btnstate);
WP(w, replaceveh_d).update_left = true; WP(w, replaceveh_d).update_left = true;
WP(w, replaceveh_d).init_lists = true; WP(w, replaceveh_d).init_lists = true;
SetWindowDirty(w); w->SetDirty();
break; break;
case RVW_WIDGET_TRAIN_RAILTYPE_DROPDOWN: /* Railtype selection dropdown menu */ case RVW_WIDGET_TRAIN_RAILTYPE_DROPDOWN: /* Railtype selection dropdown menu */
@ -422,7 +422,7 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e)
WP(w, replaceveh_d).update_right = true; WP(w, replaceveh_d).update_right = true;
WP(w, replaceveh_d).init_lists = true; WP(w, replaceveh_d).init_lists = true;
} }
SetWindowDirty(w); w->SetDirty();
} }
break; break;
} }
@ -441,7 +441,7 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e)
WP(w, replaceveh_d).update_left = true; WP(w, replaceveh_d).update_left = true;
WP(w, replaceveh_d).update_right = true; WP(w, replaceveh_d).update_right = true;
WP(w, replaceveh_d).init_lists = true; WP(w, replaceveh_d).init_lists = true;
SetWindowDirty(w); w->SetDirty();
} break; } break;
case WE_RESIZE: case WE_RESIZE:
@ -472,7 +472,7 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e)
case WE_INVALIDATE_DATA: case WE_INVALIDATE_DATA:
if (_rebuild_left_list) WP(w, replaceveh_d).update_left = true; if (_rebuild_left_list) WP(w, replaceveh_d).update_left = true;
if (_rebuild_right_list) WP(w, replaceveh_d).update_right = true; if (_rebuild_right_list) WP(w, replaceveh_d).update_right = true;
SetWindowDirty(w); w->SetDirty();
break; break;
case WE_DESTROY: case WE_DESTROY:

View File

@ -1011,9 +1011,9 @@ static void DrawBuildVehicleWindow(Window *w)
int text_end = DrawVehiclePurchaseInfo(2, wi->top + 1, wi->right - wi->left - 2, bv->sel_engine); int text_end = DrawVehiclePurchaseInfo(2, wi->top + 1, wi->right - wi->left - 2, bv->sel_engine);
if (text_end > wi->bottom) { if (text_end > wi->bottom) {
SetWindowDirty(w); w->SetDirty();
ResizeWindowForWidget(w, BUILD_VEHICLE_WIDGET_PANEL, 0, text_end - wi->bottom); ResizeWindowForWidget(w, BUILD_VEHICLE_WIDGET_PANEL, 0, text_end - wi->bottom);
SetWindowDirty(w); w->SetDirty();
} }
} }
@ -1029,14 +1029,14 @@ static void BuildVehicleClickEvent(Window *w, WindowEvent *e)
bv->descending_sort_order ^= true; bv->descending_sort_order ^= true;
_last_sort_order[bv->vehicle_type] = bv->descending_sort_order; _last_sort_order[bv->vehicle_type] = bv->descending_sort_order;
bv->regenerate_list = true; bv->regenerate_list = true;
SetWindowDirty(w); w->SetDirty();
break; break;
case BUILD_VEHICLE_WIDGET_LIST: { case BUILD_VEHICLE_WIDGET_LIST: {
uint i = (e->we.click.pt.y - w->widget[BUILD_VEHICLE_WIDGET_LIST].top) / GetVehicleListHeight(bv->vehicle_type) + w->vscroll.pos; uint i = (e->we.click.pt.y - w->widget[BUILD_VEHICLE_WIDGET_LIST].top) / GetVehicleListHeight(bv->vehicle_type) + w->vscroll.pos;
uint num_items = EngList_Count(&bv->eng_list); uint num_items = EngList_Count(&bv->eng_list);
bv->sel_engine = (i < num_items) ? bv->eng_list[i] : INVALID_ENGINE; bv->sel_engine = (i < num_items) ? bv->eng_list[i] : INVALID_ENGINE;
SetWindowDirty(w); w->SetDirty();
break; break;
} }
@ -1108,7 +1108,7 @@ static void NewVehicleWndProc(Window *w, WindowEvent *e)
case WE_INVALIDATE_DATA: case WE_INVALIDATE_DATA:
bv->regenerate_list = true; bv->regenerate_list = true;
SetWindowDirty(w); w->SetDirty();
break; break;
case WE_DESTROY: case WE_DESTROY:
@ -1157,7 +1157,7 @@ static void NewVehicleWndProc(Window *w, WindowEvent *e)
_last_sort_criteria[bv->vehicle_type] = bv->sort_criteria; _last_sort_criteria[bv->vehicle_type] = bv->sort_criteria;
bv->regenerate_list = true; bv->regenerate_list = true;
} }
SetWindowDirty(w); w->SetDirty();
break; break;
case WE_RESIZE: case WE_RESIZE:

View File

@ -207,12 +207,12 @@ static void CheatsWndProc(Window *w, WindowEvent *e)
w->flags4 |= 5 << WF_TIMEOUT_SHL; w->flags4 |= 5 << WF_TIMEOUT_SHL;
SetWindowDirty(w); w->SetDirty();
} break; } break;
case WE_TIMEOUT: case WE_TIMEOUT:
WP(w, def_d).data_1 = 0; WP(w, def_d).data_1 = 0;
SetWindowDirty(w); w->SetDirty();
break; break;
} }
} }

View File

@ -107,8 +107,7 @@ static void IConsoleWndProc(Window *w, WindowEvent *e)
break; break;
} }
case WE_MOUSELOOP: case WE_MOUSELOOP:
if (HandleCaret(&_iconsole_cmdline)) if (HandleCaret(&_iconsole_cmdline)) w->SetDirty();
SetWindowDirty(w);
break; break;
case WE_DESTROY: case WE_DESTROY:
_iconsole_mode = ICONSOLE_CLOSED; _iconsole_mode = ICONSOLE_CLOSED;
@ -118,11 +117,11 @@ static void IConsoleWndProc(Window *w, WindowEvent *e)
switch (e->we.keypress.keycode) { switch (e->we.keypress.keycode) {
case WKC_UP: case WKC_UP:
IConsoleHistoryNavigate(+1); IConsoleHistoryNavigate(+1);
SetWindowDirty(w); w->SetDirty();
break; break;
case WKC_DOWN: case WKC_DOWN:
IConsoleHistoryNavigate(-1); IConsoleHistoryNavigate(-1);
SetWindowDirty(w); w->SetDirty();
break; break;
case WKC_SHIFT | WKC_PAGEUP: case WKC_SHIFT | WKC_PAGEUP:
if (iconsole_scroll - (w->height / ICON_LINE_HEIGHT) - 1 < 0) { if (iconsole_scroll - (w->height / ICON_LINE_HEIGHT) - 1 < 0) {
@ -130,7 +129,7 @@ static void IConsoleWndProc(Window *w, WindowEvent *e)
} else { } else {
iconsole_scroll -= (w->height / ICON_LINE_HEIGHT) - 1; iconsole_scroll -= (w->height / ICON_LINE_HEIGHT) - 1;
} }
SetWindowDirty(w); w->SetDirty();
break; break;
case WKC_SHIFT | WKC_PAGEDOWN: case WKC_SHIFT | WKC_PAGEDOWN:
if (iconsole_scroll + (w->height / ICON_LINE_HEIGHT) - 1 > ICON_BUFFER) { if (iconsole_scroll + (w->height / ICON_LINE_HEIGHT) - 1 > ICON_BUFFER) {
@ -138,7 +137,7 @@ static void IConsoleWndProc(Window *w, WindowEvent *e)
} else { } else {
iconsole_scroll += (w->height / ICON_LINE_HEIGHT) - 1; iconsole_scroll += (w->height / ICON_LINE_HEIGHT) - 1;
} }
SetWindowDirty(w); w->SetDirty();
break; break;
case WKC_SHIFT | WKC_UP: case WKC_SHIFT | WKC_UP:
if (iconsole_scroll <= 0) { if (iconsole_scroll <= 0) {
@ -146,7 +145,7 @@ static void IConsoleWndProc(Window *w, WindowEvent *e)
} else { } else {
--iconsole_scroll; --iconsole_scroll;
} }
SetWindowDirty(w); w->SetDirty();
break; break;
case WKC_SHIFT | WKC_DOWN: case WKC_SHIFT | WKC_DOWN:
if (iconsole_scroll >= ICON_BUFFER) { if (iconsole_scroll >= ICON_BUFFER) {
@ -154,7 +153,7 @@ static void IConsoleWndProc(Window *w, WindowEvent *e)
} else { } else {
++iconsole_scroll; ++iconsole_scroll;
} }
SetWindowDirty(w); w->SetDirty();
break; break;
case WKC_BACKQUOTE: case WKC_BACKQUOTE:
IConsoleSwitch(); IConsoleSwitch();
@ -174,7 +173,7 @@ static void IConsoleWndProc(Window *w, WindowEvent *e)
case (WKC_CTRL | 'V'): case (WKC_CTRL | 'V'):
if (InsertTextBufferClipboard(&_iconsole_cmdline)) { if (InsertTextBufferClipboard(&_iconsole_cmdline)) {
IConsoleResetHistoryPos(); IConsoleResetHistoryPos();
SetWindowDirty(w); w->SetDirty();
} }
break; break;
case (WKC_CTRL | 'L'): case (WKC_CTRL | 'L'):
@ -182,18 +181,18 @@ static void IConsoleWndProc(Window *w, WindowEvent *e)
break; break;
case (WKC_CTRL | 'U'): case (WKC_CTRL | 'U'):
DeleteTextBufferAll(&_iconsole_cmdline); DeleteTextBufferAll(&_iconsole_cmdline);
SetWindowDirty(w); w->SetDirty();
break; break;
case WKC_BACKSPACE: case WKC_DELETE: case WKC_BACKSPACE: case WKC_DELETE:
if (DeleteTextBufferChar(&_iconsole_cmdline, e->we.keypress.keycode)) { if (DeleteTextBufferChar(&_iconsole_cmdline, e->we.keypress.keycode)) {
IConsoleResetHistoryPos(); IConsoleResetHistoryPos();
SetWindowDirty(w); w->SetDirty();
} }
break; break;
case WKC_LEFT: case WKC_RIGHT: case WKC_END: case WKC_HOME: case WKC_LEFT: case WKC_RIGHT: case WKC_END: case WKC_HOME:
if (MoveTextBufferPos(&_iconsole_cmdline, e->we.keypress.keycode)) { if (MoveTextBufferPos(&_iconsole_cmdline, e->we.keypress.keycode)) {
IConsoleResetHistoryPos(); IConsoleResetHistoryPos();
SetWindowDirty(w); w->SetDirty();
} }
break; break;
default: default:
@ -201,7 +200,7 @@ static void IConsoleWndProc(Window *w, WindowEvent *e)
iconsole_scroll = ICON_BUFFER; iconsole_scroll = ICON_BUFFER;
InsertTextBufferChar(&_iconsole_cmdline, e->we.keypress.key); InsertTextBufferChar(&_iconsole_cmdline, e->we.keypress.key);
IConsoleResetHistoryPos(); IConsoleResetHistoryPos();
SetWindowDirty(w); w->SetDirty();
} else { } else {
e->we.keypress.cont = true; e->we.keypress.cont = true;
} }

View File

@ -440,7 +440,7 @@ static void DepotClick(Window *w, int x, int y)
int image = v->GetImage(DIR_W); int image = v->GetImage(DIR_W);
WP(w, depot_d).sel = v->index; WP(w, depot_d).sel = v->index;
SetWindowDirty(w); w->SetDirty();
SetObjectToPlaceWnd(image, GetVehiclePalette(v), VHM_DRAG, w); SetObjectToPlaceWnd(image, GetVehiclePalette(v), VHM_DRAG, w);
_cursor.vehchain = _ctrl_pressed; _cursor.vehchain = _ctrl_pressed;
} }
@ -903,7 +903,7 @@ static void DepotWndProc(Window *w, WindowEvent *e)
VehicleID sel = WP(w, depot_d).sel; VehicleID sel = WP(w, depot_d).sel;
WP(w, depot_d).sel = INVALID_VEHICLE; WP(w, depot_d).sel = INVALID_VEHICLE;
SetWindowDirty(w); w->SetDirty();
if (WP(w, depot_d).type == VEH_TRAIN) { if (WP(w, depot_d).type == VEH_TRAIN) {
GetDepotVehiclePtData gdvp; GetDepotVehiclePtData gdvp;
@ -940,7 +940,7 @@ static void DepotWndProc(Window *w, WindowEvent *e)
v = GetVehicle(WP(w, depot_d).sel); v = GetVehicle(WP(w, depot_d).sel);
WP(w, depot_d).sel = INVALID_VEHICLE; WP(w, depot_d).sel = INVALID_VEHICLE;
SetWindowDirty(w); w->SetDirty();
sell_cmd = (v->type == VEH_TRAIN && (e->we.click.widget == DEPOT_WIDGET_SELL_CHAIN || _ctrl_pressed)) ? 1 : 0; sell_cmd = (v->type == VEH_TRAIN && (e->we.click.widget == DEPOT_WIDGET_SELL_CHAIN || _ctrl_pressed)) ? 1 : 0;
@ -964,7 +964,7 @@ static void DepotWndProc(Window *w, WindowEvent *e)
break; break;
default: default:
WP(w, depot_d).sel = INVALID_VEHICLE; WP(w, depot_d).sel = INVALID_VEHICLE;
SetWindowDirty(w); w->SetDirty();
} }
_cursor.vehchain = false; _cursor.vehchain = false;
break; break;

View File

@ -257,9 +257,9 @@ static void BuildDockStationWndProc(Window *w, WindowEvent *e)
int text_end = DrawStationCoverageAreaText(4, 50, SCT_ALL, rad, false); int text_end = DrawStationCoverageAreaText(4, 50, SCT_ALL, rad, false);
text_end = DrawStationCoverageAreaText(4, text_end + 4, SCT_ALL, rad, true) + 4; text_end = DrawStationCoverageAreaText(4, text_end + 4, SCT_ALL, rad, true) + 4;
if (text_end != w->widget[2].bottom) { if (text_end != w->widget[2].bottom) {
SetWindowDirty(w); w->SetDirty();
ResizeWindowForWidget(w, 2, 0, text_end - w->widget[2].bottom); ResizeWindowForWidget(w, 2, 0, text_end - w->widget[2].bottom);
SetWindowDirty(w); w->SetDirty();
} }
break; break;
@ -273,7 +273,7 @@ static void BuildDockStationWndProc(Window *w, WindowEvent *e)
_station_show_coverage = (e->we.click.widget != 3); _station_show_coverage = (e->we.click.widget != 3);
w->LowerWidget(_station_show_coverage + 3); w->LowerWidget(_station_show_coverage + 3);
SndPlayFx(SND_15_BEEP); SndPlayFx(SND_15_BEEP);
SetWindowDirty(w); w->SetDirty();
break; break;
} }
break; break;
@ -348,7 +348,7 @@ static void BuildDocksDepotWndProc(Window *w, WindowEvent *e)
w->LowerWidget(_ship_depot_direction + 3); w->LowerWidget(_ship_depot_direction + 3);
SndPlayFx(SND_15_BEEP); SndPlayFx(SND_15_BEEP);
UpdateDocksDirection(); UpdateDocksDirection();
SetWindowDirty(w); w->SetDirty();
break; break;
} }
} break; } break;

View File

@ -372,7 +372,7 @@ static void GenerateLandscapeWndProc(Window *w, WindowEvent *e)
_patches_newgame.generation_seed = InteractiveRandom(); _patches_newgame.generation_seed = InteractiveRandom();
snprintf(_genseed_buffer, lengthof(_genseed_buffer), "%u", _patches_newgame.generation_seed); snprintf(_genseed_buffer, lengthof(_genseed_buffer), "%u", _patches_newgame.generation_seed);
UpdateTextBufferSize(&_genseed_query.text); UpdateTextBufferSize(&_genseed_query.text);
SetWindowDirty(w); w->SetDirty();
break; break;
case GLAND_RANDOM_EDITBOX: // edit box for random seed case GLAND_RANDOM_EDITBOX: // edit box for random seed
@ -408,7 +408,7 @@ static void GenerateLandscapeWndProc(Window *w, WindowEvent *e)
/* Don't allow too fast scrolling */ /* Don't allow too fast scrolling */
if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) { if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) {
w->HandleButtonClick(e->we.click.widget); w->HandleButtonClick(e->we.click.widget);
SetWindowDirty(w); w->SetDirty();
_patches_newgame.starting_year = Clamp(_patches_newgame.starting_year + e->we.click.widget - GLAND_START_DATE_TEXT, MIN_YEAR, MAX_YEAR); _patches_newgame.starting_year = Clamp(_patches_newgame.starting_year + e->we.click.widget - GLAND_START_DATE_TEXT, MIN_YEAR, MAX_YEAR);
} }
@ -426,7 +426,7 @@ static void GenerateLandscapeWndProc(Window *w, WindowEvent *e)
/* Don't allow too fast scrolling */ /* Don't allow too fast scrolling */
if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) { if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) {
w->HandleButtonClick(e->we.click.widget); w->HandleButtonClick(e->we.click.widget);
SetWindowDirty(w); w->SetDirty();
_patches_newgame.snow_line_height = Clamp(_patches_newgame.snow_line_height + e->we.click.widget - GLAND_SNOW_LEVEL_TEXT, 2, MAX_SNOWLINE_HEIGHT); _patches_newgame.snow_line_height = Clamp(_patches_newgame.snow_line_height + e->we.click.widget - GLAND_SNOW_LEVEL_TEXT, 2, MAX_SNOWLINE_HEIGHT);
} }
@ -520,7 +520,7 @@ static void GenerateLandscapeWndProc(Window *w, WindowEvent *e)
DoCommandP(0, 13, _opt_newgame.diff.quantity_sea_lakes, NULL, CMD_CHANGE_DIFFICULTY_LEVEL); DoCommandP(0, 13, _opt_newgame.diff.quantity_sea_lakes, NULL, CMD_CHANGE_DIFFICULTY_LEVEL);
break; break;
} }
SetWindowDirty(w); w->SetDirty();
break; break;
case WE_ON_EDIT_TEXT: case WE_ON_EDIT_TEXT:
@ -539,7 +539,7 @@ static void GenerateLandscapeWndProc(Window *w, WindowEvent *e)
break; break;
} }
SetWindowDirty(w); w->SetDirty();
} }
break; break;
} }
@ -697,7 +697,7 @@ static void CreateScenarioWndProc(Window *w, WindowEvent *e)
/* Don't allow too fast scrolling */ /* Don't allow too fast scrolling */
if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) { if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) {
w->HandleButtonClick(e->we.click.widget); w->HandleButtonClick(e->we.click.widget);
SetWindowDirty(w); w->SetDirty();
_patches_newgame.starting_year = Clamp(_patches_newgame.starting_year + e->we.click.widget - CSCEN_START_DATE_TEXT, MIN_YEAR, MAX_YEAR); _patches_newgame.starting_year = Clamp(_patches_newgame.starting_year + e->we.click.widget - CSCEN_START_DATE_TEXT, MIN_YEAR, MAX_YEAR);
} }
@ -715,7 +715,7 @@ static void CreateScenarioWndProc(Window *w, WindowEvent *e)
/* Don't allow too fast scrolling */ /* Don't allow too fast scrolling */
if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) { if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) {
w->HandleButtonClick(e->we.click.widget); w->HandleButtonClick(e->we.click.widget);
SetWindowDirty(w); w->SetDirty();
_patches_newgame.se_flat_world_height = Clamp(_patches_newgame.se_flat_world_height + e->we.click.widget - CSCEN_FLAT_LAND_HEIGHT_TEXT, 0, MAX_TILE_HEIGHT); _patches_newgame.se_flat_world_height = Clamp(_patches_newgame.se_flat_world_height + e->we.click.widget - CSCEN_FLAT_LAND_HEIGHT_TEXT, 0, MAX_TILE_HEIGHT);
} }
@ -735,7 +735,7 @@ static void CreateScenarioWndProc(Window *w, WindowEvent *e)
case CSCEN_MAPSIZE_X_PULLDOWN: _patches_newgame.map_x = e->we.dropdown.index; break; case CSCEN_MAPSIZE_X_PULLDOWN: _patches_newgame.map_x = e->we.dropdown.index; break;
case CSCEN_MAPSIZE_Y_PULLDOWN: _patches_newgame.map_y = e->we.dropdown.index; break; case CSCEN_MAPSIZE_Y_PULLDOWN: _patches_newgame.map_y = e->we.dropdown.index; break;
} }
SetWindowDirty(w); w->SetDirty();
break; break;
case WE_ON_EDIT_TEXT: case WE_ON_EDIT_TEXT:
@ -754,7 +754,7 @@ static void CreateScenarioWndProc(Window *w, WindowEvent *e)
break; break;
} }
SetWindowDirty(w); w->SetDirty();
} }
break; break;
} }
@ -865,7 +865,7 @@ static void ShowTerrainProgressProc(Window* w, WindowEvent* e)
SetDParam(1, _tp.total); SetDParam(1, _tp.total);
DrawStringCentered(90, 58, STR_GENERATION_PROGRESS, TC_FROMSTRING); DrawStringCentered(90, 58, STR_GENERATION_PROGRESS, TC_FROMSTRING);
SetWindowDirty(w); w->SetDirty();
break; break;
} }
} }

View File

@ -304,7 +304,7 @@ static void GraphLegendWndProc(Window *w, WindowEvent *e)
ToggleBit(_legend_excluded_players, e->we.click.widget - 3); ToggleBit(_legend_excluded_players, e->we.click.widget - 3);
w->ToggleWidgetLoweredState(e->we.click.widget); w->ToggleWidgetLoweredState(e->we.click.widget);
SetWindowDirty(w); w->SetDirty();
InvalidateWindow(WC_INCOME_GRAPH, 0); InvalidateWindow(WC_INCOME_GRAPH, 0);
InvalidateWindow(WC_OPERATING_PROFIT, 0); InvalidateWindow(WC_OPERATING_PROFIT, 0);
InvalidateWindow(WC_DELIVERED_CARGO, 0); InvalidateWindow(WC_DELIVERED_CARGO, 0);
@ -783,7 +783,7 @@ static void CargoPaymentRatesWndProc(Window *w, WindowEvent *e)
if (e->we.click.widget >= 3) { if (e->we.click.widget >= 3) {
ToggleBit(_legend_excluded_cargo, e->we.click.widget - 3); ToggleBit(_legend_excluded_cargo, e->we.click.widget - 3);
w->ToggleWidgetLoweredState(e->we.click.widget); w->ToggleWidgetLoweredState(e->we.click.widget);
SetWindowDirty(w); w->SetDirty();
} }
break; break;
} }
@ -840,7 +840,7 @@ void ShowCargoPaymentRates()
if (!HasBit(_legend_excluded_cargo, i)) w->LowerWidget(i + 3); if (!HasBit(_legend_excluded_cargo, i)) w->LowerWidget(i + 3);
} }
SetWindowDirty(w); w->SetDirty();
} }
/************************/ /************************/
@ -955,7 +955,7 @@ static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e)
/* Raise and disable the widget for the previous selection. */ /* Raise and disable the widget for the previous selection. */
w->RaiseWidget(_performance_rating_detail_player + 13); w->RaiseWidget(_performance_rating_detail_player + 13);
w->DisableWidget(_performance_rating_detail_player + 13); w->DisableWidget(_performance_rating_detail_player + 13);
SetWindowDirty(w); w->SetDirty();
_performance_rating_detail_player = INVALID_PLAYER; _performance_rating_detail_player = INVALID_PLAYER;
} }
@ -964,7 +964,7 @@ static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e)
if (GetPlayer(i)->is_active) { if (GetPlayer(i)->is_active) {
/* Lower the widget corresponding to this player. */ /* Lower the widget corresponding to this player. */
w->LowerWidget(i + 13); w->LowerWidget(i + 13);
SetWindowDirty(w); w->SetDirty();
_performance_rating_detail_player = i; _performance_rating_detail_player = i;
break; break;
@ -984,7 +984,7 @@ static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e)
w->DisableWidget(i + 13); w->DisableWidget(i + 13);
/* We need a repaint */ /* We need a repaint */
SetWindowDirty(w); w->SetDirty();
} }
continue; continue;
} }
@ -994,7 +994,7 @@ static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e)
/* New player! Yippie :p */ /* New player! Yippie :p */
w->EnableWidget(i + 13); w->EnableWidget(i + 13);
/* We need a repaint */ /* We need a repaint */
SetWindowDirty(w); w->SetDirty();
} }
x = (i == _performance_rating_detail_player) ? 1 : 0; x = (i == _performance_rating_detail_player) ? 1 : 0;
@ -1077,7 +1077,7 @@ static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e)
w->RaiseWidget(_performance_rating_detail_player + 13); w->RaiseWidget(_performance_rating_detail_player + 13);
_performance_rating_detail_player = (PlayerID)(e->we.click.widget - 13); _performance_rating_detail_player = (PlayerID)(e->we.click.widget - 13);
w->LowerWidget(_performance_rating_detail_player + 13); w->LowerWidget(_performance_rating_detail_player + 13);
SetWindowDirty(w); w->SetDirty();
} }
} }
break; break;
@ -1099,7 +1099,7 @@ static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e)
w->custom[1] = 5; w->custom[1] = 5;
if (_performance_rating_detail_player != INVALID_PLAYER) w->LowerWidget(_performance_rating_detail_player + 13); if (_performance_rating_detail_player != INVALID_PLAYER) w->LowerWidget(_performance_rating_detail_player + 13);
SetWindowDirty(w); w->SetDirty();
break; break;
} }
@ -1118,7 +1118,7 @@ static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e)
/* Skip if player is not active */ /* Skip if player is not active */
if (p2->is_active) UpdateCompanyRatingAndValue(p2, false); if (p2->is_active) UpdateCompanyRatingAndValue(p2, false);
} }
SetWindowDirty(w); w->SetDirty();
} }
} }

View File

@ -317,7 +317,7 @@ static void GroupWndProc(Window *w, WindowEvent *e)
gv->group_sel = ALL_GROUP; gv->group_sel = ALL_GROUP;
HideDropDownMenu(w); HideDropDownMenu(w);
} }
SetWindowDirty(w); w->SetDirty();
break; break;
case WE_CREATE: case WE_CREATE:
@ -519,7 +519,7 @@ static void GroupWndProc(Window *w, WindowEvent *e)
gv->l.flags |= VL_RESORT; gv->l.flags |= VL_RESORT;
gv->_sorting->order = !!(gv->l.flags & VL_DESC); gv->_sorting->order = !!(gv->l.flags & VL_DESC);
SetWindowDirty(w); w->SetDirty();
break; break;
case GRP_WIDGET_SORT_BY_DROPDOWN: // Select sorting criteria dropdown menu case GRP_WIDGET_SORT_BY_DROPDOWN: // Select sorting criteria dropdown menu
@ -530,7 +530,7 @@ static void GroupWndProc(Window *w, WindowEvent *e)
if (!IsAllGroupID(gv->group_sel)) { if (!IsAllGroupID(gv->group_sel)) {
gv->group_sel = ALL_GROUP; gv->group_sel = ALL_GROUP;
gv->l.flags |= VL_REBUILD; gv->l.flags |= VL_REBUILD;
SetWindowDirty(w); w->SetDirty();
} }
break; break;
@ -538,7 +538,7 @@ static void GroupWndProc(Window *w, WindowEvent *e)
if (!IsDefaultGroupID(gv->group_sel)) { if (!IsDefaultGroupID(gv->group_sel)) {
gv->group_sel = DEFAULT_GROUP; gv->group_sel = DEFAULT_GROUP;
gv->l.flags |= VL_REBUILD; gv->l.flags |= VL_REBUILD;
SetWindowDirty(w); w->SetDirty();
} }
break; break;
@ -554,7 +554,7 @@ static void GroupWndProc(Window *w, WindowEvent *e)
gv->group_sel = gl->sort_list[id_g]->index;; gv->group_sel = gl->sort_list[id_g]->index;;
gv->l.flags |= VL_REBUILD; gv->l.flags |= VL_REBUILD;
SetWindowDirty(w); w->SetDirty();
break; break;
} }
@ -577,7 +577,7 @@ static void GroupWndProc(Window *w, WindowEvent *e)
_cursor.vehchain = true; _cursor.vehchain = true;
} }
SetWindowDirty(w); w->SetDirty();
break; break;
} }
@ -640,7 +640,7 @@ static void GroupWndProc(Window *w, WindowEvent *e)
gv->vehicle_sel = INVALID_VEHICLE; gv->vehicle_sel = INVALID_VEHICLE;
SetWindowDirty(w); w->SetDirty();
break; break;
@ -650,7 +650,7 @@ static void GroupWndProc(Window *w, WindowEvent *e)
gv->vehicle_sel = INVALID_VEHICLE; gv->vehicle_sel = INVALID_VEHICLE;
SetWindowDirty(w); w->SetDirty();
if (id_g >= w->vscroll.cap) return; if (id_g >= w->vscroll.cap) return;
@ -670,7 +670,7 @@ static void GroupWndProc(Window *w, WindowEvent *e)
gv->vehicle_sel = INVALID_VEHICLE; gv->vehicle_sel = INVALID_VEHICLE;
SetWindowDirty(w); w->SetDirty();
if (id_v >= w->vscroll2.cap) return; // click out of bounds if (id_v >= w->vscroll2.cap) return; // click out of bounds
@ -752,7 +752,7 @@ static void GroupWndProc(Window *w, WindowEvent *e)
default: NOT_REACHED(); default: NOT_REACHED();
} }
SetWindowDirty(w); w->SetDirty();
break; break;
@ -767,12 +767,12 @@ static void GroupWndProc(Window *w, WindowEvent *e)
if (--gv->l.resort_timer == 0) { if (--gv->l.resort_timer == 0) {
gv->l.resort_timer = DAY_TICKS * PERIODIC_RESORT_DAYS; gv->l.resort_timer = DAY_TICKS * PERIODIC_RESORT_DAYS;
gv->l.flags |= VL_RESORT; gv->l.flags |= VL_RESORT;
SetWindowDirty(w); w->SetDirty();
} }
if (--gl->l.resort_timer == 0) { if (--gl->l.resort_timer == 0) {
gl->l.resort_timer = DAY_TICKS * PERIODIC_RESORT_DAYS; gl->l.resort_timer = DAY_TICKS * PERIODIC_RESORT_DAYS;
gl->l.flags |= VL_RESORT; gl->l.flags |= VL_RESORT;
SetWindowDirty(w); w->SetDirty();
} }
break; break;

View File

@ -269,7 +269,7 @@ static void BuildDynamicIndustryWndProc(Window *w, WindowEvent *e)
WP(w, fnd_d).select = _fund_gui.index[WP(w, fnd_d).index]; WP(w, fnd_d).select = _fund_gui.index[WP(w, fnd_d).index];
indsp = (WP(w, fnd_d).select == INVALID_INDUSTRYTYPE) ? NULL : GetIndustrySpec(WP(w, fnd_d).select); indsp = (WP(w, fnd_d).select == INVALID_INDUSTRYTYPE) ? NULL : GetIndustrySpec(WP(w, fnd_d).select);
SetWindowDirty(w); w->SetDirty();
if ((_game_mode != GM_EDITOR && _patches.raw_industry_construction == 2 && indsp != NULL && indsp->IsRawIndustry()) || if ((_game_mode != GM_EDITOR && _patches.raw_industry_construction == 2 && indsp != NULL && indsp->IsRawIndustry()) ||
WP(w, fnd_d).select == INVALID_INDUSTRYTYPE) { WP(w, fnd_d).select == INVALID_INDUSTRYTYPE) {
@ -357,7 +357,7 @@ static void BuildDynamicIndustryWndProc(Window *w, WindowEvent *e)
/* Only if result does match the previous state would it require a redraw. */ /* Only if result does match the previous state would it require a redraw. */
if (call_back_result != _fund_gui.enabled[WP(w, fnd_d).index]) { if (call_back_result != _fund_gui.enabled[WP(w, fnd_d).index]) {
_fund_gui.enabled[WP(w, fnd_d).index] = call_back_result; _fund_gui.enabled[WP(w, fnd_d).index] = call_back_result;
SetWindowDirty(w); w->SetDirty();
} }
} }
} }
@ -524,9 +524,9 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e)
} }
if (y > w->widget[IVW_INFO].bottom) { if (y > w->widget[IVW_INFO].bottom) {
SetWindowDirty(w); w->SetDirty();
ResizeWindowForWidget(w, IVW_INFO, 0, y - w->widget[IVW_INFO].top); ResizeWindowForWidget(w, IVW_INFO, 0, y - w->widget[IVW_INFO].top);
SetWindowDirty(w); w->SetDirty();
return; return;
} }
@ -560,7 +560,7 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e)
} }
UpdateIndustryProduction(i); UpdateIndustryProduction(i);
SetWindowDirty(w); w->SetDirty();
w->flags4 |= 5 << WF_TIMEOUT_SHL; w->flags4 |= 5 << WF_TIMEOUT_SHL;
WP(w, indview_d).clicked_line = line + 1; WP(w, indview_d).clicked_line = line + 1;
WP(w, indview_d).clicked_button = (x < 15 ? 1 : 2); WP(w, indview_d).clicked_button = (x < 15 ? 1 : 2);
@ -587,7 +587,7 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e)
case WE_TIMEOUT: case WE_TIMEOUT:
WP(w, indview_d).clicked_line = 0; WP(w, indview_d).clicked_line = 0;
WP(w, indview_d).clicked_button = 0; WP(w, indview_d).clicked_button = 0;
SetWindowDirty(w); w->SetDirty();
break; break;
case WE_ON_EDIT_TEXT: case WE_ON_EDIT_TEXT:
@ -597,7 +597,7 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e)
i->production_rate[line] = ClampU(atoi(e->we.edittext.str), 0, 255); i->production_rate[line] = ClampU(atoi(e->we.edittext.str), 0, 255);
UpdateIndustryProduction(i); UpdateIndustryProduction(i);
SetWindowDirty(w); w->SetDirty();
} }
} }
} }
@ -842,25 +842,25 @@ static void IndustryDirectoryWndProc(Window *w, WindowEvent *e)
case IDW_SORTBYNAME: { case IDW_SORTBYNAME: {
_industry_sort_order = _industry_sort_order == 0 ? 1 : 0; _industry_sort_order = _industry_sort_order == 0 ? 1 : 0;
_industry_sort_dirty = true; _industry_sort_dirty = true;
SetWindowDirty(w); w->SetDirty();
} break; } break;
case IDW_SORTBYTYPE: { case IDW_SORTBYTYPE: {
_industry_sort_order = _industry_sort_order == 2 ? 3 : 2; _industry_sort_order = _industry_sort_order == 2 ? 3 : 2;
_industry_sort_dirty = true; _industry_sort_dirty = true;
SetWindowDirty(w); w->SetDirty();
} break; } break;
case IDW_SORTBYPROD: { case IDW_SORTBYPROD: {
_industry_sort_order = _industry_sort_order == 4 ? 5 : 4; _industry_sort_order = _industry_sort_order == 4 ? 5 : 4;
_industry_sort_dirty = true; _industry_sort_dirty = true;
SetWindowDirty(w); w->SetDirty();
} break; } break;
case IDW_SORTBYTRANSPORT: { case IDW_SORTBYTRANSPORT: {
_industry_sort_order = _industry_sort_order == 6 ? 7 : 6; _industry_sort_order = _industry_sort_order == 6 ? 7 : 6;
_industry_sort_dirty = true; _industry_sort_dirty = true;
SetWindowDirty(w); w->SetDirty();
} break; } break;
case IDW_INDUSRTY_LIST: { case IDW_INDUSRTY_LIST: {
@ -881,7 +881,7 @@ static void IndustryDirectoryWndProc(Window *w, WindowEvent *e)
break; break;
case WE_4: case WE_4:
SetWindowDirty(w); w->SetDirty();
break; break;
case WE_RESIZE: case WE_RESIZE:
@ -907,6 +907,6 @@ void ShowIndustryDirectory()
w->vscroll.cap = 16; w->vscroll.cap = 16;
w->resize.height = w->height - 6 * 10; // minimum 10 items w->resize.height = w->height - 6 * 10; // minimum 10 items
w->resize.step_height = 10; w->resize.step_height = 10;
SetWindowDirty(w); w->SetDirty();
} }
} }

View File

@ -103,7 +103,7 @@ bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, ViewportHighl
if (w->IsWidgetDisabled(widget)) return false; if (w->IsWidgetDisabled(widget)) return false;
SndPlayFx(SND_15_BEEP); SndPlayFx(SND_15_BEEP);
SetWindowDirty(w); w->SetDirty();
if (w->IsWidgetLowered(widget)) { if (w->IsWidgetLowered(widget)) {
ResetObjectToPlace(); ResetObjectToPlace();
@ -187,7 +187,7 @@ bool DoZoomInOutWindow(int how, Window *w)
vp->virtual_left = WP(w, vp_d).scrollpos_x; vp->virtual_left = WP(w, vp_d).scrollpos_x;
vp->virtual_top = WP(w, vp_d).scrollpos_y; vp->virtual_top = WP(w, vp_d).scrollpos_y;
} }
SetWindowDirty(w); w->SetDirty();
/* Update the windows that have zoom-buttons to perhaps disable their buttons */ /* Update the windows that have zoom-buttons to perhaps disable their buttons */
SendWindowMessageClass(w->window_class, how, w->window_number, 0); SendWindowMessageClass(w->window_class, how, w->window_number, 0);
return true; return true;

View File

@ -291,7 +291,7 @@ static void AboutWindowProc(Window *w, WindowEvent *e)
if (--WP(w, scroller_d).counter == 0) { if (--WP(w, scroller_d).counter == 0) {
WP(w, scroller_d).counter = 5; WP(w, scroller_d).counter = 5;
WP(w, scroller_d).height--; WP(w, scroller_d).height--;
SetWindowDirty(w); w->SetDirty();
} }
break; break;
} }
@ -1547,19 +1547,19 @@ static void SaveLoadDlgWndProc(Window *w, WindowEvent *e)
_savegame_sort_order = (_savegame_sort_order == SORT_BY_NAME) ? _savegame_sort_order = (_savegame_sort_order == SORT_BY_NAME) ?
SORT_BY_NAME | SORT_DESCENDING : SORT_BY_NAME; SORT_BY_NAME | SORT_DESCENDING : SORT_BY_NAME;
_savegame_sort_dirty = true; _savegame_sort_dirty = true;
SetWindowDirty(w); w->SetDirty();
break; break;
case 3: // Sort save names by date case 3: // Sort save names by date
_savegame_sort_order = (_savegame_sort_order == SORT_BY_DATE) ? _savegame_sort_order = (_savegame_sort_order == SORT_BY_DATE) ?
SORT_BY_DATE | SORT_DESCENDING : SORT_BY_DATE; SORT_BY_DATE | SORT_DESCENDING : SORT_BY_DATE;
_savegame_sort_dirty = true; _savegame_sort_dirty = true;
SetWindowDirty(w); w->SetDirty();
break; break;
case 6: // OpenTTD 'button', jumps to OpenTTD directory case 6: // OpenTTD 'button', jumps to OpenTTD directory
FiosBrowseTo(&o_dir); FiosBrowseTo(&o_dir);
SetWindowDirty(w); w->SetDirty();
BuildFileList(); BuildFileList();
break; break;
@ -1597,7 +1597,7 @@ static void SaveLoadDlgWndProc(Window *w, WindowEvent *e)
} }
} else { } else {
/* Changed directory, need repaint. */ /* Changed directory, need repaint. */
SetWindowDirty(w); w->SetDirty();
BuildFileList(); BuildFileList();
} }
break; break;
@ -1645,7 +1645,7 @@ static void SaveLoadDlgWndProc(Window *w, WindowEvent *e)
} }
UpdateTextBufferSize(&WP(w, querystr_d).text); UpdateTextBufferSize(&WP(w, querystr_d).text);
SetWindowDirty(w); w->SetDirty();
} else if (w->IsWidgetLowered(12)) { // Save button clicked } else if (w->IsWidgetLowered(12)) { // Save button clicked
_switch_mode = SM_SAVE; _switch_mode = SM_SAVE;
FiosMakeSavegameName(_file_to_saveload.name, WP(w, querystr_d).text.buf, sizeof(_file_to_saveload.name)); FiosMakeSavegameName(_file_to_saveload.name, WP(w, querystr_d).text.buf, sizeof(_file_to_saveload.name));

View File

@ -256,7 +256,7 @@ static void MusicTrackSelectionWndProc(Window *w, WindowEvent *e)
if (p[i] == 0) { if (p[i] == 0) {
p[i] = y + 1; p[i] = y + 1;
p[i + 1] = 0; p[i + 1] = 0;
SetWindowDirty(w); w->SetDirty();
SelectSongToPlay(); SelectSongToPlay();
break; break;
} }
@ -276,13 +276,13 @@ static void MusicTrackSelectionWndProc(Window *w, WindowEvent *e)
p[i] = p[i + 1]; p[i] = p[i + 1];
} }
SetWindowDirty(w); w->SetDirty();
SelectSongToPlay(); SelectSongToPlay();
} break; } break;
case 11: // clear case 11: // clear
_playlists[msf.playlist][0] = 0; _playlists[msf.playlist][0] = 0;
SetWindowDirty(w); w->SetDirty();
StopMusic(); StopMusic();
SelectSongToPlay(); SelectSongToPlay();
break; break;
@ -295,7 +295,7 @@ static void MusicTrackSelectionWndProc(Window *w, WindowEvent *e)
case 5: case 6: case 7: case 8: case 9: case 10: /* set playlist */ case 5: case 6: case 7: case 8: case 9: case 10: /* set playlist */
msf.playlist = e->we.click.widget - 5; msf.playlist = e->we.click.widget - 5;
SetWindowDirty(w); w->SetDirty();
InvalidateWindow(WC_MUSIC_WINDOW, 0); InvalidateWindow(WC_MUSIC_WINDOW, 0);
StopMusic(); StopMusic();
SelectSongToPlay(); SelectSongToPlay();
@ -440,7 +440,7 @@ static void MusicWindowWndProc(Window *w, WindowEvent *e)
*vol = new_vol; *vol = new_vol;
if (vol == &msf.music_vol) if (vol == &msf.music_vol)
MusicVolumeChanged(new_vol); MusicVolumeChanged(new_vol);
SetWindowDirty(w); w->SetDirty();
} }
_left_button_clicked = false; _left_button_clicked = false;
@ -455,7 +455,7 @@ static void MusicWindowWndProc(Window *w, WindowEvent *e)
break; break;
case 12: case 13: case 14: case 15: case 16: case 17: // playlist case 12: case 13: case 14: case 15: case 16: case 17: // playlist
msf.playlist = e->we.click.widget - 12; msf.playlist = e->we.click.widget - 12;
SetWindowDirty(w); w->SetDirty();
InvalidateWindow(WC_MUSIC_TRACK_SELECTION, 0); InvalidateWindow(WC_MUSIC_TRACK_SELECTION, 0);
StopMusic(); StopMusic();
SelectSongToPlay(); SelectSongToPlay();

View File

@ -182,7 +182,7 @@ static void NewGRFAddDlgWndProc(Window *w, WindowEvent *e)
for (c = _all_grfs; c != NULL && i > 0; c = c->next, i--) {} for (c = _all_grfs; c != NULL && i > 0; c = c->next, i--) {}
WP(w, newgrf_add_d).sel = c; WP(w, newgrf_add_d).sel = c;
SetWindowDirty(w); w->SetDirty();
break; break;
} }
@ -218,7 +218,7 @@ static void NewGRFAddDlgWndProc(Window *w, WindowEvent *e)
case ANGRFW_RESCAN: // Rescan list case ANGRFW_RESCAN: // Rescan list
WP(w, newgrf_add_d).sel = NULL; WP(w, newgrf_add_d).sel = NULL;
ScanNewGRFFiles(); ScanNewGRFFiles();
SetWindowDirty(w); w->SetDirty();
break; break;
} }
break; break;
@ -333,7 +333,7 @@ static void NewGRFConfirmationCallback(Window *w, bool confirmed)
for (c = *nd->list; c != NULL && i > 0; c = c->next, i--) {} for (c = *nd->list; c != NULL && i > 0; c = c->next, i--) {}
nd->sel = c; nd->sel = c;
SetWindowDirty(w); w->SetDirty();
} }
} }
@ -435,7 +435,7 @@ static void NewGRFWndProc(Window *w, WindowEvent *e)
WP(w, newgrf_d).sel = newsel; WP(w, newgrf_d).sel = newsel;
SetupNewGRFWindow(w); SetupNewGRFWindow(w);
SetWindowDirty(w); w->SetDirty();
break; break;
} }
@ -451,7 +451,7 @@ static void NewGRFWndProc(Window *w, WindowEvent *e)
break; break;
} }
} }
SetWindowDirty(w); w->SetDirty();
break; break;
} }
@ -467,7 +467,7 @@ static void NewGRFWndProc(Window *w, WindowEvent *e)
break; break;
} }
} }
SetWindowDirty(w); w->SetDirty();
break; break;
} }
@ -478,7 +478,7 @@ static void NewGRFWndProc(Window *w, WindowEvent *e)
for (c = *WP(w, newgrf_d).list; c != NULL && i > 0; c = c->next, i--) {} for (c = *WP(w, newgrf_d).list; c != NULL && i > 0; c = c->next, i--) {}
WP(w, newgrf_d).sel = c; WP(w, newgrf_d).sel = c;
SetWindowDirty(w); w->SetDirty();
break; break;
} }
@ -517,7 +517,7 @@ static void NewGRFWndProc(Window *w, WindowEvent *e)
/* parse_intlist returns -1 on error */ /* parse_intlist returns -1 on error */
if (c->num_params == (byte)-1) c->num_params = 0; if (c->num_params == (byte)-1) c->num_params = 0;
} }
SetWindowDirty(w); w->SetDirty();
break; break;
case WE_DESTROY: case WE_DESTROY:

View File

@ -345,7 +345,7 @@ void AddNewsItem(StringID string, NewsMode display_mode, NewsFlag flags, NewsTyp
Window *w = FindWindowById(WC_MESSAGE_HISTORY, 0); Window *w = FindWindowById(WC_MESSAGE_HISTORY, 0);
if (w == NULL) return; if (w == NULL) return;
SetWindowDirty(w); w->SetDirty();
w->vscroll.count = _total_news; w->vscroll.count = _total_news;
} }
@ -520,7 +520,7 @@ static void MoveToNextItem()
if (w != NULL) { if (w != NULL) {
WP(w, def_d).data_2 = 91; WP(w, def_d).data_2 = 91;
SetWindowDirty(w); w->SetDirty();
} }
break; break;
} }
@ -721,7 +721,7 @@ void ShowMessageHistory()
w->resize.height = w->height - 12 * 6; // minimum of 4 items in the list, each item 12 high w->resize.height = w->height - 12 * 6; // minimum of 4 items in the list, each item 12 high
w->resize.step_width = 1; w->resize.step_width = 1;
w->resize.width = 200; // can't make window any smaller than 200 pixel w->resize.width = 200; // can't make window any smaller than 200 pixel
SetWindowDirty(w); w->SetDirty();
} }
@ -809,7 +809,7 @@ static void MessageOptionsWndProc(Window *w, WindowEvent *e)
SetMessageButtonStates(w, val, element); SetMessageButtonStates(w, val, element);
_news_type_data[element].display = (NewsDisplay)val; _news_type_data[element].display = (NewsDisplay)val;
SetWindowDirty(w); w->SetDirty();
} }
break; break;
} }
@ -823,7 +823,7 @@ static void MessageOptionsWndProc(Window *w, WindowEvent *e)
SetMessageButtonStates(w, e->we.dropdown.index, i); SetMessageButtonStates(w, e->we.dropdown.index, i);
_news_type_data[i].display = (NewsDisplay)e->we.dropdown.index; _news_type_data[i].display = (NewsDisplay)e->we.dropdown.index;
} }
SetWindowDirty(w); w->SetDirty();
break; break;
} }
} }
@ -990,7 +990,7 @@ void DeleteVehicleNews(VehicleID vid, StringID news)
Window *w = FindWindowById(WC_MESSAGE_HISTORY, 0); Window *w = FindWindowById(WC_MESSAGE_HISTORY, 0);
if (w != NULL) { if (w != NULL) {
SetWindowDirty(w); w->SetDirty();
w->vscroll.count = _total_news; w->vscroll.count = _total_news;
} }
} }

View File

@ -799,7 +799,7 @@ static void OrdersWndProc(Window *w, WindowEvent *e)
/* This was a click on an empty part of the orders window, so /* This was a click on an empty part of the orders window, so
* deselect the currently selected order. */ * deselect the currently selected order. */
WP(w, order_d).sel = -1; WP(w, order_d).sel = -1;
SetWindowDirty(w); w->SetDirty();
return; return;
} }
@ -831,7 +831,7 @@ static void OrdersWndProc(Window *w, WindowEvent *e)
} }
} }
SetWindowDirty(w); w->SetDirty();
} break; } break;
case ORDER_WIDGET_SKIP: case ORDER_WIDGET_SKIP:

View File

@ -113,7 +113,7 @@ static void OskWndProc(Window *w, WindowEvent *e)
if (HasBit(_keystate, KEYS_SHIFT)) { if (HasBit(_keystate, KEYS_SHIFT)) {
ToggleBit(_keystate, KEYS_SHIFT); ToggleBit(_keystate, KEYS_SHIFT);
w->widget[OSK_WIDGET_SHIFT].color = HasBit(_keystate, KEYS_SHIFT) ? 15 : 14; w->widget[OSK_WIDGET_SHIFT].color = HasBit(_keystate, KEYS_SHIFT) ? 15 : 14;
SetWindowDirty(w); w->SetDirty();
} }
break; break;
} }
@ -133,12 +133,12 @@ static void OskWndProc(Window *w, WindowEvent *e)
case OSK_WIDGET_CAPS: case OSK_WIDGET_CAPS:
ToggleBit(_keystate, KEYS_CAPS); ToggleBit(_keystate, KEYS_CAPS);
SetWindowDirty(w); w->SetDirty();
break; break;
case OSK_WIDGET_SHIFT: case OSK_WIDGET_SHIFT:
ToggleBit(_keystate, KEYS_SHIFT); ToggleBit(_keystate, KEYS_SHIFT);
SetWindowDirty(w); w->SetDirty();
break; break;
case OSK_WIDGET_SPACE: case OSK_WIDGET_SPACE:

View File

@ -166,9 +166,9 @@ static void PlayerFinancesWndProc(Window *w, WindowEvent *e)
int new_height = ((player != _local_player) ? 0 : 12) + ((WP(w, def_d).data_1 != 0) ? 48 : 74 + 10 * EXPENSES_END); int new_height = ((player != _local_player) ? 0 : 12) + ((WP(w, def_d).data_1 != 0) ? 48 : 74 + 10 * EXPENSES_END);
if (w->height != new_height) { if (w->height != new_height) {
/* Make window dirty before and after resizing */ /* Make window dirty before and after resizing */
SetWindowDirty(w); w->SetDirty();
w->height = new_height; w->height = new_height;
SetWindowDirty(w); w->SetDirty();
w->SetWidgetHiddenState(PFW_WIDGET_INCREASE_LOAN, player != _local_player); w->SetWidgetHiddenState(PFW_WIDGET_INCREASE_LOAN, player != _local_player);
w->SetWidgetHiddenState(PFW_WIDGET_REPAY_LOAN, player != _local_player); w->SetWidgetHiddenState(PFW_WIDGET_REPAY_LOAN, player != _local_player);
@ -488,7 +488,7 @@ static void SelectPlayerLiveryWndProc(Window *w, WindowEvent *e)
} else { } else {
WP(w, livery_d).sel = 1 << j; WP(w, livery_d).sel = 1 << j;
} }
SetWindowDirty(w); w->SetDirty();
break; break;
} }
} }
@ -892,7 +892,7 @@ static void SelectPlayerFaceWndProc(Window *w, WindowEvent *e)
*pf = _player_face; *pf = _player_face;
ScaleAllPlayerFaceBits(*pf); ScaleAllPlayerFaceBits(*pf);
ShowErrorMessage(INVALID_STRING_ID, STR_FACE_LOAD_DONE, 0, 0); ShowErrorMessage(INVALID_STRING_ID, STR_FACE_LOAD_DONE, 0, 0);
SetWindowDirty(w); w->SetDirty();
break; break;
/* 'Player face number' button, view and/or set player face number */ /* 'Player face number' button, view and/or set player face number */
@ -912,13 +912,13 @@ static void SelectPlayerFaceWndProc(Window *w, WindowEvent *e)
case PFW_WIDGET_FEMALE: case PFW_WIDGET_FEMALE:
SetPlayerFaceBits(*pf, PFV_GENDER, ge, e->we.click.widget - PFW_WIDGET_MALE); SetPlayerFaceBits(*pf, PFV_GENDER, ge, e->we.click.widget - PFW_WIDGET_MALE);
ScaleAllPlayerFaceBits(*pf); ScaleAllPlayerFaceBits(*pf);
SetWindowDirty(w); w->SetDirty();
break; break;
/* Randomize face button */ /* Randomize face button */
case PFW_WIDGET_RANDOM_NEW_FACE: case PFW_WIDGET_RANDOM_NEW_FACE:
RandomPlayerFaceBits(*pf, ge, WP(w, facesel_d).advanced); RandomPlayerFaceBits(*pf, ge, WP(w, facesel_d).advanced);
SetWindowDirty(w); w->SetDirty();
break; break;
/* Toggle ethnicity (european/african) button */ /* Toggle ethnicity (european/african) button */
@ -926,7 +926,7 @@ static void SelectPlayerFaceWndProc(Window *w, WindowEvent *e)
case PFW_WIDGET_ETHNICITY_AFR: case PFW_WIDGET_ETHNICITY_AFR:
SetPlayerFaceBits(*pf, PFV_ETHNICITY, ge, e->we.click.widget - PFW_WIDGET_ETHNICITY_EUR); SetPlayerFaceBits(*pf, PFV_ETHNICITY, ge, e->we.click.widget - PFW_WIDGET_ETHNICITY_EUR);
ScaleAllPlayerFaceBits(*pf); ScaleAllPlayerFaceBits(*pf);
SetWindowDirty(w); w->SetDirty();
break; break;
default: default:
@ -965,7 +965,7 @@ static void SelectPlayerFaceWndProc(Window *w, WindowEvent *e)
IncreasePlayerFaceBits(*pf, pfv, ge, (((e->we.click.widget - PFW_WIDGET_EYECOLOUR_L) % 3) != 0) ? 1 : -1); IncreasePlayerFaceBits(*pf, pfv, ge, (((e->we.click.widget - PFW_WIDGET_EYECOLOUR_L) % 3) != 0) ? 1 : -1);
} }
SetWindowDirty(w); w->SetDirty();
} }
break; break;
} }
@ -977,7 +977,7 @@ static void SelectPlayerFaceWndProc(Window *w, WindowEvent *e)
*pf = strtoul(e->we.edittext.str, NULL, 10); *pf = strtoul(e->we.edittext.str, NULL, 10);
ScaleAllPlayerFaceBits(*pf); ScaleAllPlayerFaceBits(*pf);
ShowErrorMessage(INVALID_STRING_ID, STR_FACE_FACECODE_SET, 0, 0); ShowErrorMessage(INVALID_STRING_ID, STR_FACE_FACECODE_SET, 0, 0);
SetWindowDirty(w); w->SetDirty();
} else { } else {
ShowErrorMessage(INVALID_STRING_ID, STR_FACE_FACECODE_ERR, 0, 0); ShowErrorMessage(INVALID_STRING_ID, STR_FACE_FACECODE_ERR, 0, 0);
} }
@ -1304,7 +1304,7 @@ static void PlayerCompanyWndProc(Window *w, WindowEvent *e)
case WE_MOUSELOOP: case WE_MOUSELOOP:
/* redraw the window every now and then */ /* redraw the window every now and then */
if ((++w->vscroll.pos & 0x1F) == 0) SetWindowDirty(w); if ((++w->vscroll.pos & 0x1F) == 0) w->SetDirty();
break; break;
case WE_PLACE_OBJ: case WE_PLACE_OBJ:

View File

@ -940,9 +940,9 @@ static void StationBuildWndProc(Window *w, WindowEvent *e)
int text_end = DrawStationCoverageAreaText(2, 166 + y_offset, SCT_ALL, rad, false); int text_end = DrawStationCoverageAreaText(2, 166 + y_offset, SCT_ALL, rad, false);
text_end = DrawStationCoverageAreaText(2, text_end + 4, SCT_ALL, rad, true) + 4; text_end = DrawStationCoverageAreaText(2, text_end + 4, SCT_ALL, rad, true) + 4;
if (text_end != w->widget[BRSW_BACKGROUND].bottom) { if (text_end != w->widget[BRSW_BACKGROUND].bottom) {
SetWindowDirty(w); w->SetDirty();
ResizeWindowForWidget(w, BRSW_BACKGROUND, 0, text_end - w->widget[BRSW_BACKGROUND].bottom); ResizeWindowForWidget(w, BRSW_BACKGROUND, 0, text_end - w->widget[BRSW_BACKGROUND].bottom);
SetWindowDirty(w); w->SetDirty();
} }
if (newstations) { if (newstations) {
@ -974,7 +974,7 @@ static void StationBuildWndProc(Window *w, WindowEvent *e)
_railstation.orientation = e->we.click.widget - BRSW_PLATFORM_DIR_X; _railstation.orientation = e->we.click.widget - BRSW_PLATFORM_DIR_X;
w->LowerWidget(_railstation.orientation + BRSW_PLATFORM_DIR_X); w->LowerWidget(_railstation.orientation + BRSW_PLATFORM_DIR_X);
SndPlayFx(SND_15_BEEP); SndPlayFx(SND_15_BEEP);
SetWindowDirty(w); w->SetDirty();
break; break;
case BRSW_PLATFORM_NUM_1: case BRSW_PLATFORM_NUM_1:
@ -1005,7 +1005,7 @@ static void StationBuildWndProc(Window *w, WindowEvent *e)
w->LowerWidget(_railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); w->LowerWidget(_railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN);
w->LowerWidget(_railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); w->LowerWidget(_railstation.platlength + BRSW_PLATFORM_LEN_BEGIN);
SndPlayFx(SND_15_BEEP); SndPlayFx(SND_15_BEEP);
SetWindowDirty(w); w->SetDirty();
break; break;
} }
@ -1037,7 +1037,7 @@ static void StationBuildWndProc(Window *w, WindowEvent *e)
w->LowerWidget(_railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); w->LowerWidget(_railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN);
w->LowerWidget(_railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); w->LowerWidget(_railstation.platlength + BRSW_PLATFORM_LEN_BEGIN);
SndPlayFx(SND_15_BEEP); SndPlayFx(SND_15_BEEP);
SetWindowDirty(w); w->SetDirty();
break; break;
} }
@ -1069,7 +1069,7 @@ static void StationBuildWndProc(Window *w, WindowEvent *e)
w->SetWidgetLoweredState(_railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN, !_railstation.dragdrop); w->SetWidgetLoweredState(_railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN, !_railstation.dragdrop);
w->SetWidgetLoweredState(_railstation.platlength + BRSW_PLATFORM_LEN_BEGIN, !_railstation.dragdrop); w->SetWidgetLoweredState(_railstation.platlength + BRSW_PLATFORM_LEN_BEGIN, !_railstation.dragdrop);
SndPlayFx(SND_15_BEEP); SndPlayFx(SND_15_BEEP);
SetWindowDirty(w); w->SetDirty();
} break; } break;
case BRSW_HIGHLIGHT_OFF: case BRSW_HIGHLIGHT_OFF:
@ -1078,7 +1078,7 @@ static void StationBuildWndProc(Window *w, WindowEvent *e)
w->SetWidgetLoweredState(BRSW_HIGHLIGHT_OFF, !_station_show_coverage); w->SetWidgetLoweredState(BRSW_HIGHLIGHT_OFF, !_station_show_coverage);
w->SetWidgetLoweredState(BRSW_HIGHLIGHT_ON, _station_show_coverage); w->SetWidgetLoweredState(BRSW_HIGHLIGHT_ON, _station_show_coverage);
SndPlayFx(SND_15_BEEP); SndPlayFx(SND_15_BEEP);
SetWindowDirty(w); w->SetDirty();
break; break;
case BRSW_NEWST_DROPDOWN: case BRSW_NEWST_DROPDOWN:
@ -1104,7 +1104,7 @@ static void StationBuildWndProc(Window *w, WindowEvent *e)
CheckSelectedSize(w, statspec); CheckSelectedSize(w, statspec);
SndPlayFx(SND_15_BEEP); SndPlayFx(SND_15_BEEP);
SetWindowDirty(w); w->SetDirty();
break; break;
} }
} }
@ -1123,7 +1123,7 @@ static void StationBuildWndProc(Window *w, WindowEvent *e)
} }
SndPlayFx(SND_15_BEEP); SndPlayFx(SND_15_BEEP);
SetWindowDirty(w); w->SetDirty();
break; break;
case WE_MOUSELOOP: case WE_MOUSELOOP:
@ -1332,23 +1332,21 @@ static void SignalBuildWndProc(Window *w, WindowEvent *e)
case BSW_DRAG_SIGNALS_DENSITY_DECREASE: case BSW_DRAG_SIGNALS_DENSITY_DECREASE:
if (_patches.drag_signals_density > 1) { if (_patches.drag_signals_density > 1) {
_patches.drag_signals_density--; _patches.drag_signals_density--;
const Window *w = FindWindowById(WC_GAME_OPTIONS, 0); SetWindowDirty(FindWindowById(WC_GAME_OPTIONS, 0));
if (w != NULL) SetWindowDirty(w);
} }
break; break;
case BSW_DRAG_SIGNALS_DENSITY_INCREASE: case BSW_DRAG_SIGNALS_DENSITY_INCREASE:
if (_patches.drag_signals_density < 20) { if (_patches.drag_signals_density < 20) {
_patches.drag_signals_density++; _patches.drag_signals_density++;
const Window *w = FindWindowById(WC_GAME_OPTIONS, 0); SetWindowDirty(FindWindowById(WC_GAME_OPTIONS, 0));
if (w != NULL) SetWindowDirty(w);
} }
break; break;
default: break; default: break;
} }
SetWindowDirty(w); w->SetDirty();
break; break;
case WE_MOUSELOOP: case WE_MOUSELOOP:
@ -1437,7 +1435,7 @@ static void BuildTrainDepotWndProc(Window *w, WindowEvent *e)
_build_depot_direction = (DiagDirection)(e->we.click.widget - BRDW_DEPOT_NE); _build_depot_direction = (DiagDirection)(e->we.click.widget - BRDW_DEPOT_NE);
w->LowerWidget(_build_depot_direction + BRDW_DEPOT_NE); w->LowerWidget(_build_depot_direction + BRDW_DEPOT_NE);
SndPlayFx(SND_15_BEEP); SndPlayFx(SND_15_BEEP);
SetWindowDirty(w); w->SetDirty();
break; break;
} }
break; break;
@ -1534,7 +1532,7 @@ static void BuildWaypointWndProc(Window *w, WindowEvent *e)
_cur_waypoint_type = type; _cur_waypoint_type = type;
SndPlayFx(SND_15_BEEP); SndPlayFx(SND_15_BEEP);
SetWindowDirty(w); w->SetDirty();
break; break;
} }
} }
@ -1600,7 +1598,7 @@ void ReinitGuiAfterToggleElrail(bool disable)
w = FindWindowById(WC_BUILD_TOOLBAR, TRANSPORT_RAIL); w = FindWindowById(WC_BUILD_TOOLBAR, TRANSPORT_RAIL);
if (w != NULL) { if (w != NULL) {
SetupRailToolbar(_cur_railtype, w); SetupRailToolbar(_cur_railtype, w);
SetWindowDirty(w); w->SetDirty();
} }
} }
MarkWholeScreenDirty(); MarkWholeScreenDirty();
@ -1651,7 +1649,7 @@ static void SetDefaultRailGui()
Window *w = FindWindowById(WC_BUILD_TOOLBAR, TRANSPORT_RAIL); Window *w = FindWindowById(WC_BUILD_TOOLBAR, TRANSPORT_RAIL);
if (w != NULL) { if (w != NULL) {
SetupRailToolbar(_cur_railtype, w); SetupRailToolbar(_cur_railtype, w);
SetWindowDirty(w); w->SetDirty();
} }
} }
@ -1668,7 +1666,7 @@ int32 ResetSignalVariant(int32 = 0)
if (new_variant != _cur_signal_variant) { if (new_variant != _cur_signal_variant) {
Window *w = FindWindowById(WC_BUILD_SIGNAL, 0); Window *w = FindWindowById(WC_BUILD_SIGNAL, 0);
if (w != NULL) { if (w != NULL) {
SetWindowDirty(w); w->SetDirty();
w->RaiseWidget((_cur_signal_variant == SIG_ELECTRIC ? BSW_ELECTRIC_NORM : BSW_SEMAPHORE_NORM) + _cur_signal_type); w->RaiseWidget((_cur_signal_variant == SIG_ELECTRIC ? BSW_ELECTRIC_NORM : BSW_SEMAPHORE_NORM) + _cur_signal_type);
} }
_cur_signal_variant = new_variant; _cur_signal_variant = new_variant;

View File

@ -352,7 +352,7 @@ static void BuildRoadClick_TruckStation(Window *w)
static void BuildRoadClick_OneWay(Window *w) static void BuildRoadClick_OneWay(Window *w)
{ {
if (w->IsWidgetDisabled(RTW_ONE_WAY)) return; if (w->IsWidgetDisabled(RTW_ONE_WAY)) return;
SetWindowDirty(w); w->SetDirty();
w->ToggleWidgetLoweredState(RTW_ONE_WAY); w->ToggleWidgetLoweredState(RTW_ONE_WAY);
SetSelectionRed(false); SetSelectionRed(false);
} }
@ -758,7 +758,7 @@ static void BuildRoadDepotWndProc(Window *w, WindowEvent *e)
_road_depot_orientation = (DiagDirection)(e->we.click.widget - BRDW_DEPOT_NE); _road_depot_orientation = (DiagDirection)(e->we.click.widget - BRDW_DEPOT_NE);
w->LowerWidget(_road_depot_orientation + BRDW_DEPOT_NE); w->LowerWidget(_road_depot_orientation + BRDW_DEPOT_NE);
SndPlayFx(SND_15_BEEP); SndPlayFx(SND_15_BEEP);
SetWindowDirty(w); w->SetDirty();
break; break;
default: default:
@ -888,9 +888,9 @@ static void RoadStationPickerWndProc(Window *w, WindowEvent *e)
(w->window_class == WC_BUS_STATION) ? SCT_PASSENGERS_ONLY : SCT_NON_PASSENGERS_ONLY, (w->window_class == WC_BUS_STATION) ? SCT_PASSENGERS_ONLY : SCT_NON_PASSENGERS_ONLY,
3, true) + 4; 3, true) + 4;
if (text_end > w->widget[BRSW_BACKGROUND].bottom) { if (text_end > w->widget[BRSW_BACKGROUND].bottom) {
SetWindowDirty(w); w->SetDirty();
ResizeWindowForWidget(w, BRSW_BACKGROUND, 0, text_end - w->widget[BRSW_BACKGROUND].bottom); ResizeWindowForWidget(w, BRSW_BACKGROUND, 0, text_end - w->widget[BRSW_BACKGROUND].bottom);
SetWindowDirty(w); w->SetDirty();
} }
} break; } break;
@ -906,7 +906,7 @@ static void RoadStationPickerWndProc(Window *w, WindowEvent *e)
_road_station_picker_orientation = (DiagDirection)(e->we.click.widget - BRSW_STATION_NE); _road_station_picker_orientation = (DiagDirection)(e->we.click.widget - BRSW_STATION_NE);
w->LowerWidget(_road_station_picker_orientation + BRSW_STATION_NE); w->LowerWidget(_road_station_picker_orientation + BRSW_STATION_NE);
SndPlayFx(SND_15_BEEP); SndPlayFx(SND_15_BEEP);
SetWindowDirty(w); w->SetDirty();
break; break;
case BRSW_LT_OFF: case BRSW_LT_OFF:
@ -915,7 +915,7 @@ static void RoadStationPickerWndProc(Window *w, WindowEvent *e)
_station_show_coverage = (e->we.click.widget != BRSW_LT_OFF); _station_show_coverage = (e->we.click.widget != BRSW_LT_OFF);
w->LowerWidget(_station_show_coverage + BRSW_LT_OFF); w->LowerWidget(_station_show_coverage + BRSW_LT_OFF);
SndPlayFx(SND_15_BEEP); SndPlayFx(SND_15_BEEP);
SetWindowDirty(w); w->SetDirty();
break; break;
default: default:

View File

@ -1211,9 +1211,7 @@ static int32 RealisticAccelerationChanged(int32 p1)
static int32 DragSignalsDensityChanged(int32) static int32 DragSignalsDensityChanged(int32)
{ {
const Window *w = FindWindowById(WC_BUILD_SIGNAL, 0); SetWindowDirty(FindWindowById(WC_BUILD_SIGNAL, 0));
if (w != NULL) SetWindowDirty(w);
return 0; return 0;
} }

View File

@ -248,7 +248,7 @@ static void GameOptionsWndProc(Window *w, WindowEvent *e)
ShowErrorMessage(INVALID_STRING_ID, STR_FULLSCREEN_FAILED, 0, 0); ShowErrorMessage(INVALID_STRING_ID, STR_FULLSCREEN_FAILED, 0, 0);
} }
w->SetWidgetLoweredState(GAMEOPT_FULLSCREEN, _fullscreen); w->SetWidgetLoweredState(GAMEOPT_FULLSCREEN, _fullscreen);
SetWindowDirty(w); w->SetDirty();
break; break;
case GAMEOPT_SCREENSHOT_BTN: /* Setup screenshot format dropdown */ case GAMEOPT_SCREENSHOT_BTN: /* Setup screenshot format dropdown */
@ -296,7 +296,7 @@ static void GameOptionsWndProc(Window *w, WindowEvent *e)
case GAMEOPT_AUTOSAVE_BTN: /* Autosave options */ case GAMEOPT_AUTOSAVE_BTN: /* Autosave options */
_opt.autosave = _opt_newgame.autosave = e->we.dropdown.index; _opt.autosave = _opt_newgame.autosave = e->we.dropdown.index;
SetWindowDirty(w); w->SetDirty();
break; break;
case GAMEOPT_LANG_BTN: /* Change interface language */ case GAMEOPT_LANG_BTN: /* Change interface language */
@ -309,12 +309,12 @@ static void GameOptionsWndProc(Window *w, WindowEvent *e)
case GAMEOPT_RESOLUTION_BTN: /* Change resolution */ case GAMEOPT_RESOLUTION_BTN: /* Change resolution */
if (e->we.dropdown.index < _num_resolutions && ChangeResInGame(_resolutions[e->we.dropdown.index][0], _resolutions[e->we.dropdown.index][1])) if (e->we.dropdown.index < _num_resolutions && ChangeResInGame(_resolutions[e->we.dropdown.index][0], _resolutions[e->we.dropdown.index][1]))
SetWindowDirty(w); w->SetDirty();
break; break;
case GAMEOPT_SCREENSHOT_BTN: /* Change screenshot format */ case GAMEOPT_SCREENSHOT_BTN: /* Change screenshot format */
SetScreenshotFormat(e->we.dropdown.index); SetScreenshotFormat(e->we.dropdown.index);
SetWindowDirty(w); w->SetDirty();
break; break;
} }
break; break;
@ -615,7 +615,7 @@ static void GameDifficultyWndProc(Window *w, WindowEvent *e)
w->RaiseWidget(GDW_LVL_EASY + _opt_mod_temp.diff_level); w->RaiseWidget(GDW_LVL_EASY + _opt_mod_temp.diff_level);
SetDifficultyLevel(3, &_opt_mod_temp); // set difficulty level to custom SetDifficultyLevel(3, &_opt_mod_temp); // set difficulty level to custom
w->LowerWidget(GDW_LVL_CUSTOM); w->LowerWidget(GDW_LVL_CUSTOM);
SetWindowDirty(w); w->SetDirty();
} break; } break;
case GDW_LVL_EASY: case GDW_LVL_EASY:
@ -626,7 +626,7 @@ static void GameDifficultyWndProc(Window *w, WindowEvent *e)
w->RaiseWidget(GDW_LVL_EASY + _opt_mod_temp.diff_level); w->RaiseWidget(GDW_LVL_EASY + _opt_mod_temp.diff_level);
SetDifficultyLevel(e->we.click.widget - GDW_LVL_EASY, &_opt_mod_temp); SetDifficultyLevel(e->we.click.widget - GDW_LVL_EASY, &_opt_mod_temp);
w->LowerWidget(GDW_LVL_EASY + _opt_mod_temp.diff_level); w->LowerWidget(GDW_LVL_EASY + _opt_mod_temp.diff_level);
SetWindowDirty(w); w->SetDirty();
break; break;
case GDW_HIGHSCORE: // Highscore Table case GDW_HIGHSCORE: // Highscore Table
@ -659,7 +659,7 @@ static void GameDifficultyWndProc(Window *w, WindowEvent *e)
if (diffic_d->timeout != 0) { if (diffic_d->timeout != 0) {
diffic_d->timeout--; diffic_d->timeout--;
if (diffic_d->timeout == 0) diffic_d->clicked_button = NO_SETTINGS_BUTTON; if (diffic_d->timeout == 0) diffic_d->clicked_button = NO_SETTINGS_BUTTON;
SetWindowDirty(w); w->SetDirty();
} }
break; break;
} }
@ -1027,7 +1027,7 @@ static void PatchesSelectionWndProc(Window *w, WindowEvent *e)
if (value != oldvalue) { if (value != oldvalue) {
SetPatchValue(page->entries[btn].index, patches_ptr, value); SetPatchValue(page->entries[btn].index, patches_ptr, value);
SetWindowDirty(w); w->SetDirty();
} }
} else { } else {
/* only open editbox for types that its sensible for */ /* only open editbox for types that its sensible for */
@ -1048,14 +1048,14 @@ static void PatchesSelectionWndProc(Window *w, WindowEvent *e)
WP(w, def_d).data_1 = e->we.click.widget - PATCHSEL_INTERFACE; WP(w, def_d).data_1 = e->we.click.widget - PATCHSEL_INTERFACE;
w->LowerWidget(WP(w, def_d).data_1 + PATCHSEL_INTERFACE); w->LowerWidget(WP(w, def_d).data_1 + PATCHSEL_INTERFACE);
DeleteWindowById(WC_QUERY_STRING, 0); DeleteWindowById(WC_QUERY_STRING, 0);
SetWindowDirty(w); w->SetDirty();
break; break;
} }
break; break;
case WE_TIMEOUT: case WE_TIMEOUT:
WP(w, def_d).data_2 = 0; WP(w, def_d).data_2 = 0;
SetWindowDirty(w); w->SetDirty();
break; break;
case WE_ON_EDIT_TEXT: case WE_ON_EDIT_TEXT:
@ -1068,7 +1068,7 @@ static void PatchesSelectionWndProc(Window *w, WindowEvent *e)
if (sd->desc.flags & SGF_CURRENCY) value /= _currency->rate; if (sd->desc.flags & SGF_CURRENCY) value /= _currency->rate;
SetPatchValue(pe->index, patches_ptr, value); SetPatchValue(pe->index, patches_ptr, value);
SetWindowDirty(w); w->SetDirty();
} }
break; break;
@ -1267,7 +1267,7 @@ static void CustCurrencyWndProc(Window *w, WindowEvent *e)
} }
w->flags4 |= 5 << WF_TIMEOUT_SHL; w->flags4 |= 5 << WF_TIMEOUT_SHL;
SetWindowDirty(w); w->SetDirty();
} break; } break;
case WE_ON_EDIT_TEXT: { case WE_ON_EDIT_TEXT: {
@ -1303,7 +1303,7 @@ static void CustCurrencyWndProc(Window *w, WindowEvent *e)
case WE_TIMEOUT: case WE_TIMEOUT:
WP(w, def_d).data_1 = 0; WP(w, def_d).data_1 = 0;
SetWindowDirty(w); w->SetDirty();
break; break;
case WE_DESTROY: case WE_DESTROY:

View File

@ -785,7 +785,7 @@ void SmallMapCenterOnCurrentPos(Window *w)
y = ((vp->virtual_height - (w->widget[SM_WIDGET_MAP].bottom - w->widget[SM_WIDGET_MAP].top ) * TILE_SIZE) / 2 + vp->virtual_top ) / 2 - TILE_SIZE * 2; y = ((vp->virtual_height - (w->widget[SM_WIDGET_MAP].bottom - w->widget[SM_WIDGET_MAP].top ) * TILE_SIZE) / 2 + vp->virtual_top ) / 2 - TILE_SIZE * 2;
WP(w, smallmap_d).scroll_x = (y - x) & ~0xF; WP(w, smallmap_d).scroll_x = (y - x) & ~0xF;
WP(w, smallmap_d).scroll_y = (x + y) & ~0xF; WP(w, smallmap_d).scroll_y = (x + y) & ~0xF;
SetWindowDirty(w); w->SetDirty();
} }
enum { enum {
@ -879,7 +879,7 @@ static void SmallMapWindowProc(Window *w, WindowEvent *e)
WP(w2, vp_d).dest_scrollpos_x = pt.x + ((_cursor.pos.x - w->left + 2) << 4) - (w2->viewport->virtual_width >> 1); WP(w2, vp_d).dest_scrollpos_x = pt.x + ((_cursor.pos.x - w->left + 2) << 4) - (w2->viewport->virtual_width >> 1);
WP(w2, vp_d).dest_scrollpos_y = pt.y + ((_cursor.pos.y - w->top - 16) << 4) - (w2->viewport->virtual_height >> 1); WP(w2, vp_d).dest_scrollpos_y = pt.y + ((_cursor.pos.y - w->top - 16) << 4) - (w2->viewport->virtual_height >> 1);
SetWindowDirty(w); w->SetDirty();
} break; } break;
case SM_WIDGET_CONTOUR: // Show land contours case SM_WIDGET_CONTOUR: // Show land contours
@ -892,14 +892,14 @@ static void SmallMapWindowProc(Window *w, WindowEvent *e)
_smallmap_type = e->we.click.widget - SM_WIDGET_CONTOUR; _smallmap_type = e->we.click.widget - SM_WIDGET_CONTOUR;
w->LowerWidget(_smallmap_type + SM_WIDGET_CONTOUR); w->LowerWidget(_smallmap_type + SM_WIDGET_CONTOUR);
SetWindowDirty(w); w->SetDirty();
SndPlayFx(SND_15_BEEP); SndPlayFx(SND_15_BEEP);
break; break;
case SM_WIDGET_CENTERMAP: // Center the smallmap again case SM_WIDGET_CENTERMAP: // Center the smallmap again
SmallMapCenterOnCurrentPos(w); SmallMapCenterOnCurrentPos(w);
SetWindowDirty(w); w->SetDirty();
SndPlayFx(SND_15_BEEP); SndPlayFx(SND_15_BEEP);
break; break;
@ -907,7 +907,7 @@ static void SmallMapWindowProc(Window *w, WindowEvent *e)
w->ToggleWidgetLoweredState(SM_WIDGET_TOGGLETOWNNAME); w->ToggleWidgetLoweredState(SM_WIDGET_TOGGLETOWNNAME);
_smallmap_show_towns = w->IsWidgetLowered(SM_WIDGET_TOGGLETOWNNAME); _smallmap_show_towns = w->IsWidgetLowered(SM_WIDGET_TOGGLETOWNNAME);
SetWindowDirty(w); w->SetDirty();
SndPlayFx(SND_15_BEEP); SndPlayFx(SND_15_BEEP);
break; break;
@ -939,7 +939,7 @@ static void SmallMapWindowProc(Window *w, WindowEvent *e)
/* Raise the two buttons "all", as we have done a specific choice */ /* Raise the two buttons "all", as we have done a specific choice */
w->RaiseWidget(SM_WIDGET_ENABLEINDUSTRIES); w->RaiseWidget(SM_WIDGET_ENABLEINDUSTRIES);
w->RaiseWidget(SM_WIDGET_DISABLEINDUSTRIES); w->RaiseWidget(SM_WIDGET_DISABLEINDUSTRIES);
SetWindowDirty(w); w->SetDirty();
} }
break; break;
@ -950,7 +950,7 @@ static void SmallMapWindowProc(Window *w, WindowEvent *e)
/* toggle appeareance indicating the choice */ /* toggle appeareance indicating the choice */
w->LowerWidget(SM_WIDGET_ENABLEINDUSTRIES); w->LowerWidget(SM_WIDGET_ENABLEINDUSTRIES);
w->RaiseWidget(SM_WIDGET_DISABLEINDUSTRIES); w->RaiseWidget(SM_WIDGET_DISABLEINDUSTRIES);
SetWindowDirty(w); w->SetDirty();
break; break;
case SM_WIDGET_DISABLEINDUSTRIES: // disable all industries case SM_WIDGET_DISABLEINDUSTRIES: // disable all industries
@ -960,7 +960,7 @@ static void SmallMapWindowProc(Window *w, WindowEvent *e)
/* toggle appeareance indicating the choice */ /* toggle appeareance indicating the choice */
w->RaiseWidget(SM_WIDGET_ENABLEINDUSTRIES); w->RaiseWidget(SM_WIDGET_ENABLEINDUSTRIES);
w->LowerWidget(SM_WIDGET_DISABLEINDUSTRIES); w->LowerWidget(SM_WIDGET_DISABLEINDUSTRIES);
SetWindowDirty(w); w->SetDirty();
break; break;
} }
break; break;
@ -976,7 +976,7 @@ static void SmallMapWindowProc(Window *w, WindowEvent *e)
case WE_MOUSELOOP: case WE_MOUSELOOP:
/* update the window every now and then */ /* update the window every now and then */
if ((++w->vscroll.pos & 0x1F) == 0) SetWindowDirty(w); if ((++w->vscroll.pos & 0x1F) == 0) w->SetDirty();
break; break;
case WE_SCROLL: { case WE_SCROLL: {
@ -1037,7 +1037,7 @@ static void SmallMapWindowProc(Window *w, WindowEvent *e)
WP(w, smallmap_d).scroll_y = y; WP(w, smallmap_d).scroll_y = y;
WP(w, smallmap_d).subscroll = sub; WP(w, smallmap_d).subscroll = sub;
SetWindowDirty(w); w->SetDirty();
} break; } break;
} }
} }

View File

@ -195,7 +195,7 @@ static void SetStationListsFlag(StationListFlags sl_flag)
Window *w = *wz; Window *w = *wz;
if (w->window_class == WC_STATION_LIST) { if (w->window_class == WC_STATION_LIST) {
WP(w, plstations_d).flags |= sl_flag; WP(w, plstations_d).flags |= sl_flag;
SetWindowDirty(w); w->SetDirty();
} }
} }
} }
@ -449,7 +449,7 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e)
} }
w->SetWidgetLoweredState(SLW_FACILALL, facilities == (FACIL_TRAIN | FACIL_TRUCK_STOP | FACIL_BUS_STOP | FACIL_AIRPORT | FACIL_DOCK)); w->SetWidgetLoweredState(SLW_FACILALL, facilities == (FACIL_TRAIN | FACIL_TRUCK_STOP | FACIL_BUS_STOP | FACIL_AIRPORT | FACIL_DOCK));
sl->flags |= SL_REBUILD; sl->flags |= SL_REBUILD;
SetWindowDirty(w); w->SetDirty();
break; break;
case SLW_FACILALL: case SLW_FACILALL:
@ -460,7 +460,7 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e)
facilities = FACIL_TRAIN | FACIL_TRUCK_STOP | FACIL_BUS_STOP | FACIL_AIRPORT | FACIL_DOCK; facilities = FACIL_TRAIN | FACIL_TRUCK_STOP | FACIL_BUS_STOP | FACIL_AIRPORT | FACIL_DOCK;
sl->flags |= SL_REBUILD; sl->flags |= SL_REBUILD;
SetWindowDirty(w); w->SetDirty();
break; break;
case SLW_CARGOALL: { case SLW_CARGOALL: {
@ -476,7 +476,7 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e)
_cargo_filter = _cargo_mask; _cargo_filter = _cargo_mask;
include_empty = true; include_empty = true;
sl->flags |= SL_REBUILD; sl->flags |= SL_REBUILD;
SetWindowDirty(w); w->SetDirty();
break; break;
} }
@ -486,7 +486,7 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e)
sl->flags |= SL_RESORT; sl->flags |= SL_RESORT;
w->flags4 |= 5 << WF_TIMEOUT_SHL; w->flags4 |= 5 << WF_TIMEOUT_SHL;
w->LowerWidget(SLW_SORTBY); w->LowerWidget(SLW_SORTBY);
SetWindowDirty(w); w->SetDirty();
break; break;
case SLW_SORTDROPBTN: // select sorting criteria dropdown menu case SLW_SORTDROPBTN: // select sorting criteria dropdown menu
@ -509,7 +509,7 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e)
} }
sl->flags |= SL_REBUILD; sl->flags |= SL_REBUILD;
w->SetWidgetLoweredState(SLW_CARGOALL, _cargo_filter == _cargo_mask && include_empty); w->SetWidgetLoweredState(SLW_CARGOALL, _cargo_filter == _cargo_mask && include_empty);
SetWindowDirty(w); w->SetDirty();
break; break;
default: default:
@ -540,7 +540,7 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e)
} }
sl->flags |= SL_REBUILD; sl->flags |= SL_REBUILD;
w->SetWidgetLoweredState(SLW_CARGOALL, _cargo_filter == _cargo_mask && include_empty); w->SetWidgetLoweredState(SLW_CARGOALL, _cargo_filter == _cargo_mask && include_empty);
SetWindowDirty(w); w->SetDirty();
} }
break; break;
} }
@ -553,7 +553,7 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e)
station_sort.criteria = sl->sort_type; station_sort.criteria = sl->sort_type;
sl->flags |= SL_RESORT; sl->flags |= SL_RESORT;
} }
SetWindowDirty(w); w->SetDirty();
break; break;
case WE_TICK: case WE_TICK:
@ -562,13 +562,13 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e)
DEBUG(misc, 3, "Periodic rebuild station list player %d", owner); DEBUG(misc, 3, "Periodic rebuild station list player %d", owner);
sl->resort_timer = DAY_TICKS * PERIODIC_RESORT_DAYS; sl->resort_timer = DAY_TICKS * PERIODIC_RESORT_DAYS;
sl->flags |= SL_REBUILD; sl->flags |= SL_REBUILD;
SetWindowDirty(w); w->SetDirty();
} }
break; break;
case WE_TIMEOUT: case WE_TIMEOUT:
w->RaiseWidget(SLW_SORTBY); w->RaiseWidget(SLW_SORTBY);
SetWindowDirty(w); w->SetDirty();
break; break;
case WE_RESIZE: case WE_RESIZE:
@ -949,7 +949,7 @@ static void StationViewWndProc(Window *w, WindowEvent *e)
break; break;
case SVW_RATINGS: case SVW_RATINGS:
SetWindowDirty(w); w->SetDirty();
if (w->widget[SVW_RATINGS].data == STR_3032_RATINGS) { if (w->widget[SVW_RATINGS].data == STR_3032_RATINGS) {
/* Switch to ratings view */ /* Switch to ratings view */
@ -963,7 +963,7 @@ static void StationViewWndProc(Window *w, WindowEvent *e)
ResizeWindowForWidget(w, SVW_ACCEPTLIST, 0, -100); ResizeWindowForWidget(w, SVW_ACCEPTLIST, 0, -100);
} }
SetWindowDirty(w); w->SetDirty();
break; break;
case SVW_RENAME: case SVW_RENAME:

View File

@ -114,7 +114,7 @@ static void StatusBarWndProc(Window *w, WindowEvent *e)
case WE_MESSAGE: case WE_MESSAGE:
w->message.msg = e->we.message.msg; w->message.msg = e->we.message.msg;
SetWindowDirty(w); w->SetDirty();
break; break;
case WE_CLICK: case WE_CLICK:

View File

@ -310,7 +310,7 @@ void ShowTerraformToolbar(Window *link)
w->top = 22; w->top = 22;
link->left = w->left - link->width; link->left = w->left - link->width;
SetWindowDirty(link); link->SetDirty();
} }
} }
@ -609,7 +609,7 @@ static void ScenEditLandGenWndProc(Window *w, WindowEvent *e)
_terraform_size = size; _terraform_size = size;
SndPlayFx(SND_15_BEEP); SndPlayFx(SND_15_BEEP);
SetWindowDirty(w); w->SetDirty();
} break; } break;
case 15: // gen random land case 15: // gen random land
w->HandleButtonClick(15); w->HandleButtonClick(15);
@ -662,7 +662,7 @@ static void ScenEditLandGenWndProc(Window *w, WindowEvent *e)
case WE_ABORT_PLACE_OBJ: case WE_ABORT_PLACE_OBJ:
w->RaiseButtons(); w->RaiseButtons();
SetWindowDirty(w); w->SetDirty();
break; break;
} }
} }

View File

@ -245,7 +245,7 @@ static void TimetableWndProc(Window *w, WindowEvent *we)
break; break;
} }
SetWindowDirty(w); w->SetDirty();
} break; } break;
case WE_ON_EDIT_TEXT: { case WE_ON_EDIT_TEXT: {

View File

@ -520,7 +520,7 @@ static void ToolbarScenDateBackward(Window *w)
/* don't allow too fast scrolling */ /* don't allow too fast scrolling */
if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) { if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) {
w->HandleButtonClick(6); w->HandleButtonClick(6);
SetWindowDirty(w); w->SetDirty();
_patches_newgame.starting_year = Clamp(_patches_newgame.starting_year - 1, MIN_YEAR, MAX_YEAR); _patches_newgame.starting_year = Clamp(_patches_newgame.starting_year - 1, MIN_YEAR, MAX_YEAR);
SetDate(ConvertYMDToDate(_patches_newgame.starting_year, 0, 1)); SetDate(ConvertYMDToDate(_patches_newgame.starting_year, 0, 1));
@ -533,7 +533,7 @@ static void ToolbarScenDateForward(Window *w)
/* don't allow too fast scrolling */ /* don't allow too fast scrolling */
if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) { if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) {
w->HandleButtonClick(7); w->HandleButtonClick(7);
SetWindowDirty(w); w->SetDirty();
_patches_newgame.starting_year = Clamp(_patches_newgame.starting_year + 1, MIN_YEAR, MAX_YEAR); _patches_newgame.starting_year = Clamp(_patches_newgame.starting_year + 1, MIN_YEAR, MAX_YEAR);
SetDate(ConvertYMDToDate(_patches_newgame.starting_year, 0, 1)); SetDate(ConvertYMDToDate(_patches_newgame.starting_year, 0, 1));
@ -721,7 +721,7 @@ static void MainToolbarWndProc(Window *w, WindowEvent *e)
case WE_ABORT_PLACE_OBJ: case WE_ABORT_PLACE_OBJ:
w->RaiseWidget(25); w->RaiseWidget(25);
SetWindowDirty(w); w->SetDirty();
break; break;
case WE_MOUSELOOP: case WE_MOUSELOOP:
@ -927,7 +927,7 @@ static void ScenEditToolbarWndProc(Window *w, WindowEvent *e)
case WE_ABORT_PLACE_OBJ: case WE_ABORT_PLACE_OBJ:
w->RaiseWidget(25); w->RaiseWidget(25);
SetWindowDirty(w); w->SetDirty();
break; break;
case WE_RESIZE: { case WE_RESIZE: {
@ -999,12 +999,12 @@ static void ScenEditToolbarWndProc(Window *w, WindowEvent *e)
case WE_MOUSELOOP: case WE_MOUSELOOP:
if (w->IsWidgetLowered(0) != !!_pause_game) { if (w->IsWidgetLowered(0) != !!_pause_game) {
w->ToggleWidgetLoweredState(0); w->ToggleWidgetLoweredState(0);
SetWindowDirty(w); w->SetDirty();
} }
if (w->IsWidgetLowered(1) != !!_fast_forward) { if (w->IsWidgetLowered(1) != !!_fast_forward) {
w->ToggleWidgetLoweredState(1); w->ToggleWidgetLoweredState(1);
SetWindowDirty(w); w->SetDirty();
} }
break; break;
@ -1128,7 +1128,7 @@ static void MenuWndProc(Window *w, WindowEvent *e)
case WE_DESTROY: { case WE_DESTROY: {
Window *v = FindWindowById(WC_MAIN_TOOLBAR, 0); Window *v = FindWindowById(WC_MAIN_TOOLBAR, 0);
v->RaiseWidget(WP(w, menu_d).main_button); v->RaiseWidget(WP(w, menu_d).main_button);
SetWindowDirty(v); w->SetDirty();
return; return;
} }
@ -1157,7 +1157,7 @@ static void MenuWndProc(Window *w, WindowEvent *e)
if (index == -1 || index == WP(w, menu_d).sel_index) return; if (index == -1 || index == WP(w, menu_d).sel_index) return;
WP(w, menu_d).sel_index = index; WP(w, menu_d).sel_index = index;
SetWindowDirty(w); w->SetDirty();
return; return;
} }
} }
@ -1269,12 +1269,12 @@ static void UpdatePlayerMenuHeight(Window *w)
if (WP(w, menu_d).item_count != num) { if (WP(w, menu_d).item_count != num) {
WP(w, menu_d).item_count = num; WP(w, menu_d).item_count = num;
SetWindowDirty(w); w->SetDirty();
num = num * 10 + 2; num = num * 10 + 2;
w->height = num; w->height = num;
w->widget[0].bottom = w->widget[0].top + num - 1; w->widget[0].bottom = w->widget[0].top + num - 1;
w->top = GetToolbarDropdownPos(0, w->width, w->height).y; w->top = GetToolbarDropdownPos(0, w->width, w->height).y;
SetWindowDirty(w); w->SetDirty();
} }
} }
@ -1325,7 +1325,7 @@ static void PlayerMenuWndProc(Window *w, WindowEvent *e)
case WE_DESTROY: { case WE_DESTROY: {
Window *v = FindWindowById(WC_MAIN_TOOLBAR, 0); Window *v = FindWindowById(WC_MAIN_TOOLBAR, 0);
v->RaiseWidget(WP(w, menu_d).main_button); v->RaiseWidget(WP(w, menu_d).main_button);
SetWindowDirty(v); w->SetDirty();
return; return;
} }
@ -1371,7 +1371,7 @@ static void PlayerMenuWndProc(Window *w, WindowEvent *e)
if (index == -1 || index == WP(w, menu_d).sel_index) return; if (index == -1 || index == WP(w, menu_d).sel_index) return;
WP(w, menu_d).sel_index = index; WP(w, menu_d).sel_index = index;
SetWindowDirty(w); w->SetDirty();
return; return;
} }
} }

View File

@ -239,7 +239,7 @@ static void TownAuthorityWndProc(Window *w, WindowEvent *e)
y = GetNthSetBit(GetMaskOfTownActions(NULL, _local_player, t), y + w->vscroll.pos - 1); y = GetNthSetBit(GetMaskOfTownActions(NULL, _local_player, t), y + w->vscroll.pos - 1);
if (y >= 0) { if (y >= 0) {
WP(w, def_d).data_1 = y; WP(w, def_d).data_1 = y;
SetWindowDirty(w); w->SetDirty();
} }
/* Fall through to clicking in case we are double-clicked */ /* Fall through to clicking in case we are double-clicked */
if (e->event != WE_DOUBLE_CLICK || y < 0) break; if (e->event != WE_DOUBLE_CLICK || y < 0) break;
@ -252,7 +252,7 @@ static void TownAuthorityWndProc(Window *w, WindowEvent *e)
break; break;
case WE_4: case WE_4:
SetWindowDirty(w); w->SetDirty();
break; break;
} }
} }
@ -523,13 +523,13 @@ static void TownDirectoryWndProc(Window *w, WindowEvent *e)
case TDW_SORTNAME: /* Sort by Name ascending/descending */ case TDW_SORTNAME: /* Sort by Name ascending/descending */
_town_sort_order = (_town_sort_order == 0) ? 1 : 0; _town_sort_order = (_town_sort_order == 0) ? 1 : 0;
_town_sort_dirty = true; _town_sort_dirty = true;
SetWindowDirty(w); w->SetDirty();
break; break;
case TDW_SORTPOPULATION: /* Sort by Population ascending/descending */ case TDW_SORTPOPULATION: /* Sort by Population ascending/descending */
_town_sort_order = (_town_sort_order == 2) ? 3 : 2; _town_sort_order = (_town_sort_order == 2) ? 3 : 2;
_town_sort_dirty = true; _town_sort_dirty = true;
SetWindowDirty(w); w->SetDirty();
break; break;
case TDW_CENTERTOWN: { /* Click on Town Matrix */ case TDW_CENTERTOWN: { /* Click on Town Matrix */
@ -555,7 +555,7 @@ static void TownDirectoryWndProc(Window *w, WindowEvent *e)
break; break;
case WE_4: case WE_4:
SetWindowDirty(w); w->SetDirty();
break; break;
case WE_RESIZE: case WE_RESIZE:
@ -671,14 +671,14 @@ static void ScenEditTownGenWndProc(Window *w, WindowEvent *e)
w->RaiseWidget(_scengen_town_size + TSEW_SMALLTOWN); w->RaiseWidget(_scengen_town_size + TSEW_SMALLTOWN);
_scengen_town_size = e->we.click.widget - TSEW_SMALLTOWN; _scengen_town_size = e->we.click.widget - TSEW_SMALLTOWN;
w->LowerWidget(_scengen_town_size + TSEW_SMALLTOWN); w->LowerWidget(_scengen_town_size + TSEW_SMALLTOWN);
SetWindowDirty(w); w->SetDirty();
break; break;
} break; } break;
case WE_TIMEOUT: case WE_TIMEOUT:
w->RaiseWidget(TSEW_RANDOMTOWN); w->RaiseWidget(TSEW_RANDOMTOWN);
w->RaiseWidget(TSEW_MANYRANDOMTOWNS); w->RaiseWidget(TSEW_MANYRANDOMTOWNS);
SetWindowDirty(w); w->SetDirty();
break; break;
case WE_PLACE_OBJ: case WE_PLACE_OBJ:
@ -688,7 +688,7 @@ static void ScenEditTownGenWndProc(Window *w, WindowEvent *e)
case WE_ABORT_PLACE_OBJ: case WE_ABORT_PLACE_OBJ:
w->RaiseButtons(); w->RaiseButtons();
w->LowerWidget(_scengen_town_size + TSEW_SMALLTOWN); w->LowerWidget(_scengen_town_size + TSEW_SMALLTOWN);
SetWindowDirty(w); w->SetDirty();
break; break;
} }
} }

View File

@ -66,7 +66,7 @@ static void TransparencyToolbWndProc(Window *w, WindowEvent *e)
if (_ctrl_pressed) { if (_ctrl_pressed) {
/* toggle the bit of the transparencies lock variable */ /* toggle the bit of the transparencies lock variable */
ToggleTransparencyLock((TransparencyOption)(e->we.click.widget - TTW_WIDGET_SIGNS)); ToggleTransparencyLock((TransparencyOption)(e->we.click.widget - TTW_WIDGET_SIGNS));
SetWindowDirty(w); w->SetDirty();
} else { } else {
/* toggle the bit of the transparencies variable and play a sound */ /* toggle the bit of the transparencies variable and play a sound */
ToggleTransparency((TransparencyOption)(e->we.click.widget - TTW_WIDGET_SIGNS)); ToggleTransparency((TransparencyOption)(e->we.click.widget - TTW_WIDGET_SIGNS));

View File

@ -119,7 +119,7 @@ static void SetVehicleListsFlag(SortListFlags sl_flag)
case WC_SHIPS_LIST: case WC_SHIPS_LIST:
case WC_AIRCRAFT_LIST: case WC_AIRCRAFT_LIST:
WP(w, vehiclelist_d).l.flags |= sl_flag; WP(w, vehiclelist_d).l.flags |= sl_flag;
SetWindowDirty(w); w->SetDirty();
break; break;
default: break; default: break;
@ -381,7 +381,7 @@ static void VehicleRefitWndProc(Window *w, WindowEvent *e)
int y = e->we.click.pt.y - w->widget[3].top; int y = e->we.click.pt.y - w->widget[3].top;
if (y >= 0) { if (y >= 0) {
WP(w, refit_d).sel = (y / (int)w->resize.step_height) + w->vscroll.pos; WP(w, refit_d).sel = (y / (int)w->resize.step_height) + w->vscroll.pos;
SetWindowDirty(w); w->SetDirty();
} }
} break; } break;
case 6: // refit button case 6: // refit button
@ -741,30 +741,30 @@ void ChangeVehicleViewWindow(VehicleID from_index, VehicleID to_index)
if (w != NULL) { if (w != NULL) {
w->window_number = to_index; w->window_number = to_index;
WP(w, vp_d).follow_vehicle = to_index; WP(w, vp_d).follow_vehicle = to_index;
SetWindowDirty(w); w->SetDirty();
w = FindWindowById(WC_VEHICLE_ORDERS, from_index); w = FindWindowById(WC_VEHICLE_ORDERS, from_index);
if (w != NULL) { if (w != NULL) {
w->window_number = to_index; w->window_number = to_index;
SetWindowDirty(w); w->SetDirty();
} }
w = FindWindowById(WC_VEHICLE_REFIT, from_index); w = FindWindowById(WC_VEHICLE_REFIT, from_index);
if (w != NULL) { if (w != NULL) {
w->window_number = to_index; w->window_number = to_index;
SetWindowDirty(w); w->SetDirty();
} }
w = FindWindowById(WC_VEHICLE_DETAILS, from_index); w = FindWindowById(WC_VEHICLE_DETAILS, from_index);
if (w != NULL) { if (w != NULL) {
w->window_number = to_index; w->window_number = to_index;
SetWindowDirty(w); w->SetDirty();
} }
w = FindWindowById(WC_VEHICLE_TIMETABLE, from_index); w = FindWindowById(WC_VEHICLE_TIMETABLE, from_index);
if (w != NULL) { if (w != NULL) {
w->window_number = to_index; w->window_number = to_index;
SetWindowDirty(w); w->SetDirty();
} }
} }
} }
@ -1082,7 +1082,7 @@ void PlayerVehWndProc(Window *w, WindowEvent *e)
vl->l.flags |= VL_RESORT; vl->l.flags |= VL_RESORT;
vl->_sorting->order = !!(vl->l.flags & VL_DESC); vl->_sorting->order = !!(vl->l.flags & VL_DESC);
SetWindowDirty(w); w->SetDirty();
break; break;
case VLW_WIDGET_SORT_BY_PULLDOWN:/* Select sorting criteria dropdown menu */ case VLW_WIDGET_SORT_BY_PULLDOWN:/* Select sorting criteria dropdown menu */
ShowDropDownMenu(w, _vehicle_sort_listing, vl->l.sort_type, VLW_WIDGET_SORT_BY_PULLDOWN, 0, (vl->vehicle_type == VEH_TRAIN || vl->vehicle_type == VEH_ROAD) ? 0 : (1 << 10)); ShowDropDownMenu(w, _vehicle_sort_listing, vl->l.sort_type, VLW_WIDGET_SORT_BY_PULLDOWN, 0, (vl->vehicle_type == VEH_TRAIN || vl->vehicle_type == VEH_ROAD) ? 0 : (1 << 10));
@ -1169,7 +1169,7 @@ void PlayerVehWndProc(Window *w, WindowEvent *e)
break; break;
default: NOT_REACHED(); default: NOT_REACHED();
} }
SetWindowDirty(w); w->SetDirty();
break; break;
case WE_DESTROY: case WE_DESTROY:
@ -1185,7 +1185,7 @@ void PlayerVehWndProc(Window *w, WindowEvent *e)
DEBUG(misc, 3, "Periodic resort %d list player %d at station %d", vl->vehicle_type, owner, station); DEBUG(misc, 3, "Periodic resort %d list player %d at station %d", vl->vehicle_type, owner, station);
vl->l.resort_timer = DAY_TICKS * PERIODIC_RESORT_DAYS; vl->l.resort_timer = DAY_TICKS * PERIODIC_RESORT_DAYS;
vl->l.flags |= VL_RESORT; vl->l.flags |= VL_RESORT;
SetWindowDirty(w); w->SetDirty();
} }
break; break;
@ -1634,7 +1634,7 @@ static void VehicleDetailsWndProc(Window *w, WindowEvent *e)
WIDGET_LIST_END); WIDGET_LIST_END);
WP(w, vehicledetails_d).tab = e->we.click.widget - VLD_WIDGET_DETAILS_CARGO_CARRIED; WP(w, vehicledetails_d).tab = e->we.click.widget - VLD_WIDGET_DETAILS_CARGO_CARRIED;
SetWindowDirty(w); w->SetDirty();
break; break;
} }
} break; } break;
@ -2168,7 +2168,7 @@ static void VehicleViewWndProc(Window *w, WindowEvent *e)
w->SetWidgetHiddenState( VVW_WIDGET_REFIT_VEH, !veh_stopped); // refit w->SetWidgetHiddenState( VVW_WIDGET_REFIT_VEH, !veh_stopped); // refit
w->SetWidgetHiddenState(VVW_WIDGET_TURN_AROUND, veh_stopped); // force turn around w->SetWidgetHiddenState(VVW_WIDGET_TURN_AROUND, veh_stopped); // force turn around
} }
SetWindowDirty(w); w->SetDirty();
} }
} break; } break;
} }

View File

@ -123,7 +123,7 @@ void ScrollbarClickHandler(Window *w, const Widget *wi, int x, int y)
} }
} }
SetWindowDirty(w); w->SetDirty();
} }
/** Returns the index for the widget located at the given position /** Returns the index for the widget located at the given position

View File

@ -252,7 +252,7 @@ static void DispatchMouseWheelEvent(Window *w, int widget, int wheel)
int pos = Clamp(sb->pos + wheel, 0, sb->count - sb->cap); int pos = Clamp(sb->pos + wheel, 0, sb->count - sb->cap);
if (pos != sb->pos) { if (pos != sb->pos) {
sb->pos = pos; sb->pos = pos;
SetWindowDirty(w); w->SetDirty();
} }
} }
} }
@ -564,7 +564,7 @@ Window *BringWindowToFrontById(WindowClass cls, WindowNumber number)
if (w != NULL) { if (w != NULL) {
w->flags4 |= WF_WHITE_BORDER_MASK; w->flags4 |= WF_WHITE_BORDER_MASK;
BringWindowToFront(w); BringWindowToFront(w);
SetWindowDirty(w); w->SetDirty();
} }
return w; return w;
@ -602,7 +602,7 @@ static void BringWindowToFront(const Window *w)
memmove(wz, wz + 1, (byte*)vz - (byte*)wz); memmove(wz, wz + 1, (byte*)vz - (byte*)wz);
*vz = tempz; *vz = tempz;
SetWindowDirty(w); w->SetDirty();
} }
/** We have run out of windows, so find a suitable candidate for replacement. /** We have run out of windows, so find a suitable candidate for replacement.
@ -795,7 +795,7 @@ static Window *LocalAllocateWindow(int x, int y, int min_width, int min_height,
w->left = nx; w->left = nx;
w->top = ny; w->top = ny;
SetWindowDirty(w); w->SetDirty();
return w; return w;
} }
@ -1117,7 +1117,7 @@ static void DecreaseWindowCounters()
/* Unclick scrollbar buttons if they are pressed. */ /* Unclick scrollbar buttons if they are pressed. */
if (w->flags4 & (WF_SCROLL_DOWN | WF_SCROLL_UP)) { if (w->flags4 & (WF_SCROLL_DOWN | WF_SCROLL_UP)) {
w->flags4 &= ~(WF_SCROLL_DOWN | WF_SCROLL_UP); w->flags4 &= ~(WF_SCROLL_DOWN | WF_SCROLL_UP);
SetWindowDirty(w); w->SetDirty();
} }
CallWindowEventNP(w, WE_MOUSELOOP); CallWindowEventNP(w, WE_MOUSELOOP);
} }
@ -1259,7 +1259,7 @@ void ResizeWindow(Window *w, int x, int y)
if (x == 0 && y == 0) return; if (x == 0 && y == 0) return;
SetWindowDirty(w); w->SetDirty();
for (wi = w->widget; wi->type != WWT_LAST; wi++) { for (wi = w->widget; wi->type != WWT_LAST; wi++) {
/* Isolate the resizing flags */ /* Isolate the resizing flags */
byte rsizeflag = GB(wi->display_flags, 0, 4); byte rsizeflag = GB(wi->display_flags, 0, 4);
@ -1292,7 +1292,7 @@ void ResizeWindow(Window *w, int x, int y)
if (resize_width) w->width += x; if (resize_width) w->width += x;
if (resize_height) w->height += y; if (resize_height) w->height += y;
SetWindowDirty(w); w->SetDirty();
} }
static bool _dragging_window; static bool _dragging_window;
@ -1321,7 +1321,7 @@ static bool HandleWindowDragging()
break; break;
} }
SetWindowDirty(w); w->SetDirty();
x = _cursor.pos.x + _drag_delta.x; x = _cursor.pos.x + _drag_delta.x;
y = _cursor.pos.y + _drag_delta.y; y = _cursor.pos.y + _drag_delta.y;
@ -1442,7 +1442,7 @@ static bool HandleWindowDragging()
w->left = nx; w->left = nx;
w->top = ny; w->top = ny;
SetWindowDirty(w); w->SetDirty();
return false; return false;
} else if (w->flags4 & WF_SIZING) { } else if (w->flags4 & WF_SIZING) {
WindowEvent e; WindowEvent e;
@ -1451,7 +1451,7 @@ static bool HandleWindowDragging()
/* Stop the sizing if the left mouse button was released */ /* Stop the sizing if the left mouse button was released */
if (!_left_button_down) { if (!_left_button_down) {
w->flags4 &= ~WF_SIZING; w->flags4 &= ~WF_SIZING;
SetWindowDirty(w); w->SetDirty();
break; break;
} }
@ -1547,7 +1547,7 @@ static bool HandleScrollbarScrolling()
/* Abort if no button is clicked any more. */ /* Abort if no button is clicked any more. */
if (!_left_button_down) { if (!_left_button_down) {
w->flags4 &= ~WF_SCROLL_MIDDLE; w->flags4 &= ~WF_SCROLL_MIDDLE;
SetWindowDirty(w); w->SetDirty();
break; break;
} }
@ -1566,7 +1566,7 @@ static bool HandleScrollbarScrolling()
pos = min(max(0, i + _scrollbar_start_pos) * sb->count / _scrollbar_size, max(0, sb->count - sb->cap)); pos = min(max(0, i + _scrollbar_start_pos) * sb->count / _scrollbar_size, max(0, sb->count - sb->cap));
if (pos != sb->pos) { if (pos != sb->pos) {
sb->pos = pos; sb->pos = pos;
SetWindowDirty(w); w->SetDirty();
} }
return false; return false;
} }
@ -1652,7 +1652,7 @@ static bool MaybeBringWindowToFront(const Window *w)
/* A modal child will prevent the activation of the parent window */ /* A modal child will prevent the activation of the parent window */
if (u->parent == w && (u->desc_flags & WDF_MODAL)) { if (u->parent == w && (u->desc_flags & WDF_MODAL)) {
u->flags4 |= WF_WHITE_BORDER_MASK; u->flags4 |= WF_WHITE_BORDER_MASK;
SetWindowDirty(u); u->SetDirty();
return false; return false;
} }
@ -2059,7 +2059,7 @@ void UpdateWindows()
if (w->flags4 & WF_WHITE_BORDER_MASK) { if (w->flags4 & WF_WHITE_BORDER_MASK) {
w->flags4 -= WF_WHITE_BORDER_ONE; w->flags4 -= WF_WHITE_BORDER_ONE;
if (!(w->flags4 & WF_WHITE_BORDER_MASK)) SetWindowDirty(w); if (!(w->flags4 & WF_WHITE_BORDER_MASK)) w->SetDirty();
} }
} }
@ -2105,7 +2105,7 @@ void InvalidateWindow(WindowClass cls, WindowNumber number)
FOR_ALL_WINDOWS(wz) { FOR_ALL_WINDOWS(wz) {
const Window *w = *wz; const Window *w = *wz;
if (w->window_class == cls && w->window_number == number) SetWindowDirty(w); if (w->window_class == cls && w->window_number == number) w->SetDirty();
} }
} }
@ -2136,7 +2136,7 @@ void InvalidateWindowClasses(WindowClass cls)
Window* const *wz; Window* const *wz;
FOR_ALL_WINDOWS(wz) { FOR_ALL_WINDOWS(wz) {
if ((*wz)->window_class == cls) SetWindowDirty(*wz); if ((*wz)->window_class == cls) (*wz)->SetDirty();
} }
} }
@ -2147,7 +2147,7 @@ void InvalidateWindowClasses(WindowClass cls)
void InvalidateThisWindowData(Window *w) void InvalidateThisWindowData(Window *w)
{ {
CallWindowEventNP(w, WE_INVALIDATE_DATA); CallWindowEventNP(w, WE_INVALIDATE_DATA);
SetWindowDirty(w); w->SetDirty();
} }
/** /**