diff options
author | rubidium <rubidium@openttd.org> | 2008-05-06 22:08:18 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2008-05-06 22:08:18 +0000 |
commit | 9bf519f26bc9b3e174803c8ebfd2427bf7c5fb61 (patch) | |
tree | 6760a7b433eda594e11470ba7695e8c399fadbfd /src | |
parent | e6c944a6c4507ec00948391d1b0bdf300bbd879e (diff) | |
download | openttd-9bf519f26bc9b3e174803c8ebfd2427bf7c5fb61.tar.xz |
(svn r12976) -Codechange: use w->SetDirty() instead of SetWindowDirty(w) when it's certain that w != NULL.
Diffstat (limited to 'src')
34 files changed, 241 insertions, 246 deletions
diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp index 046ccb1af..d14eb8c71 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -205,9 +205,9 @@ static void BuildAirportPickerWndProc(Window *w, WindowEvent *e) int text_end = DrawStationCoverageAreaText(2, 206, SCT_ALL, rad, false); text_end = DrawStationCoverageAreaText(2, text_end + 4, SCT_ALL, rad, true) + 4; if (text_end != w->widget[BAW_BOTTOMPANEL].bottom) { - SetWindowDirty(w); + w->SetDirty(); ResizeWindowForWidget(w, BAW_BOTTOMPANEL, 0, text_end - w->widget[BAW_BOTTOMPANEL].bottom); - SetWindowDirty(w); + w->SetDirty(); } break; } @@ -221,7 +221,7 @@ static void BuildAirportPickerWndProc(Window *w, WindowEvent *e) _selected_airport_type = e->we.click.widget - BAW_SMALL_AIRPORT; w->LowerWidget(_selected_airport_type + BAW_SMALL_AIRPORT); SndPlayFx(SND_15_BEEP); - SetWindowDirty(w); + w->SetDirty(); break; 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_DOHILIGHT, _station_show_coverage); SndPlayFx(SND_15_BEEP); - SetWindowDirty(w); + w->SetDirty(); break; } } break; diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp index 0a0eaf805..1c7cfb000 100644 --- a/src/autoreplace_gui.cpp +++ b/src/autoreplace_gui.cpp @@ -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]); 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); - 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).update_left = true; WP(w, replaceveh_d).init_lists = true; - SetWindowDirty(w); + w->SetDirty(); break; 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).init_lists = true; } - SetWindowDirty(w); + w->SetDirty(); } break; } @@ -441,7 +441,7 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e) WP(w, replaceveh_d).update_left = true; WP(w, replaceveh_d).update_right = true; WP(w, replaceveh_d).init_lists = true; - SetWindowDirty(w); + w->SetDirty(); } break; case WE_RESIZE: @@ -472,7 +472,7 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e) case WE_INVALIDATE_DATA: if (_rebuild_left_list) WP(w, replaceveh_d).update_left = true; if (_rebuild_right_list) WP(w, replaceveh_d).update_right = true; - SetWindowDirty(w); + w->SetDirty(); break; case WE_DESTROY: diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index 2361a6ddc..66aeffeac 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -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); if (text_end > wi->bottom) { - SetWindowDirty(w); + w->SetDirty(); 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; _last_sort_order[bv->vehicle_type] = bv->descending_sort_order; bv->regenerate_list = true; - SetWindowDirty(w); + w->SetDirty(); break; 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 num_items = EngList_Count(&bv->eng_list); bv->sel_engine = (i < num_items) ? bv->eng_list[i] : INVALID_ENGINE; - SetWindowDirty(w); + w->SetDirty(); break; } @@ -1108,7 +1108,7 @@ static void NewVehicleWndProc(Window *w, WindowEvent *e) case WE_INVALIDATE_DATA: bv->regenerate_list = true; - SetWindowDirty(w); + w->SetDirty(); break; case WE_DESTROY: @@ -1157,7 +1157,7 @@ static void NewVehicleWndProc(Window *w, WindowEvent *e) _last_sort_criteria[bv->vehicle_type] = bv->sort_criteria; bv->regenerate_list = true; } - SetWindowDirty(w); + w->SetDirty(); break; case WE_RESIZE: diff --git a/src/cheat_gui.cpp b/src/cheat_gui.cpp index 578ae7ef5..65fdb889d 100644 --- a/src/cheat_gui.cpp +++ b/src/cheat_gui.cpp @@ -207,12 +207,12 @@ static void CheatsWndProc(Window *w, WindowEvent *e) w->flags4 |= 5 << WF_TIMEOUT_SHL; - SetWindowDirty(w); + w->SetDirty(); } break; case WE_TIMEOUT: WP(w, def_d).data_1 = 0; - SetWindowDirty(w); + w->SetDirty(); break; } } diff --git a/src/console.cpp b/src/console.cpp index 96b309997..db2902690 100644 --- a/src/console.cpp +++ b/src/console.cpp @@ -107,8 +107,7 @@ static void IConsoleWndProc(Window *w, WindowEvent *e) break; } case WE_MOUSELOOP: - if (HandleCaret(&_iconsole_cmdline)) - SetWindowDirty(w); + if (HandleCaret(&_iconsole_cmdline)) w->SetDirty(); break; case WE_DESTROY: _iconsole_mode = ICONSOLE_CLOSED; @@ -118,11 +117,11 @@ static void IConsoleWndProc(Window *w, WindowEvent *e) switch (e->we.keypress.keycode) { case WKC_UP: IConsoleHistoryNavigate(+1); - SetWindowDirty(w); + w->SetDirty(); break; case WKC_DOWN: IConsoleHistoryNavigate(-1); - SetWindowDirty(w); + w->SetDirty(); break; case WKC_SHIFT | WKC_PAGEUP: if (iconsole_scroll - (w->height / ICON_LINE_HEIGHT) - 1 < 0) { @@ -130,7 +129,7 @@ static void IConsoleWndProc(Window *w, WindowEvent *e) } else { iconsole_scroll -= (w->height / ICON_LINE_HEIGHT) - 1; } - SetWindowDirty(w); + w->SetDirty(); break; case WKC_SHIFT | WKC_PAGEDOWN: if (iconsole_scroll + (w->height / ICON_LINE_HEIGHT) - 1 > ICON_BUFFER) { @@ -138,7 +137,7 @@ static void IConsoleWndProc(Window *w, WindowEvent *e) } else { iconsole_scroll += (w->height / ICON_LINE_HEIGHT) - 1; } - SetWindowDirty(w); + w->SetDirty(); break; case WKC_SHIFT | WKC_UP: if (iconsole_scroll <= 0) { @@ -146,7 +145,7 @@ static void IConsoleWndProc(Window *w, WindowEvent *e) } else { --iconsole_scroll; } - SetWindowDirty(w); + w->SetDirty(); break; case WKC_SHIFT | WKC_DOWN: if (iconsole_scroll >= ICON_BUFFER) { @@ -154,7 +153,7 @@ static void IConsoleWndProc(Window *w, WindowEvent *e) } else { ++iconsole_scroll; } - SetWindowDirty(w); + w->SetDirty(); break; case WKC_BACKQUOTE: IConsoleSwitch(); @@ -174,7 +173,7 @@ static void IConsoleWndProc(Window *w, WindowEvent *e) case (WKC_CTRL | 'V'): if (InsertTextBufferClipboard(&_iconsole_cmdline)) { IConsoleResetHistoryPos(); - SetWindowDirty(w); + w->SetDirty(); } break; case (WKC_CTRL | 'L'): @@ -182,18 +181,18 @@ static void IConsoleWndProc(Window *w, WindowEvent *e) break; case (WKC_CTRL | 'U'): DeleteTextBufferAll(&_iconsole_cmdline); - SetWindowDirty(w); + w->SetDirty(); break; case WKC_BACKSPACE: case WKC_DELETE: if (DeleteTextBufferChar(&_iconsole_cmdline, e->we.keypress.keycode)) { IConsoleResetHistoryPos(); - SetWindowDirty(w); + w->SetDirty(); } break; case WKC_LEFT: case WKC_RIGHT: case WKC_END: case WKC_HOME: if (MoveTextBufferPos(&_iconsole_cmdline, e->we.keypress.keycode)) { IConsoleResetHistoryPos(); - SetWindowDirty(w); + w->SetDirty(); } break; default: @@ -201,7 +200,7 @@ static void IConsoleWndProc(Window *w, WindowEvent *e) iconsole_scroll = ICON_BUFFER; InsertTextBufferChar(&_iconsole_cmdline, e->we.keypress.key); IConsoleResetHistoryPos(); - SetWindowDirty(w); + w->SetDirty(); } else { e->we.keypress.cont = true; } diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp index 376acf0ea..8021aa303 100644 --- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -440,7 +440,7 @@ static void DepotClick(Window *w, int x, int y) int image = v->GetImage(DIR_W); WP(w, depot_d).sel = v->index; - SetWindowDirty(w); + w->SetDirty(); SetObjectToPlaceWnd(image, GetVehiclePalette(v), VHM_DRAG, w); _cursor.vehchain = _ctrl_pressed; } @@ -903,7 +903,7 @@ static void DepotWndProc(Window *w, WindowEvent *e) VehicleID sel = WP(w, depot_d).sel; WP(w, depot_d).sel = INVALID_VEHICLE; - SetWindowDirty(w); + w->SetDirty(); if (WP(w, depot_d).type == VEH_TRAIN) { GetDepotVehiclePtData gdvp; @@ -940,7 +940,7 @@ static void DepotWndProc(Window *w, WindowEvent *e) v = GetVehicle(WP(w, depot_d).sel); 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; @@ -964,7 +964,7 @@ static void DepotWndProc(Window *w, WindowEvent *e) break; default: WP(w, depot_d).sel = INVALID_VEHICLE; - SetWindowDirty(w); + w->SetDirty(); } _cursor.vehchain = false; break; diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index 0d72eeb90..05a1858bc 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -257,9 +257,9 @@ static void BuildDockStationWndProc(Window *w, WindowEvent *e) int text_end = DrawStationCoverageAreaText(4, 50, SCT_ALL, rad, false); text_end = DrawStationCoverageAreaText(4, text_end + 4, SCT_ALL, rad, true) + 4; if (text_end != w->widget[2].bottom) { - SetWindowDirty(w); + w->SetDirty(); ResizeWindowForWidget(w, 2, 0, text_end - w->widget[2].bottom); - SetWindowDirty(w); + w->SetDirty(); } break; @@ -273,7 +273,7 @@ static void BuildDockStationWndProc(Window *w, WindowEvent *e) _station_show_coverage = (e->we.click.widget != 3); w->LowerWidget(_station_show_coverage + 3); SndPlayFx(SND_15_BEEP); - SetWindowDirty(w); + w->SetDirty(); break; } break; @@ -348,7 +348,7 @@ static void BuildDocksDepotWndProc(Window *w, WindowEvent *e) w->LowerWidget(_ship_depot_direction + 3); SndPlayFx(SND_15_BEEP); UpdateDocksDirection(); - SetWindowDirty(w); + w->SetDirty(); break; } } break; diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp index 59781f73b..824e572ee 100644 --- a/src/genworld_gui.cpp +++ b/src/genworld_gui.cpp @@ -372,7 +372,7 @@ static void GenerateLandscapeWndProc(Window *w, WindowEvent *e) _patches_newgame.generation_seed = InteractiveRandom(); snprintf(_genseed_buffer, lengthof(_genseed_buffer), "%u", _patches_newgame.generation_seed); UpdateTextBufferSize(&_genseed_query.text); - SetWindowDirty(w); + w->SetDirty(); break; 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 */ if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) { 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); } @@ -426,7 +426,7 @@ static void GenerateLandscapeWndProc(Window *w, WindowEvent *e) /* Don't allow too fast scrolling */ if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) { 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); } @@ -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); break; } - SetWindowDirty(w); + w->SetDirty(); break; case WE_ON_EDIT_TEXT: @@ -539,7 +539,7 @@ static void GenerateLandscapeWndProc(Window *w, WindowEvent *e) break; } - SetWindowDirty(w); + w->SetDirty(); } break; } @@ -697,7 +697,7 @@ static void CreateScenarioWndProc(Window *w, WindowEvent *e) /* Don't allow too fast scrolling */ if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) { 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); } @@ -715,7 +715,7 @@ static void CreateScenarioWndProc(Window *w, WindowEvent *e) /* Don't allow too fast scrolling */ if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) { 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); } @@ -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_Y_PULLDOWN: _patches_newgame.map_y = e->we.dropdown.index; break; } - SetWindowDirty(w); + w->SetDirty(); break; case WE_ON_EDIT_TEXT: @@ -754,7 +754,7 @@ static void CreateScenarioWndProc(Window *w, WindowEvent *e) break; } - SetWindowDirty(w); + w->SetDirty(); } break; } @@ -865,7 +865,7 @@ static void ShowTerrainProgressProc(Window* w, WindowEvent* e) SetDParam(1, _tp.total); DrawStringCentered(90, 58, STR_GENERATION_PROGRESS, TC_FROMSTRING); - SetWindowDirty(w); + w->SetDirty(); break; } } diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp index ee3c4dfaa..bce14576b 100644 --- a/src/graph_gui.cpp +++ b/src/graph_gui.cpp @@ -304,7 +304,7 @@ static void GraphLegendWndProc(Window *w, WindowEvent *e) ToggleBit(_legend_excluded_players, e->we.click.widget - 3); w->ToggleWidgetLoweredState(e->we.click.widget); - SetWindowDirty(w); + w->SetDirty(); InvalidateWindow(WC_INCOME_GRAPH, 0); InvalidateWindow(WC_OPERATING_PROFIT, 0); InvalidateWindow(WC_DELIVERED_CARGO, 0); @@ -783,7 +783,7 @@ static void CargoPaymentRatesWndProc(Window *w, WindowEvent *e) if (e->we.click.widget >= 3) { ToggleBit(_legend_excluded_cargo, e->we.click.widget - 3); w->ToggleWidgetLoweredState(e->we.click.widget); - SetWindowDirty(w); + w->SetDirty(); } break; } @@ -840,7 +840,7 @@ void ShowCargoPaymentRates() 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. */ w->RaiseWidget(_performance_rating_detail_player + 13); w->DisableWidget(_performance_rating_detail_player + 13); - SetWindowDirty(w); + w->SetDirty(); _performance_rating_detail_player = INVALID_PLAYER; } @@ -964,7 +964,7 @@ static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e) if (GetPlayer(i)->is_active) { /* Lower the widget corresponding to this player. */ w->LowerWidget(i + 13); - SetWindowDirty(w); + w->SetDirty(); _performance_rating_detail_player = i; break; @@ -984,7 +984,7 @@ static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e) w->DisableWidget(i + 13); /* We need a repaint */ - SetWindowDirty(w); + w->SetDirty(); } continue; } @@ -994,7 +994,7 @@ static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e) /* New player! Yippie :p */ w->EnableWidget(i + 13); /* We need a repaint */ - SetWindowDirty(w); + w->SetDirty(); } 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); _performance_rating_detail_player = (PlayerID)(e->we.click.widget - 13); w->LowerWidget(_performance_rating_detail_player + 13); - SetWindowDirty(w); + w->SetDirty(); } } break; @@ -1099,7 +1099,7 @@ static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e) w->custom[1] = 5; if (_performance_rating_detail_player != INVALID_PLAYER) w->LowerWidget(_performance_rating_detail_player + 13); - SetWindowDirty(w); + w->SetDirty(); break; } @@ -1118,7 +1118,7 @@ static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e) /* Skip if player is not active */ if (p2->is_active) UpdateCompanyRatingAndValue(p2, false); } - SetWindowDirty(w); + w->SetDirty(); } } diff --git a/src/group_gui.cpp b/src/group_gui.cpp index 1d961b4da..066dbe617 100644 --- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -317,7 +317,7 @@ static void GroupWndProc(Window *w, WindowEvent *e) gv->group_sel = ALL_GROUP; HideDropDownMenu(w); } - SetWindowDirty(w); + w->SetDirty(); break; case WE_CREATE: @@ -519,7 +519,7 @@ static void GroupWndProc(Window *w, WindowEvent *e) gv->l.flags |= VL_RESORT; gv->_sorting->order = !!(gv->l.flags & VL_DESC); - SetWindowDirty(w); + w->SetDirty(); break; 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)) { gv->group_sel = ALL_GROUP; gv->l.flags |= VL_REBUILD; - SetWindowDirty(w); + w->SetDirty(); } break; @@ -538,7 +538,7 @@ static void GroupWndProc(Window *w, WindowEvent *e) if (!IsDefaultGroupID(gv->group_sel)) { gv->group_sel = DEFAULT_GROUP; gv->l.flags |= VL_REBUILD; - SetWindowDirty(w); + w->SetDirty(); } break; @@ -554,7 +554,7 @@ static void GroupWndProc(Window *w, WindowEvent *e) gv->group_sel = gl->sort_list[id_g]->index;; gv->l.flags |= VL_REBUILD; - SetWindowDirty(w); + w->SetDirty(); break; } @@ -577,7 +577,7 @@ static void GroupWndProc(Window *w, WindowEvent *e) _cursor.vehchain = true; } - SetWindowDirty(w); + w->SetDirty(); break; } @@ -640,7 +640,7 @@ static void GroupWndProc(Window *w, WindowEvent *e) gv->vehicle_sel = INVALID_VEHICLE; - SetWindowDirty(w); + w->SetDirty(); break; @@ -650,7 +650,7 @@ static void GroupWndProc(Window *w, WindowEvent *e) gv->vehicle_sel = INVALID_VEHICLE; - SetWindowDirty(w); + w->SetDirty(); if (id_g >= w->vscroll.cap) return; @@ -670,7 +670,7 @@ static void GroupWndProc(Window *w, WindowEvent *e) gv->vehicle_sel = INVALID_VEHICLE; - SetWindowDirty(w); + w->SetDirty(); 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(); } - SetWindowDirty(w); + w->SetDirty(); break; @@ -767,12 +767,12 @@ static void GroupWndProc(Window *w, WindowEvent *e) if (--gv->l.resort_timer == 0) { gv->l.resort_timer = DAY_TICKS * PERIODIC_RESORT_DAYS; gv->l.flags |= VL_RESORT; - SetWindowDirty(w); + w->SetDirty(); } if (--gl->l.resort_timer == 0) { gl->l.resort_timer = DAY_TICKS * PERIODIC_RESORT_DAYS; gl->l.flags |= VL_RESORT; - SetWindowDirty(w); + w->SetDirty(); } break; diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index 9e281e7d8..d84f766ae 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -269,7 +269,7 @@ static void BuildDynamicIndustryWndProc(Window *w, WindowEvent *e) 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); - SetWindowDirty(w); + w->SetDirty(); if ((_game_mode != GM_EDITOR && _patches.raw_industry_construction == 2 && indsp != NULL && indsp->IsRawIndustry()) || 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. */ if (call_back_result != _fund_gui.enabled[WP(w, fnd_d).index]) { _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) { - SetWindowDirty(w); + w->SetDirty(); ResizeWindowForWidget(w, IVW_INFO, 0, y - w->widget[IVW_INFO].top); - SetWindowDirty(w); + w->SetDirty(); return; } @@ -560,7 +560,7 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e) } UpdateIndustryProduction(i); - SetWindowDirty(w); + w->SetDirty(); w->flags4 |= 5 << WF_TIMEOUT_SHL; WP(w, indview_d).clicked_line = line + 1; WP(w, indview_d).clicked_button = (x < 15 ? 1 : 2); @@ -587,7 +587,7 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e) case WE_TIMEOUT: WP(w, indview_d).clicked_line = 0; WP(w, indview_d).clicked_button = 0; - SetWindowDirty(w); + w->SetDirty(); break; 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); UpdateIndustryProduction(i); - SetWindowDirty(w); + w->SetDirty(); } } } @@ -842,25 +842,25 @@ static void IndustryDirectoryWndProc(Window *w, WindowEvent *e) case IDW_SORTBYNAME: { _industry_sort_order = _industry_sort_order == 0 ? 1 : 0; _industry_sort_dirty = true; - SetWindowDirty(w); + w->SetDirty(); } break; case IDW_SORTBYTYPE: { _industry_sort_order = _industry_sort_order == 2 ? 3 : 2; _industry_sort_dirty = true; - SetWindowDirty(w); + w->SetDirty(); } break; case IDW_SORTBYPROD: { _industry_sort_order = _industry_sort_order == 4 ? 5 : 4; _industry_sort_dirty = true; - SetWindowDirty(w); + w->SetDirty(); } break; case IDW_SORTBYTRANSPORT: { _industry_sort_order = _industry_sort_order == 6 ? 7 : 6; _industry_sort_dirty = true; - SetWindowDirty(w); + w->SetDirty(); } break; case IDW_INDUSRTY_LIST: { @@ -881,7 +881,7 @@ static void IndustryDirectoryWndProc(Window *w, WindowEvent *e) break; case WE_4: - SetWindowDirty(w); + w->SetDirty(); break; case WE_RESIZE: @@ -907,6 +907,6 @@ void ShowIndustryDirectory() w->vscroll.cap = 16; w->resize.height = w->height - 6 * 10; // minimum 10 items w->resize.step_height = 10; - SetWindowDirty(w); + w->SetDirty(); } } diff --git a/src/main_gui.cpp b/src/main_gui.cpp index c006087d1..33a42f01b 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -103,7 +103,7 @@ bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, ViewportHighl if (w->IsWidgetDisabled(widget)) return false; SndPlayFx(SND_15_BEEP); - SetWindowDirty(w); + w->SetDirty(); if (w->IsWidgetLowered(widget)) { ResetObjectToPlace(); @@ -187,7 +187,7 @@ bool DoZoomInOutWindow(int how, Window *w) vp->virtual_left = WP(w, vp_d).scrollpos_x; 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 */ SendWindowMessageClass(w->window_class, how, w->window_number, 0); return true; diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index abe07ab1a..8330b5266 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -291,7 +291,7 @@ static void AboutWindowProc(Window *w, WindowEvent *e) if (--WP(w, scroller_d).counter == 0) { WP(w, scroller_d).counter = 5; WP(w, scroller_d).height--; - SetWindowDirty(w); + w->SetDirty(); } break; } @@ -1547,19 +1547,19 @@ static void SaveLoadDlgWndProc(Window *w, WindowEvent *e) _savegame_sort_order = (_savegame_sort_order == SORT_BY_NAME) ? SORT_BY_NAME | SORT_DESCENDING : SORT_BY_NAME; _savegame_sort_dirty = true; - SetWindowDirty(w); + w->SetDirty(); break; case 3: // Sort save names by date _savegame_sort_order = (_savegame_sort_order == SORT_BY_DATE) ? SORT_BY_DATE | SORT_DESCENDING : SORT_BY_DATE; _savegame_sort_dirty = true; - SetWindowDirty(w); + w->SetDirty(); break; case 6: // OpenTTD 'button', jumps to OpenTTD directory FiosBrowseTo(&o_dir); - SetWindowDirty(w); + w->SetDirty(); BuildFileList(); break; @@ -1597,7 +1597,7 @@ static void SaveLoadDlgWndProc(Window *w, WindowEvent *e) } } else { /* Changed directory, need repaint. */ - SetWindowDirty(w); + w->SetDirty(); BuildFileList(); } break; @@ -1645,7 +1645,7 @@ static void SaveLoadDlgWndProc(Window *w, WindowEvent *e) } UpdateTextBufferSize(&WP(w, querystr_d).text); - SetWindowDirty(w); + w->SetDirty(); } else if (w->IsWidgetLowered(12)) { // Save button clicked _switch_mode = SM_SAVE; FiosMakeSavegameName(_file_to_saveload.name, WP(w, querystr_d).text.buf, sizeof(_file_to_saveload.name)); diff --git a/src/music_gui.cpp b/src/music_gui.cpp index cbb402cc5..59234dc79 100644 --- a/src/music_gui.cpp +++ b/src/music_gui.cpp @@ -256,7 +256,7 @@ static void MusicTrackSelectionWndProc(Window *w, WindowEvent *e) if (p[i] == 0) { p[i] = y + 1; p[i + 1] = 0; - SetWindowDirty(w); + w->SetDirty(); SelectSongToPlay(); break; } @@ -276,13 +276,13 @@ static void MusicTrackSelectionWndProc(Window *w, WindowEvent *e) p[i] = p[i + 1]; } - SetWindowDirty(w); + w->SetDirty(); SelectSongToPlay(); } break; case 11: // clear _playlists[msf.playlist][0] = 0; - SetWindowDirty(w); + w->SetDirty(); StopMusic(); SelectSongToPlay(); 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 */ msf.playlist = e->we.click.widget - 5; - SetWindowDirty(w); + w->SetDirty(); InvalidateWindow(WC_MUSIC_WINDOW, 0); StopMusic(); SelectSongToPlay(); @@ -440,7 +440,7 @@ static void MusicWindowWndProc(Window *w, WindowEvent *e) *vol = new_vol; if (vol == &msf.music_vol) MusicVolumeChanged(new_vol); - SetWindowDirty(w); + w->SetDirty(); } _left_button_clicked = false; @@ -455,7 +455,7 @@ static void MusicWindowWndProc(Window *w, WindowEvent *e) break; case 12: case 13: case 14: case 15: case 16: case 17: // playlist msf.playlist = e->we.click.widget - 12; - SetWindowDirty(w); + w->SetDirty(); InvalidateWindow(WC_MUSIC_TRACK_SELECTION, 0); StopMusic(); SelectSongToPlay(); diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index 3438a2ad8..2d7926cbd 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -182,7 +182,7 @@ static void NewGRFAddDlgWndProc(Window *w, WindowEvent *e) for (c = _all_grfs; c != NULL && i > 0; c = c->next, i--) {} WP(w, newgrf_add_d).sel = c; - SetWindowDirty(w); + w->SetDirty(); break; } @@ -218,7 +218,7 @@ static void NewGRFAddDlgWndProc(Window *w, WindowEvent *e) case ANGRFW_RESCAN: // Rescan list WP(w, newgrf_add_d).sel = NULL; ScanNewGRFFiles(); - SetWindowDirty(w); + w->SetDirty(); 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--) {} nd->sel = c; - SetWindowDirty(w); + w->SetDirty(); } } @@ -435,7 +435,7 @@ static void NewGRFWndProc(Window *w, WindowEvent *e) WP(w, newgrf_d).sel = newsel; SetupNewGRFWindow(w); - SetWindowDirty(w); + w->SetDirty(); break; } @@ -451,7 +451,7 @@ static void NewGRFWndProc(Window *w, WindowEvent *e) break; } } - SetWindowDirty(w); + w->SetDirty(); break; } @@ -467,7 +467,7 @@ static void NewGRFWndProc(Window *w, WindowEvent *e) break; } } - SetWindowDirty(w); + w->SetDirty(); 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--) {} WP(w, newgrf_d).sel = c; - SetWindowDirty(w); + w->SetDirty(); break; } @@ -517,7 +517,7 @@ static void NewGRFWndProc(Window *w, WindowEvent *e) /* parse_intlist returns -1 on error */ if (c->num_params == (byte)-1) c->num_params = 0; } - SetWindowDirty(w); + w->SetDirty(); break; case WE_DESTROY: diff --git a/src/news_gui.cpp b/src/news_gui.cpp index 5f1b9a86b..f67e8667f 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -345,7 +345,7 @@ void AddNewsItem(StringID string, NewsMode display_mode, NewsFlag flags, NewsTyp Window *w = FindWindowById(WC_MESSAGE_HISTORY, 0); if (w == NULL) return; - SetWindowDirty(w); + w->SetDirty(); w->vscroll.count = _total_news; } @@ -520,7 +520,7 @@ static void MoveToNextItem() if (w != NULL) { WP(w, def_d).data_2 = 91; - SetWindowDirty(w); + w->SetDirty(); } 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.step_width = 1; 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); _news_type_data[element].display = (NewsDisplay)val; - SetWindowDirty(w); + w->SetDirty(); } break; } @@ -823,7 +823,7 @@ static void MessageOptionsWndProc(Window *w, WindowEvent *e) SetMessageButtonStates(w, e->we.dropdown.index, i); _news_type_data[i].display = (NewsDisplay)e->we.dropdown.index; } - SetWindowDirty(w); + w->SetDirty(); break; } } @@ -990,7 +990,7 @@ void DeleteVehicleNews(VehicleID vid, StringID news) Window *w = FindWindowById(WC_MESSAGE_HISTORY, 0); if (w != NULL) { - SetWindowDirty(w); + w->SetDirty(); w->vscroll.count = _total_news; } } diff --git a/src/order_gui.cpp b/src/order_gui.cpp index e85c14229..0df7079c0 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -799,7 +799,7 @@ static void OrdersWndProc(Window *w, WindowEvent *e) /* This was a click on an empty part of the orders window, so * deselect the currently selected order. */ WP(w, order_d).sel = -1; - SetWindowDirty(w); + w->SetDirty(); return; } @@ -831,7 +831,7 @@ static void OrdersWndProc(Window *w, WindowEvent *e) } } - SetWindowDirty(w); + w->SetDirty(); } break; case ORDER_WIDGET_SKIP: diff --git a/src/osk_gui.cpp b/src/osk_gui.cpp index 290e377b2..1bc3a2738 100644 --- a/src/osk_gui.cpp +++ b/src/osk_gui.cpp @@ -113,7 +113,7 @@ static void OskWndProc(Window *w, WindowEvent *e) if (HasBit(_keystate, KEYS_SHIFT)) { ToggleBit(_keystate, KEYS_SHIFT); w->widget[OSK_WIDGET_SHIFT].color = HasBit(_keystate, KEYS_SHIFT) ? 15 : 14; - SetWindowDirty(w); + w->SetDirty(); } break; } @@ -133,12 +133,12 @@ static void OskWndProc(Window *w, WindowEvent *e) case OSK_WIDGET_CAPS: ToggleBit(_keystate, KEYS_CAPS); - SetWindowDirty(w); + w->SetDirty(); break; case OSK_WIDGET_SHIFT: ToggleBit(_keystate, KEYS_SHIFT); - SetWindowDirty(w); + w->SetDirty(); break; case OSK_WIDGET_SPACE: diff --git a/src/player_gui.cpp b/src/player_gui.cpp index dd7c6298e..8af5c2bb4 100644 --- a/src/player_gui.cpp +++ b/src/player_gui.cpp @@ -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); if (w->height != new_height) { /* Make window dirty before and after resizing */ - SetWindowDirty(w); + w->SetDirty(); w->height = new_height; - SetWindowDirty(w); + w->SetDirty(); w->SetWidgetHiddenState(PFW_WIDGET_INCREASE_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 { WP(w, livery_d).sel = 1 << j; } - SetWindowDirty(w); + w->SetDirty(); break; } } @@ -892,7 +892,7 @@ static void SelectPlayerFaceWndProc(Window *w, WindowEvent *e) *pf = _player_face; ScaleAllPlayerFaceBits(*pf); ShowErrorMessage(INVALID_STRING_ID, STR_FACE_LOAD_DONE, 0, 0); - SetWindowDirty(w); + w->SetDirty(); break; /* '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: SetPlayerFaceBits(*pf, PFV_GENDER, ge, e->we.click.widget - PFW_WIDGET_MALE); ScaleAllPlayerFaceBits(*pf); - SetWindowDirty(w); + w->SetDirty(); break; /* Randomize face button */ case PFW_WIDGET_RANDOM_NEW_FACE: RandomPlayerFaceBits(*pf, ge, WP(w, facesel_d).advanced); - SetWindowDirty(w); + w->SetDirty(); break; /* Toggle ethnicity (european/african) button */ @@ -926,7 +926,7 @@ static void SelectPlayerFaceWndProc(Window *w, WindowEvent *e) case PFW_WIDGET_ETHNICITY_AFR: SetPlayerFaceBits(*pf, PFV_ETHNICITY, ge, e->we.click.widget - PFW_WIDGET_ETHNICITY_EUR); ScaleAllPlayerFaceBits(*pf); - SetWindowDirty(w); + w->SetDirty(); break; 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); } - SetWindowDirty(w); + w->SetDirty(); } break; } @@ -977,7 +977,7 @@ static void SelectPlayerFaceWndProc(Window *w, WindowEvent *e) *pf = strtoul(e->we.edittext.str, NULL, 10); ScaleAllPlayerFaceBits(*pf); ShowErrorMessage(INVALID_STRING_ID, STR_FACE_FACECODE_SET, 0, 0); - SetWindowDirty(w); + w->SetDirty(); } else { ShowErrorMessage(INVALID_STRING_ID, STR_FACE_FACECODE_ERR, 0, 0); } @@ -1304,7 +1304,7 @@ static void PlayerCompanyWndProc(Window *w, WindowEvent *e) case WE_MOUSELOOP: /* redraw the window every now and then */ - if ((++w->vscroll.pos & 0x1F) == 0) SetWindowDirty(w); + if ((++w->vscroll.pos & 0x1F) == 0) w->SetDirty(); break; case WE_PLACE_OBJ: diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index fab382325..5696f8bc1 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -940,9 +940,9 @@ static void StationBuildWndProc(Window *w, WindowEvent *e) int text_end = DrawStationCoverageAreaText(2, 166 + y_offset, SCT_ALL, rad, false); text_end = DrawStationCoverageAreaText(2, text_end + 4, SCT_ALL, rad, true) + 4; if (text_end != w->widget[BRSW_BACKGROUND].bottom) { - SetWindowDirty(w); + w->SetDirty(); ResizeWindowForWidget(w, BRSW_BACKGROUND, 0, text_end - w->widget[BRSW_BACKGROUND].bottom); - SetWindowDirty(w); + w->SetDirty(); } if (newstations) { @@ -974,7 +974,7 @@ static void StationBuildWndProc(Window *w, WindowEvent *e) _railstation.orientation = e->we.click.widget - BRSW_PLATFORM_DIR_X; w->LowerWidget(_railstation.orientation + BRSW_PLATFORM_DIR_X); SndPlayFx(SND_15_BEEP); - SetWindowDirty(w); + w->SetDirty(); break; 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.platlength + BRSW_PLATFORM_LEN_BEGIN); SndPlayFx(SND_15_BEEP); - SetWindowDirty(w); + w->SetDirty(); break; } @@ -1037,7 +1037,7 @@ static void StationBuildWndProc(Window *w, WindowEvent *e) w->LowerWidget(_railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); w->LowerWidget(_railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); SndPlayFx(SND_15_BEEP); - SetWindowDirty(w); + w->SetDirty(); 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.platlength + BRSW_PLATFORM_LEN_BEGIN, !_railstation.dragdrop); SndPlayFx(SND_15_BEEP); - SetWindowDirty(w); + w->SetDirty(); } break; 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_ON, _station_show_coverage); SndPlayFx(SND_15_BEEP); - SetWindowDirty(w); + w->SetDirty(); break; case BRSW_NEWST_DROPDOWN: @@ -1104,7 +1104,7 @@ static void StationBuildWndProc(Window *w, WindowEvent *e) CheckSelectedSize(w, statspec); SndPlayFx(SND_15_BEEP); - SetWindowDirty(w); + w->SetDirty(); break; } } @@ -1123,7 +1123,7 @@ static void StationBuildWndProc(Window *w, WindowEvent *e) } SndPlayFx(SND_15_BEEP); - SetWindowDirty(w); + w->SetDirty(); break; case WE_MOUSELOOP: @@ -1332,23 +1332,21 @@ static void SignalBuildWndProc(Window *w, WindowEvent *e) case BSW_DRAG_SIGNALS_DENSITY_DECREASE: if (_patches.drag_signals_density > 1) { _patches.drag_signals_density--; - const Window *w = FindWindowById(WC_GAME_OPTIONS, 0); - if (w != NULL) SetWindowDirty(w); + SetWindowDirty(FindWindowById(WC_GAME_OPTIONS, 0)); } break; case BSW_DRAG_SIGNALS_DENSITY_INCREASE: if (_patches.drag_signals_density < 20) { _patches.drag_signals_density++; - const Window *w = FindWindowById(WC_GAME_OPTIONS, 0); - if (w != NULL) SetWindowDirty(w); + SetWindowDirty(FindWindowById(WC_GAME_OPTIONS, 0)); } break; default: break; } - SetWindowDirty(w); + w->SetDirty(); break; 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); w->LowerWidget(_build_depot_direction + BRDW_DEPOT_NE); SndPlayFx(SND_15_BEEP); - SetWindowDirty(w); + w->SetDirty(); break; } break; @@ -1534,7 +1532,7 @@ static void BuildWaypointWndProc(Window *w, WindowEvent *e) _cur_waypoint_type = type; SndPlayFx(SND_15_BEEP); - SetWindowDirty(w); + w->SetDirty(); break; } } @@ -1600,7 +1598,7 @@ void ReinitGuiAfterToggleElrail(bool disable) w = FindWindowById(WC_BUILD_TOOLBAR, TRANSPORT_RAIL); if (w != NULL) { SetupRailToolbar(_cur_railtype, w); - SetWindowDirty(w); + w->SetDirty(); } } MarkWholeScreenDirty(); @@ -1651,7 +1649,7 @@ static void SetDefaultRailGui() Window *w = FindWindowById(WC_BUILD_TOOLBAR, TRANSPORT_RAIL); if (w != NULL) { SetupRailToolbar(_cur_railtype, w); - SetWindowDirty(w); + w->SetDirty(); } } @@ -1668,7 +1666,7 @@ int32 ResetSignalVariant(int32 = 0) if (new_variant != _cur_signal_variant) { Window *w = FindWindowById(WC_BUILD_SIGNAL, 0); if (w != NULL) { - SetWindowDirty(w); + w->SetDirty(); w->RaiseWidget((_cur_signal_variant == SIG_ELECTRIC ? BSW_ELECTRIC_NORM : BSW_SEMAPHORE_NORM) + _cur_signal_type); } _cur_signal_variant = new_variant; diff --git a/src/road_gui.cpp b/src/road_gui.cpp index 30400f606..a0e43a6cd 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -352,7 +352,7 @@ static void BuildRoadClick_TruckStation(Window *w) static void BuildRoadClick_OneWay(Window *w) { if (w->IsWidgetDisabled(RTW_ONE_WAY)) return; - SetWindowDirty(w); + w->SetDirty(); w->ToggleWidgetLoweredState(RTW_ONE_WAY); SetSelectionRed(false); } @@ -758,7 +758,7 @@ static void BuildRoadDepotWndProc(Window *w, WindowEvent *e) _road_depot_orientation = (DiagDirection)(e->we.click.widget - BRDW_DEPOT_NE); w->LowerWidget(_road_depot_orientation + BRDW_DEPOT_NE); SndPlayFx(SND_15_BEEP); - SetWindowDirty(w); + w->SetDirty(); break; 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, 3, true) + 4; if (text_end > w->widget[BRSW_BACKGROUND].bottom) { - SetWindowDirty(w); + w->SetDirty(); ResizeWindowForWidget(w, BRSW_BACKGROUND, 0, text_end - w->widget[BRSW_BACKGROUND].bottom); - SetWindowDirty(w); + w->SetDirty(); } } break; @@ -906,7 +906,7 @@ static void RoadStationPickerWndProc(Window *w, WindowEvent *e) _road_station_picker_orientation = (DiagDirection)(e->we.click.widget - BRSW_STATION_NE); w->LowerWidget(_road_station_picker_orientation + BRSW_STATION_NE); SndPlayFx(SND_15_BEEP); - SetWindowDirty(w); + w->SetDirty(); break; 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); w->LowerWidget(_station_show_coverage + BRSW_LT_OFF); SndPlayFx(SND_15_BEEP); - SetWindowDirty(w); + w->SetDirty(); break; default: diff --git a/src/settings.cpp b/src/settings.cpp index 2c800e96d..a9e2ac1fb 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -1211,9 +1211,7 @@ static int32 RealisticAccelerationChanged(int32 p1) static int32 DragSignalsDensityChanged(int32) { - const Window *w = FindWindowById(WC_BUILD_SIGNAL, 0); - - if (w != NULL) SetWindowDirty(w); + SetWindowDirty(FindWindowById(WC_BUILD_SIGNAL, 0)); return 0; } diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index c20caa85f..a857a0461 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -248,7 +248,7 @@ static void GameOptionsWndProc(Window *w, WindowEvent *e) ShowErrorMessage(INVALID_STRING_ID, STR_FULLSCREEN_FAILED, 0, 0); } w->SetWidgetLoweredState(GAMEOPT_FULLSCREEN, _fullscreen); - SetWindowDirty(w); + w->SetDirty(); break; 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 */ _opt.autosave = _opt_newgame.autosave = e->we.dropdown.index; - SetWindowDirty(w); + w->SetDirty(); break; case GAMEOPT_LANG_BTN: /* Change interface language */ @@ -309,12 +309,12 @@ static void GameOptionsWndProc(Window *w, WindowEvent *e) 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])) - SetWindowDirty(w); + w->SetDirty(); break; case GAMEOPT_SCREENSHOT_BTN: /* Change screenshot format */ SetScreenshotFormat(e->we.dropdown.index); - SetWindowDirty(w); + w->SetDirty(); break; } break; @@ -615,7 +615,7 @@ static void GameDifficultyWndProc(Window *w, WindowEvent *e) w->RaiseWidget(GDW_LVL_EASY + _opt_mod_temp.diff_level); SetDifficultyLevel(3, &_opt_mod_temp); // set difficulty level to custom w->LowerWidget(GDW_LVL_CUSTOM); - SetWindowDirty(w); + w->SetDirty(); } break; 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); SetDifficultyLevel(e->we.click.widget - GDW_LVL_EASY, &_opt_mod_temp); w->LowerWidget(GDW_LVL_EASY + _opt_mod_temp.diff_level); - SetWindowDirty(w); + w->SetDirty(); break; case GDW_HIGHSCORE: // Highscore Table @@ -659,7 +659,7 @@ static void GameDifficultyWndProc(Window *w, WindowEvent *e) if (diffic_d->timeout != 0) { diffic_d->timeout--; if (diffic_d->timeout == 0) diffic_d->clicked_button = NO_SETTINGS_BUTTON; - SetWindowDirty(w); + w->SetDirty(); } break; } @@ -1027,7 +1027,7 @@ static void PatchesSelectionWndProc(Window *w, WindowEvent *e) if (value != oldvalue) { SetPatchValue(page->entries[btn].index, patches_ptr, value); - SetWindowDirty(w); + w->SetDirty(); } } else { /* 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; w->LowerWidget(WP(w, def_d).data_1 + PATCHSEL_INTERFACE); DeleteWindowById(WC_QUERY_STRING, 0); - SetWindowDirty(w); + w->SetDirty(); break; } break; case WE_TIMEOUT: WP(w, def_d).data_2 = 0; - SetWindowDirty(w); + w->SetDirty(); break; 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; SetPatchValue(pe->index, patches_ptr, value); - SetWindowDirty(w); + w->SetDirty(); } break; @@ -1267,7 +1267,7 @@ static void CustCurrencyWndProc(Window *w, WindowEvent *e) } w->flags4 |= 5 << WF_TIMEOUT_SHL; - SetWindowDirty(w); + w->SetDirty(); } break; case WE_ON_EDIT_TEXT: { @@ -1303,7 +1303,7 @@ static void CustCurrencyWndProc(Window *w, WindowEvent *e) case WE_TIMEOUT: WP(w, def_d).data_1 = 0; - SetWindowDirty(w); + w->SetDirty(); break; case WE_DESTROY: diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp index e2c8a70c0..35e5a7b4f 100644 --- a/src/smallmap_gui.cpp +++ b/src/smallmap_gui.cpp @@ -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; WP(w, smallmap_d).scroll_x = (y - x) & ~0xF; WP(w, smallmap_d).scroll_y = (x + y) & ~0xF; - SetWindowDirty(w); + w->SetDirty(); } 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_y = pt.y + ((_cursor.pos.y - w->top - 16) << 4) - (w2->viewport->virtual_height >> 1); - SetWindowDirty(w); + w->SetDirty(); } break; 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; w->LowerWidget(_smallmap_type + SM_WIDGET_CONTOUR); - SetWindowDirty(w); + w->SetDirty(); SndPlayFx(SND_15_BEEP); break; case SM_WIDGET_CENTERMAP: // Center the smallmap again SmallMapCenterOnCurrentPos(w); - SetWindowDirty(w); + w->SetDirty(); SndPlayFx(SND_15_BEEP); break; @@ -907,7 +907,7 @@ static void SmallMapWindowProc(Window *w, WindowEvent *e) w->ToggleWidgetLoweredState(SM_WIDGET_TOGGLETOWNNAME); _smallmap_show_towns = w->IsWidgetLowered(SM_WIDGET_TOGGLETOWNNAME); - SetWindowDirty(w); + w->SetDirty(); SndPlayFx(SND_15_BEEP); break; @@ -939,7 +939,7 @@ static void SmallMapWindowProc(Window *w, WindowEvent *e) /* Raise the two buttons "all", as we have done a specific choice */ w->RaiseWidget(SM_WIDGET_ENABLEINDUSTRIES); w->RaiseWidget(SM_WIDGET_DISABLEINDUSTRIES); - SetWindowDirty(w); + w->SetDirty(); } break; @@ -950,7 +950,7 @@ static void SmallMapWindowProc(Window *w, WindowEvent *e) /* toggle appeareance indicating the choice */ w->LowerWidget(SM_WIDGET_ENABLEINDUSTRIES); w->RaiseWidget(SM_WIDGET_DISABLEINDUSTRIES); - SetWindowDirty(w); + w->SetDirty(); break; case SM_WIDGET_DISABLEINDUSTRIES: // disable all industries @@ -960,7 +960,7 @@ static void SmallMapWindowProc(Window *w, WindowEvent *e) /* toggle appeareance indicating the choice */ w->RaiseWidget(SM_WIDGET_ENABLEINDUSTRIES); w->LowerWidget(SM_WIDGET_DISABLEINDUSTRIES); - SetWindowDirty(w); + w->SetDirty(); break; } break; @@ -976,7 +976,7 @@ static void SmallMapWindowProc(Window *w, WindowEvent *e) case WE_MOUSELOOP: /* update the window every now and then */ - if ((++w->vscroll.pos & 0x1F) == 0) SetWindowDirty(w); + if ((++w->vscroll.pos & 0x1F) == 0) w->SetDirty(); break; 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).subscroll = sub; - SetWindowDirty(w); + w->SetDirty(); } break; } } diff --git a/src/station_gui.cpp b/src/station_gui.cpp index 9c3d9d42a..376a234d5 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -195,7 +195,7 @@ static void SetStationListsFlag(StationListFlags sl_flag) Window *w = *wz; if (w->window_class == WC_STATION_LIST) { 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)); sl->flags |= SL_REBUILD; - SetWindowDirty(w); + w->SetDirty(); break; 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; sl->flags |= SL_REBUILD; - SetWindowDirty(w); + w->SetDirty(); break; case SLW_CARGOALL: { @@ -476,7 +476,7 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e) _cargo_filter = _cargo_mask; include_empty = true; sl->flags |= SL_REBUILD; - SetWindowDirty(w); + w->SetDirty(); break; } @@ -486,7 +486,7 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e) sl->flags |= SL_RESORT; w->flags4 |= 5 << WF_TIMEOUT_SHL; w->LowerWidget(SLW_SORTBY); - SetWindowDirty(w); + w->SetDirty(); break; case SLW_SORTDROPBTN: // select sorting criteria dropdown menu @@ -509,7 +509,7 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e) } sl->flags |= SL_REBUILD; w->SetWidgetLoweredState(SLW_CARGOALL, _cargo_filter == _cargo_mask && include_empty); - SetWindowDirty(w); + w->SetDirty(); break; default: @@ -540,7 +540,7 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e) } sl->flags |= SL_REBUILD; w->SetWidgetLoweredState(SLW_CARGOALL, _cargo_filter == _cargo_mask && include_empty); - SetWindowDirty(w); + w->SetDirty(); } break; } @@ -553,7 +553,7 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e) station_sort.criteria = sl->sort_type; sl->flags |= SL_RESORT; } - SetWindowDirty(w); + w->SetDirty(); break; case WE_TICK: @@ -562,13 +562,13 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e) DEBUG(misc, 3, "Periodic rebuild station list player %d", owner); sl->resort_timer = DAY_TICKS * PERIODIC_RESORT_DAYS; sl->flags |= SL_REBUILD; - SetWindowDirty(w); + w->SetDirty(); } break; case WE_TIMEOUT: w->RaiseWidget(SLW_SORTBY); - SetWindowDirty(w); + w->SetDirty(); break; case WE_RESIZE: @@ -949,7 +949,7 @@ static void StationViewWndProc(Window *w, WindowEvent *e) break; case SVW_RATINGS: - SetWindowDirty(w); + w->SetDirty(); if (w->widget[SVW_RATINGS].data == STR_3032_RATINGS) { /* Switch to ratings view */ @@ -963,7 +963,7 @@ static void StationViewWndProc(Window *w, WindowEvent *e) ResizeWindowForWidget(w, SVW_ACCEPTLIST, 0, -100); } - SetWindowDirty(w); + w->SetDirty(); break; case SVW_RENAME: diff --git a/src/statusbar_gui.cpp b/src/statusbar_gui.cpp index 0ae38c803..17bc3a75a 100644 --- a/src/statusbar_gui.cpp +++ b/src/statusbar_gui.cpp @@ -114,7 +114,7 @@ static void StatusBarWndProc(Window *w, WindowEvent *e) case WE_MESSAGE: w->message.msg = e->we.message.msg; - SetWindowDirty(w); + w->SetDirty(); break; case WE_CLICK: diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp index 76da96c3c..2c0def89d 100644 --- a/src/terraform_gui.cpp +++ b/src/terraform_gui.cpp @@ -310,7 +310,7 @@ void ShowTerraformToolbar(Window *link) w->top = 22; link->left = w->left - link->width; - SetWindowDirty(link); + link->SetDirty(); } } @@ -609,7 +609,7 @@ static void ScenEditLandGenWndProc(Window *w, WindowEvent *e) _terraform_size = size; SndPlayFx(SND_15_BEEP); - SetWindowDirty(w); + w->SetDirty(); } break; case 15: // gen random land w->HandleButtonClick(15); @@ -662,7 +662,7 @@ static void ScenEditLandGenWndProc(Window *w, WindowEvent *e) case WE_ABORT_PLACE_OBJ: w->RaiseButtons(); - SetWindowDirty(w); + w->SetDirty(); break; } } diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp index d7eaa8024..8379c7486 100644 --- a/src/timetable_gui.cpp +++ b/src/timetable_gui.cpp @@ -245,7 +245,7 @@ static void TimetableWndProc(Window *w, WindowEvent *we) break; } - SetWindowDirty(w); + w->SetDirty(); } break; case WE_ON_EDIT_TEXT: { diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp index 8323592d6..734de007c 100644 --- a/src/toolbar_gui.cpp +++ b/src/toolbar_gui.cpp @@ -520,7 +520,7 @@ static void ToolbarScenDateBackward(Window *w) /* don't allow too fast scrolling */ if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) { w->HandleButtonClick(6); - SetWindowDirty(w); + w->SetDirty(); _patches_newgame.starting_year = Clamp(_patches_newgame.starting_year - 1, MIN_YEAR, MAX_YEAR); SetDate(ConvertYMDToDate(_patches_newgame.starting_year, 0, 1)); @@ -533,7 +533,7 @@ static void ToolbarScenDateForward(Window *w) /* don't allow too fast scrolling */ if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) { w->HandleButtonClick(7); - SetWindowDirty(w); + w->SetDirty(); _patches_newgame.starting_year = Clamp(_patches_newgame.starting_year + 1, MIN_YEAR, MAX_YEAR); SetDate(ConvertYMDToDate(_patches_newgame.starting_year, 0, 1)); @@ -721,7 +721,7 @@ static void MainToolbarWndProc(Window *w, WindowEvent *e) case WE_ABORT_PLACE_OBJ: w->RaiseWidget(25); - SetWindowDirty(w); + w->SetDirty(); break; case WE_MOUSELOOP: @@ -927,7 +927,7 @@ static void ScenEditToolbarWndProc(Window *w, WindowEvent *e) case WE_ABORT_PLACE_OBJ: w->RaiseWidget(25); - SetWindowDirty(w); + w->SetDirty(); break; case WE_RESIZE: { @@ -999,12 +999,12 @@ static void ScenEditToolbarWndProc(Window *w, WindowEvent *e) case WE_MOUSELOOP: if (w->IsWidgetLowered(0) != !!_pause_game) { w->ToggleWidgetLoweredState(0); - SetWindowDirty(w); + w->SetDirty(); } if (w->IsWidgetLowered(1) != !!_fast_forward) { w->ToggleWidgetLoweredState(1); - SetWindowDirty(w); + w->SetDirty(); } break; @@ -1128,7 +1128,7 @@ static void MenuWndProc(Window *w, WindowEvent *e) case WE_DESTROY: { Window *v = FindWindowById(WC_MAIN_TOOLBAR, 0); v->RaiseWidget(WP(w, menu_d).main_button); - SetWindowDirty(v); + w->SetDirty(); return; } @@ -1157,7 +1157,7 @@ static void MenuWndProc(Window *w, WindowEvent *e) if (index == -1 || index == WP(w, menu_d).sel_index) return; WP(w, menu_d).sel_index = index; - SetWindowDirty(w); + w->SetDirty(); return; } } @@ -1269,12 +1269,12 @@ static void UpdatePlayerMenuHeight(Window *w) if (WP(w, menu_d).item_count != num) { WP(w, menu_d).item_count = num; - SetWindowDirty(w); + w->SetDirty(); num = num * 10 + 2; w->height = num; w->widget[0].bottom = w->widget[0].top + num - 1; 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: { Window *v = FindWindowById(WC_MAIN_TOOLBAR, 0); v->RaiseWidget(WP(w, menu_d).main_button); - SetWindowDirty(v); + w->SetDirty(); return; } @@ -1371,7 +1371,7 @@ static void PlayerMenuWndProc(Window *w, WindowEvent *e) if (index == -1 || index == WP(w, menu_d).sel_index) return; WP(w, menu_d).sel_index = index; - SetWindowDirty(w); + w->SetDirty(); return; } } diff --git a/src/town_gui.cpp b/src/town_gui.cpp index f805bd1ac..3190554d0 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -239,7 +239,7 @@ static void TownAuthorityWndProc(Window *w, WindowEvent *e) y = GetNthSetBit(GetMaskOfTownActions(NULL, _local_player, t), y + w->vscroll.pos - 1); if (y >= 0) { WP(w, def_d).data_1 = y; - SetWindowDirty(w); + w->SetDirty(); } /* Fall through to clicking in case we are double-clicked */ if (e->event != WE_DOUBLE_CLICK || y < 0) break; @@ -252,7 +252,7 @@ static void TownAuthorityWndProc(Window *w, WindowEvent *e) break; case WE_4: - SetWindowDirty(w); + w->SetDirty(); break; } } @@ -523,13 +523,13 @@ static void TownDirectoryWndProc(Window *w, WindowEvent *e) case TDW_SORTNAME: /* Sort by Name ascending/descending */ _town_sort_order = (_town_sort_order == 0) ? 1 : 0; _town_sort_dirty = true; - SetWindowDirty(w); + w->SetDirty(); break; case TDW_SORTPOPULATION: /* Sort by Population ascending/descending */ _town_sort_order = (_town_sort_order == 2) ? 3 : 2; _town_sort_dirty = true; - SetWindowDirty(w); + w->SetDirty(); break; case TDW_CENTERTOWN: { /* Click on Town Matrix */ @@ -555,7 +555,7 @@ static void TownDirectoryWndProc(Window *w, WindowEvent *e) break; case WE_4: - SetWindowDirty(w); + w->SetDirty(); break; case WE_RESIZE: @@ -671,14 +671,14 @@ static void ScenEditTownGenWndProc(Window *w, WindowEvent *e) w->RaiseWidget(_scengen_town_size + TSEW_SMALLTOWN); _scengen_town_size = e->we.click.widget - TSEW_SMALLTOWN; w->LowerWidget(_scengen_town_size + TSEW_SMALLTOWN); - SetWindowDirty(w); + w->SetDirty(); break; } break; case WE_TIMEOUT: w->RaiseWidget(TSEW_RANDOMTOWN); w->RaiseWidget(TSEW_MANYRANDOMTOWNS); - SetWindowDirty(w); + w->SetDirty(); break; case WE_PLACE_OBJ: @@ -688,7 +688,7 @@ static void ScenEditTownGenWndProc(Window *w, WindowEvent *e) case WE_ABORT_PLACE_OBJ: w->RaiseButtons(); w->LowerWidget(_scengen_town_size + TSEW_SMALLTOWN); - SetWindowDirty(w); + w->SetDirty(); break; } } diff --git a/src/transparency_gui.cpp b/src/transparency_gui.cpp index b0e9da16f..eee61bd16 100644 --- a/src/transparency_gui.cpp +++ b/src/transparency_gui.cpp @@ -66,7 +66,7 @@ static void TransparencyToolbWndProc(Window *w, WindowEvent *e) if (_ctrl_pressed) { /* toggle the bit of the transparencies lock variable */ ToggleTransparencyLock((TransparencyOption)(e->we.click.widget - TTW_WIDGET_SIGNS)); - SetWindowDirty(w); + w->SetDirty(); } else { /* toggle the bit of the transparencies variable and play a sound */ ToggleTransparency((TransparencyOption)(e->we.click.widget - TTW_WIDGET_SIGNS)); diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 35456cbc4..5ec4fa2fb 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -119,7 +119,7 @@ static void SetVehicleListsFlag(SortListFlags sl_flag) case WC_SHIPS_LIST: case WC_AIRCRAFT_LIST: WP(w, vehiclelist_d).l.flags |= sl_flag; - SetWindowDirty(w); + w->SetDirty(); 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; if (y >= 0) { WP(w, refit_d).sel = (y / (int)w->resize.step_height) + w->vscroll.pos; - SetWindowDirty(w); + w->SetDirty(); } } break; case 6: // refit button @@ -741,30 +741,30 @@ void ChangeVehicleViewWindow(VehicleID from_index, VehicleID to_index) if (w != NULL) { w->window_number = to_index; WP(w, vp_d).follow_vehicle = to_index; - SetWindowDirty(w); + w->SetDirty(); w = FindWindowById(WC_VEHICLE_ORDERS, from_index); if (w != NULL) { w->window_number = to_index; - SetWindowDirty(w); + w->SetDirty(); } w = FindWindowById(WC_VEHICLE_REFIT, from_index); if (w != NULL) { w->window_number = to_index; - SetWindowDirty(w); + w->SetDirty(); } w = FindWindowById(WC_VEHICLE_DETAILS, from_index); if (w != NULL) { w->window_number = to_index; - SetWindowDirty(w); + w->SetDirty(); } w = FindWindowById(WC_VEHICLE_TIMETABLE, from_index); if (w != NULL) { 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->_sorting->order = !!(vl->l.flags & VL_DESC); - SetWindowDirty(w); + w->SetDirty(); break; 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)); @@ -1169,7 +1169,7 @@ void PlayerVehWndProc(Window *w, WindowEvent *e) break; default: NOT_REACHED(); } - SetWindowDirty(w); + w->SetDirty(); break; 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); vl->l.resort_timer = DAY_TICKS * PERIODIC_RESORT_DAYS; vl->l.flags |= VL_RESORT; - SetWindowDirty(w); + w->SetDirty(); } break; @@ -1634,7 +1634,7 @@ static void VehicleDetailsWndProc(Window *w, WindowEvent *e) WIDGET_LIST_END); WP(w, vehicledetails_d).tab = e->we.click.widget - VLD_WIDGET_DETAILS_CARGO_CARRIED; - SetWindowDirty(w); + w->SetDirty(); 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_TURN_AROUND, veh_stopped); // force turn around } - SetWindowDirty(w); + w->SetDirty(); } } break; } diff --git a/src/widget.cpp b/src/widget.cpp index 9d6bba914..737d3d6d5 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -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 diff --git a/src/window.cpp b/src/window.cpp index 649f79100..f9c45fa63 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -252,7 +252,7 @@ static void DispatchMouseWheelEvent(Window *w, int widget, int wheel) int pos = Clamp(sb->pos + wheel, 0, sb->count - sb->cap); if (pos != sb->pos) { sb->pos = pos; - SetWindowDirty(w); + w->SetDirty(); } } } @@ -564,7 +564,7 @@ Window *BringWindowToFrontById(WindowClass cls, WindowNumber number) if (w != NULL) { w->flags4 |= WF_WHITE_BORDER_MASK; BringWindowToFront(w); - SetWindowDirty(w); + w->SetDirty(); } return w; @@ -602,7 +602,7 @@ static void BringWindowToFront(const Window *w) memmove(wz, wz + 1, (byte*)vz - (byte*)wz); *vz = tempz; - SetWindowDirty(w); + w->SetDirty(); } /** 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->top = ny; - SetWindowDirty(w); + w->SetDirty(); return w; } @@ -1117,7 +1117,7 @@ static void DecreaseWindowCounters() /* Unclick scrollbar buttons if they are pressed. */ if (w->flags4 & (WF_SCROLL_DOWN | WF_SCROLL_UP)) { w->flags4 &= ~(WF_SCROLL_DOWN | WF_SCROLL_UP); - SetWindowDirty(w); + w->SetDirty(); } CallWindowEventNP(w, WE_MOUSELOOP); } @@ -1259,7 +1259,7 @@ void ResizeWindow(Window *w, int x, int y) if (x == 0 && y == 0) return; - SetWindowDirty(w); + w->SetDirty(); for (wi = w->widget; wi->type != WWT_LAST; wi++) { /* Isolate the resizing flags */ 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_height) w->height += y; - SetWindowDirty(w); + w->SetDirty(); } static bool _dragging_window; @@ -1321,7 +1321,7 @@ static bool HandleWindowDragging() break; } - SetWindowDirty(w); + w->SetDirty(); x = _cursor.pos.x + _drag_delta.x; y = _cursor.pos.y + _drag_delta.y; @@ -1442,7 +1442,7 @@ static bool HandleWindowDragging() w->left = nx; w->top = ny; - SetWindowDirty(w); + w->SetDirty(); return false; } else if (w->flags4 & WF_SIZING) { WindowEvent e; @@ -1451,7 +1451,7 @@ static bool HandleWindowDragging() /* Stop the sizing if the left mouse button was released */ if (!_left_button_down) { w->flags4 &= ~WF_SIZING; - SetWindowDirty(w); + w->SetDirty(); break; } @@ -1547,7 +1547,7 @@ static bool HandleScrollbarScrolling() /* Abort if no button is clicked any more. */ if (!_left_button_down) { w->flags4 &= ~WF_SCROLL_MIDDLE; - SetWindowDirty(w); + w->SetDirty(); 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)); if (pos != sb->pos) { sb->pos = pos; - SetWindowDirty(w); + w->SetDirty(); } return false; } @@ -1652,7 +1652,7 @@ static bool MaybeBringWindowToFront(const Window *w) /* A modal child will prevent the activation of the parent window */ if (u->parent == w && (u->desc_flags & WDF_MODAL)) { u->flags4 |= WF_WHITE_BORDER_MASK; - SetWindowDirty(u); + u->SetDirty(); return false; } @@ -2059,7 +2059,7 @@ void UpdateWindows() if (w->flags4 & WF_WHITE_BORDER_MASK) { 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) { 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; 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) { CallWindowEventNP(w, WE_INVALIDATE_DATA); - SetWindowDirty(w); + w->SetDirty(); } /** |