diff options
author | peter1138 <peter1138@openttd.org> | 2019-03-04 07:49:37 +0000 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2019-03-24 16:10:04 +0100 |
commit | 317f69c1520a3e60335c56d358686609d3decf86 (patch) | |
tree | a3432e9e5f433043f3e5431892f49580f1965c73 /src | |
parent | aafce475963e2d2df59de9b02242a04856e78f93 (diff) | |
download | openttd-317f69c1520a3e60335c56d358686609d3decf86.tar.xz |
Codechange: Use override specifier in Window-derived classes.
Diffstat (limited to 'src')
54 files changed, 765 insertions, 765 deletions
diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp index 5a4c77246..0609696e1 100644 --- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -98,7 +98,7 @@ struct AIListWindow : public Window { } } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { switch (widget) { case WID_AIL_CAPTION: @@ -107,7 +107,7 @@ struct AIListWindow : public Window { } } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { if (widget == WID_AIL_LIST) { this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM; @@ -118,7 +118,7 @@ struct AIListWindow : public Window { } } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (widget) { case WID_AIL_LIST: { @@ -183,7 +183,7 @@ struct AIListWindow : public Window { DeleteWindowByClass(WC_QUERY_STRING); } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_AIL_LIST: { // Select one of the AIs @@ -211,7 +211,7 @@ struct AIListWindow : public Window { } } - virtual void OnResize() + void OnResize() override { this->vscroll->SetCapacityFromWidget(this, WID_AIL_LIST); } @@ -221,7 +221,7 @@ struct AIListWindow : public Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (_game_mode == GM_NORMAL && Company::IsValidID(this->slot)) { delete this; @@ -317,7 +317,7 @@ struct AISettingsWindow : public Window { this->RebuildVisibleSettings(); } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { switch (widget) { case WID_AIS_CAPTION: @@ -346,7 +346,7 @@ struct AISettingsWindow : public Window { this->vscroll->SetCount((int)this->visible_settings.size()); } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { if (widget == WID_AIS_BACKGROUND) { this->line_height = max(SETTING_BUTTON_HEIGHT, FONT_HEIGHT_NORMAL) + WD_MATRIX_TOP + WD_MATRIX_BOTTOM; @@ -357,7 +357,7 @@ struct AISettingsWindow : public Window { } } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { if (widget != WID_AIS_BACKGROUND) return; @@ -421,7 +421,7 @@ struct AISettingsWindow : public Window { } } - virtual void OnPaint() + void OnPaint() override { if (this->closing_dropdown) { this->closing_dropdown = false; @@ -430,7 +430,7 @@ struct AISettingsWindow : public Window { this->DrawWidgets(); } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_AIS_BACKGROUND: { @@ -530,7 +530,7 @@ struct AISettingsWindow : public Window { } } - virtual void OnQueryTextFinished(char *str) + void OnQueryTextFinished(char *str) override { if (StrEmpty(str)) return; VisibleSettingsList::const_iterator it = this->visible_settings.begin(); @@ -542,7 +542,7 @@ struct AISettingsWindow : public Window { this->SetDirty(); } - virtual void OnDropdownSelect(int widget, int index) + void OnDropdownSelect(int widget, int index) override { assert(this->clicked_dropdown); VisibleSettingsList::const_iterator it = this->visible_settings.begin(); @@ -553,7 +553,7 @@ struct AISettingsWindow : public Window { this->SetDirty(); } - virtual void OnDropdownClose(Point pt, int widget, int index, bool instant_close) + void OnDropdownClose(Point pt, int widget, int index, bool instant_close) override { /* We cannot raise the dropdown button just yet. OnClick needs some hint, whether * the same dropdown button was clicked again, and then not open the dropdown again. @@ -564,12 +564,12 @@ struct AISettingsWindow : public Window { this->SetDirty(); } - virtual void OnResize() + void OnResize() override { this->vscroll->SetCapacityFromWidget(this, WID_AIS_BACKGROUND); } - virtual void OnRealtimeTick(uint delta_ms) + void OnRealtimeTick(uint delta_ms) override { if (this->timeout.Elapsed(delta_ms)) { this->clicked_button = -1; @@ -582,7 +582,7 @@ struct AISettingsWindow : public Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { this->RebuildVisibleSettings(); HideDropDownMenu(this); @@ -743,7 +743,7 @@ struct AIConfigWindow : public Window { DeleteWindowByClass(WC_AI_SETTINGS); } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { switch (widget) { case WID_AIC_NUMBER: @@ -767,7 +767,7 @@ struct AIConfigWindow : public Window { } } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_AIC_GAMELIST: @@ -819,7 +819,7 @@ struct AIConfigWindow : public Window { return slot < max_slot; } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (widget) { case WID_AIC_GAMELIST: { @@ -858,7 +858,7 @@ struct AIConfigWindow : public Window { } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { if (widget >= WID_AIC_TEXTFILE && widget < WID_AIC_TEXTFILE + TFT_END) { if (this->selected_slot == INVALID_COMPANY || GetConfig(this->selected_slot) == NULL) return; @@ -939,7 +939,7 @@ struct AIConfigWindow : public Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!IsEditable(this->selected_slot)) { this->selected_slot = INVALID_COMPANY; @@ -1096,7 +1096,7 @@ struct AIDebugWindow : public Window { this->InvalidateData(-1); } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { if (widget == WID_AID_LOG_PANEL) { resize->height = FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL; @@ -1104,7 +1104,7 @@ struct AIDebugWindow : public Window { } } - virtual void OnPaint() + void OnPaint() override { this->SelectValidDebugCompany(); @@ -1182,7 +1182,7 @@ struct AIDebugWindow : public Window { this->last_vscroll_pos = this->vscroll->GetPosition(); } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { switch (widget) { case WID_AID_NAME_TEXT: @@ -1205,7 +1205,7 @@ struct AIDebugWindow : public Window { } } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { if (ai_debug_company == INVALID_COMPANY) return; @@ -1264,7 +1264,7 @@ struct AIDebugWindow : public Window { this->last_vscroll_pos = this->vscroll->GetPosition(); } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { /* Also called for hotkeys, so check for disabledness */ if (this->IsWidgetDisabled(widget)) return; @@ -1334,7 +1334,7 @@ struct AIDebugWindow : public Window { } } - virtual void OnEditboxChanged(int wid) + void OnEditboxChanged(int wid) override { if (wid == WID_AID_BREAK_STR_EDIT_BOX) { /* Save the current string to static member so it can be restored next time the window is opened. */ @@ -1349,7 +1349,7 @@ struct AIDebugWindow : public Window { * This is the company ID of the AI/GS which wrote a new log message, or -1 in other cases. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { /* If the log message is related to the active company tab, check the break string. * This needs to be done in gameloop-scope, so the AI is suspended immediately. */ @@ -1406,7 +1406,7 @@ struct AIDebugWindow : public Window { (ai_debug_company == OWNER_DEITY ? !Game::IsPaused() : !AI::IsPaused(ai_debug_company))); } - virtual void OnResize() + void OnResize() override { this->vscroll->SetCapacityFromWidget(this, WID_AID_LOG_PANEL); } diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp index 243f91b24..353e08080 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -87,14 +87,14 @@ struct BuildAirToolbarWindow : Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; if (!CanBuildVehicleInfrastructure(VEH_AIRCRAFT)) delete this; } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_AT_AIRPORT: @@ -114,7 +114,7 @@ struct BuildAirToolbarWindow : Window { } - virtual void OnPlaceObject(Point pt, TileIndex tile) + void OnPlaceObject(Point pt, TileIndex tile) override { switch (this->last_user_action) { case WID_AT_AIRPORT: @@ -129,19 +129,19 @@ struct BuildAirToolbarWindow : Window { } } - virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) + void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) override { VpSelectTilesWithMethod(pt.x, pt.y, select_method); } - virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) + void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) override { if (pt.x != -1 && select_proc == DDSP_DEMOLISH_AREA) { GUIPlaceProcDragXY(select_proc, start_tile, end_tile); } } - virtual void OnPlaceObjectAbort() + void OnPlaceObjectAbort() override { this->RaiseButtons(); @@ -268,7 +268,7 @@ public: DeleteWindowById(WC_SELECT_STATION, 0); } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { switch (widget) { case WID_AP_CLASS_DROPDOWN: @@ -293,7 +293,7 @@ public: } } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_AP_CLASS_DROPDOWN: { @@ -357,7 +357,7 @@ public: } } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (widget) { case WID_AP_AIRPORT_LIST: { @@ -394,7 +394,7 @@ public: } } - virtual void OnPaint() + void OnPaint() override { this->DrawWidgets(); @@ -462,7 +462,7 @@ public: } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_AP_CLASS_DROPDOWN: @@ -535,7 +535,7 @@ public: this->SelectOtherAirport(-1); } - virtual void OnDropdownSelect(int widget, int index) + void OnDropdownSelect(int widget, int index) override { assert(widget == WID_AP_CLASS_DROPDOWN); _selected_airport_class = (AirportClassID)index; @@ -543,7 +543,7 @@ public: this->SelectFirstAvailableAirport(false); } - virtual void OnRealtimeTick(uint delta_ms) + void OnRealtimeTick(uint delta_ms) override { CheckRedrawStationCoverage(this); } diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp index eae0a378e..196d076da 100644 --- a/src/autoreplace_gui.cpp +++ b/src/autoreplace_gui.cpp @@ -237,7 +237,7 @@ public: this->sel_group = id_g; } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_RV_SORT_ASCENDING_DESCENDING: { @@ -316,7 +316,7 @@ public: } } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { switch (widget) { case WID_RV_CAPTION: @@ -353,7 +353,7 @@ public: } } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (widget) { case WID_RV_SORT_ASCENDING_DESCENDING: @@ -394,7 +394,7 @@ public: } } - virtual void OnPaint() + void OnPaint() override { if (this->engines[0].NeedRebuild() || this->engines[1].NeedRebuild()) this->GenerateLists(); @@ -437,7 +437,7 @@ public: } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_RV_SORT_ASCENDING_DESCENDING: @@ -516,7 +516,7 @@ public: } } - virtual void OnDropdownSelect(int widget, int index) + void OnDropdownSelect(int widget, int index) override { switch (widget) { case WID_RV_SORT_DROPDOWN: @@ -557,7 +557,7 @@ public: } } - virtual void OnResize() + void OnResize() override { this->vscroll[0]->SetCapacityFromWidget(this, WID_RV_LEFT_MATRIX); this->vscroll[1]->SetCapacityFromWidget(this, WID_RV_RIGHT_MATRIX); @@ -568,7 +568,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (data != 0) { /* This needs to be done in command-scope to enforce rebuilding before resorting invalid data */ diff --git a/src/bootstrap_gui.cpp b/src/bootstrap_gui.cpp index 01d83848b..b6fb35bff 100644 --- a/src/bootstrap_gui.cpp +++ b/src/bootstrap_gui.cpp @@ -56,7 +56,7 @@ public: ResizeWindow(this, _screen.width, _screen.height); } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { GfxFillRect(r.left, r.top, r.right, r.bottom, 4, FILLRECT_OPAQUE); GfxFillRect(r.left, r.top, r.right, r.bottom, 0, FILLRECT_CHECKER); @@ -88,7 +88,7 @@ public: { } - virtual void OnDownloadComplete(ContentID cid) + void OnDownloadComplete(ContentID cid) override { /* We have completed downloading. We can trigger finding the right set now. */ BaseGraphics::FindSets(); @@ -142,7 +142,7 @@ public: _network_content_client.RemoveCallback(this); } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { /* We cache the button size. This is safe as no reinit can happen here. */ if (this->button_size.width == 0) { @@ -165,14 +165,14 @@ public: } } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { if (widget != 0) return; DrawStringMultiLine(r.left + WD_FRAMETEXT_LEFT, r.right - WD_FRAMETEXT_RIGHT, r.top + WD_FRAMETEXT_TOP, r.bottom - WD_FRAMETEXT_BOTTOM, STR_MISSING_GRAPHICS_SET_MESSAGE, TC_FROMSTRING, SA_CENTER); } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_BAFD_YES: @@ -189,13 +189,13 @@ public: } } - virtual void OnConnect(bool success) + void OnConnect(bool success) override { /* Once connected, request the metadata. */ _network_content_client.RequestContentList(CONTENT_TYPE_BASE_GRAPHICS); } - virtual void OnReceiveContentInfo(const ContentInfo *ci) + void OnReceiveContentInfo(const ContentInfo *ci) override { /* And once the meta data is received, start downloading it. */ _network_content_client.Select(ci->id); diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp index 768691f08..29cb5a085 100644 --- a/src/bridge_gui.cpp +++ b/src/bridge_gui.cpp @@ -163,7 +163,7 @@ public: delete bridges; } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_BBS_DROPDOWN_ORDER: { @@ -207,7 +207,7 @@ public: } } - virtual Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number) + Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number) override { /* Position the window so hopefully the first bridge from the list is under the mouse pointer. */ NWidgetBase *list = this->GetWidget<NWidgetBase>(WID_BBS_BRIDGE_LIST); @@ -217,7 +217,7 @@ public: return corner; } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (widget) { case WID_BBS_DROPDOWN_ORDER: @@ -243,7 +243,7 @@ public: } } - virtual EventState OnKeyPress(WChar key, uint16 keycode) + EventState OnKeyPress(WChar key, uint16 keycode) override { const uint8 i = keycode - '1'; if (i < 9 && i < this->bridges->Length()) { @@ -255,7 +255,7 @@ public: return ES_NOT_HANDLED; } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { default: break; @@ -279,7 +279,7 @@ public: } } - virtual void OnDropdownSelect(int widget, int index) + void OnDropdownSelect(int widget, int index) override { if (widget == WID_BBS_DROPDOWN_CRITERIA && this->bridges->SortType() != index) { this->bridges->SetSortType(index); @@ -288,7 +288,7 @@ public: } } - virtual void OnResize() + void OnResize() override { this->vscroll->SetCapacityFromWidget(this, WID_BBS_BRIDGE_LIST); } diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index 0ac23cfde..77c175ee7 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -1100,7 +1100,7 @@ struct BuildVehicleWindow : Window { this->eng_list.SetFilterState(this->cargo_filter[this->cargo_filter_criteria] != CF_ANY); } - void OnInit() + void OnInit() override { this->SetCargoFilterArray(); } @@ -1272,7 +1272,7 @@ struct BuildVehicleWindow : Window { this->eng_list.RebuildDone(); } - void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_BV_SORT_ASCENDING_DESCENDING: @@ -1345,7 +1345,7 @@ struct BuildVehicleWindow : Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; /* When switching to original acceleration model for road vehicles, clear the selected sort criteria if it is not available now. */ @@ -1358,7 +1358,7 @@ struct BuildVehicleWindow : Window { this->eng_list.ForceRebuild(); } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { switch (widget) { case WID_BV_CAPTION: @@ -1390,7 +1390,7 @@ struct BuildVehicleWindow : Window { } } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_BV_LIST: @@ -1420,7 +1420,7 @@ struct BuildVehicleWindow : Window { } } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (widget) { case WID_BV_LIST: @@ -1433,7 +1433,7 @@ struct BuildVehicleWindow : Window { } } - virtual void OnPaint() + void OnPaint() override { this->GenerateBuildList(); this->vscroll->SetCount(this->eng_list.Length()); @@ -1460,14 +1460,14 @@ struct BuildVehicleWindow : Window { } } - virtual void OnQueryTextFinished(char *str) + void OnQueryTextFinished(char *str) override { if (str == NULL) return; DoCommandP(0, this->rename_engine, 0, CMD_RENAME_ENGINE | CMD_MSG(STR_ERROR_CAN_T_RENAME_TRAIN_TYPE + this->vehicle_type), NULL, str); } - virtual void OnDropdownSelect(int widget, int index) + void OnDropdownSelect(int widget, int index) override { switch (widget) { case WID_BV_SORT_DROPDOWN: @@ -1491,7 +1491,7 @@ struct BuildVehicleWindow : Window { this->SetDirty(); } - virtual void OnResize() + void OnResize() override { this->vscroll->SetCapacityFromWidget(this, WID_BV_LIST); } diff --git a/src/cheat_gui.cpp b/src/cheat_gui.cpp index fda2b246e..e6bfc8c0a 100644 --- a/src/cheat_gui.cpp +++ b/src/cheat_gui.cpp @@ -221,7 +221,7 @@ struct CheatWindow : Window { this->InitNested(); } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { if (widget != WID_C_PANEL) return; @@ -283,7 +283,7 @@ struct CheatWindow : Window { } } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { if (widget != WID_C_PANEL) return; @@ -330,7 +330,7 @@ struct CheatWindow : Window { size->height = this->header_height + WD_FRAMERECT_TOP + WD_PAR_VSEP_NORMAL + WD_FRAMERECT_BOTTOM + this->line_height * lengthof(_cheats_ui); } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { const NWidgetBase *wid = this->GetWidget<NWidgetBase>(WID_C_PANEL); uint btn = (pt.y - wid->pos_y - WD_FRAMERECT_TOP - this->header_height) / this->line_height; @@ -384,13 +384,13 @@ struct CheatWindow : Window { this->SetDirty(); } - virtual void OnTimeout() + void OnTimeout() override { this->clicked = 0; this->SetDirty(); } - virtual void OnQueryTextFinished(char *str) + void OnQueryTextFinished(char *str) override { /* Was 'cancel' pressed or nothing entered? */ if (str == NULL || StrEmpty(str)) return; diff --git a/src/company_gui.cpp b/src/company_gui.cpp index 3862cd9da..58f972364 100644 --- a/src/company_gui.cpp +++ b/src/company_gui.cpp @@ -284,7 +284,7 @@ struct CompanyFinancesWindow : Window { this->owner = (Owner)this->window_number; } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { switch (widget) { case WID_CF_CAPTION: @@ -303,7 +303,7 @@ struct CompanyFinancesWindow : Window { } } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { int type = _settings_client.gui.expenses_layout; switch (widget) { @@ -331,7 +331,7 @@ struct CompanyFinancesWindow : Window { } } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (widget) { case WID_CF_EXPS_CATEGORY: @@ -392,7 +392,7 @@ struct CompanyFinancesWindow : Window { this->GetWidget<NWidgetStacked>(WID_CF_SEL_BUTTONS)->SetDisplayedPlane(plane); } - virtual void OnPaint() + void OnPaint() override { if (!this->IsShaded()) { if (!this->small) { @@ -422,7 +422,7 @@ struct CompanyFinancesWindow : Window { this->DrawWidgets(); } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_CF_TOGGLE_SIZE: // toggle size @@ -451,7 +451,7 @@ struct CompanyFinancesWindow : Window { } } - virtual void OnHundredthTick() + void OnHundredthTick() override { const Company *c = Company::Get((CompanyID)this->window_number); if (c->money > CompanyFinancesWindow::max_money) { @@ -740,7 +740,7 @@ public: } } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_SCL_SPACER_DROPDOWN: { @@ -793,7 +793,7 @@ public: } } - virtual void OnPaint() + void OnPaint() override { bool local = (CompanyID)this->window_number == _local_company; @@ -807,7 +807,7 @@ public: this->DrawWidgets(); } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { switch (widget) { case WID_SCL_CAPTION: @@ -847,7 +847,7 @@ public: } } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { if (widget != WID_SCL_MATRIX) return; @@ -911,7 +911,7 @@ public: } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { /* Livery Class buttons */ @@ -985,12 +985,12 @@ public: } } - virtual void OnResize() + void OnResize() override { this->vscroll->SetCapacityFromWidget(this, WID_SCL_MATRIX); } - virtual void OnDropdownSelect(int widget, int index) + void OnDropdownSelect(int widget, int index) override { bool local = (CompanyID)this->window_number == _local_company; if (!local) return; @@ -1016,7 +1016,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; @@ -1368,7 +1368,7 @@ public: } } - virtual void OnInit() + void OnInit() override { /* Size of the boolean yes/no button. */ Dimension yesno_dim = maxdim(GetStringBoundingBox(STR_FACE_YES), GetStringBoundingBox(STR_FACE_NO)); @@ -1391,7 +1391,7 @@ public: this->number_dim = number_dim; } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_SCMF_FACE: { @@ -1450,7 +1450,7 @@ public: } } - virtual void OnPaint() + void OnPaint() override { /* lower the non-selected gender button */ this->SetWidgetsLoweredState(!this->is_female, WID_SCMF_MALE, WID_SCMF_MALE2, WIDGET_LIST_END); @@ -1511,7 +1511,7 @@ public: this->DrawWidgets(); } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (widget) { case WID_SCMF_HAS_MOUSTACHE_EARRING_TEXT: @@ -1600,7 +1600,7 @@ public: } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { /* Toggle size, advanced/simple face selection */ @@ -1709,7 +1709,7 @@ public: } } - virtual void OnQueryTextFinished(char *str) + void OnQueryTextFinished(char *str) override { if (str == NULL) return; /* Set a new company manager face number */ @@ -1864,7 +1864,7 @@ struct CompanyInfrastructureWindow : Window return total; } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { switch (widget) { case WID_CI_CAPTION: @@ -1873,7 +1873,7 @@ struct CompanyInfrastructureWindow : Window } } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { const Company *c = Company::Get((CompanyID)this->window_number); @@ -1996,7 +1996,7 @@ struct CompanyInfrastructureWindow : Window } } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { const Company *c = Company::Get((CompanyID)this->window_number); int y = r.top; @@ -2099,7 +2099,7 @@ struct CompanyInfrastructureWindow : Window * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; @@ -2265,7 +2265,7 @@ struct CompanyWindow : Window this->OnInvalidateData(); } - virtual void OnPaint() + void OnPaint() override { const Company *c = Company::Get((CompanyID)this->window_number); bool local = this->window_number == _local_company; @@ -2334,7 +2334,7 @@ struct CompanyWindow : Window this->DrawWidgets(); } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_C_FACE: { @@ -2393,7 +2393,7 @@ struct CompanyWindow : Window } } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { const Company *c = Company::Get((CompanyID)this->window_number); switch (widget) { @@ -2504,7 +2504,7 @@ struct CompanyWindow : Window } } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { switch (widget) { case WID_C_CAPTION: @@ -2522,7 +2522,7 @@ struct CompanyWindow : Window } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_C_NEW_FACE: DoSelectCompanyManagerFace(this); break; @@ -2612,13 +2612,13 @@ struct CompanyWindow : Window } } - virtual void OnHundredthTick() + void OnHundredthTick() override { /* redraw the window every now and then */ this->SetDirty(); } - virtual void OnPlaceObject(Point pt, TileIndex tile) + void OnPlaceObject(Point pt, TileIndex tile) override { if (DoCommandP(tile, OBJECT_HQ, 0, CMD_BUILD_OBJECT | CMD_MSG(STR_ERROR_CAN_T_BUILD_COMPANY_HEADQUARTERS)) && !_shift_pressed) { ResetObjectToPlace(); @@ -2626,12 +2626,12 @@ struct CompanyWindow : Window } } - virtual void OnPlaceObjectAbort() + void OnPlaceObjectAbort() override { this->RaiseButtons(); } - virtual void OnQueryTextFinished(char *str) + void OnQueryTextFinished(char *str) override { if (str == NULL) return; @@ -2658,7 +2658,7 @@ struct CompanyWindow : Window * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (this->window_number == _local_company) return; @@ -2717,7 +2717,7 @@ struct BuyCompanyWindow : Window { this->InitNested(window_number); } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_BC_FACE: @@ -2733,7 +2733,7 @@ struct BuyCompanyWindow : Window { } } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { switch (widget) { case WID_BC_CAPTION: @@ -2743,7 +2743,7 @@ struct BuyCompanyWindow : Window { } } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (widget) { case WID_BC_FACE: { @@ -2762,7 +2762,7 @@ struct BuyCompanyWindow : Window { } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_BC_NO: diff --git a/src/console_gui.cpp b/src/console_gui.cpp index ed46938cd..3ee13946f 100644 --- a/src/console_gui.cpp +++ b/src/console_gui.cpp @@ -201,7 +201,7 @@ struct IConsoleWindow : Window this->SetDirty(); } - virtual void OnPaint() + void OnPaint() override { const int right = this->width - 5; @@ -229,7 +229,7 @@ struct IConsoleWindow : Window } } - virtual void OnHundredthTick() + void OnHundredthTick() override { if (IConsoleLine::Truncate() && (IConsoleWindow::scroll > IConsoleLine::size)) { @@ -238,12 +238,12 @@ struct IConsoleWindow : Window } } - virtual void OnMouseLoop() + void OnMouseLoop() override { if (_iconsole_cmdline.HandleCaret()) this->SetDirty(); } - virtual EventState OnKeyPress(WChar key, uint16 keycode) + EventState OnKeyPress(WChar key, uint16 keycode) override { if (_focused_window != this) return ES_NOT_HANDLED; @@ -314,7 +314,7 @@ struct IConsoleWindow : Window return ES_HANDLED; } - virtual void InsertTextString(int wid, const char *str, bool marked, const char *caret, const char *insert_location, const char *replacement_end) + void InsertTextString(int wid, const char *str, bool marked, const char *caret, const char *insert_location, const char *replacement_end) override { if (_iconsole_cmdline.InsertString(str, marked, caret, insert_location, replacement_end)) { IConsoleWindow::scroll = 0; @@ -323,17 +323,17 @@ struct IConsoleWindow : Window } } - virtual const char *GetFocusedText() const + const char *GetFocusedText() const override { return _iconsole_cmdline.buf; } - virtual const char *GetCaret() const + const char *GetCaret() const override { return _iconsole_cmdline.buf + _iconsole_cmdline.caretpos; } - virtual const char *GetMarkedText(size_t *length) const + const char *GetMarkedText(size_t *length) const override { if (_iconsole_cmdline.markend == 0) return NULL; @@ -341,7 +341,7 @@ struct IConsoleWindow : Window return _iconsole_cmdline.buf + _iconsole_cmdline.markpos; } - virtual Point GetCaretPosition() const + Point GetCaretPosition() const override { int delta = min(this->width - this->line_offset - _iconsole_cmdline.pixels - ICON_RIGHT_BORDERWIDTH, 0); Point pt = {this->line_offset + delta + _iconsole_cmdline.caretxoffs, this->height - this->line_height}; @@ -349,7 +349,7 @@ struct IConsoleWindow : Window return pt; } - virtual Rect GetTextBoundingRect(const char *from, const char *to) const + Rect GetTextBoundingRect(const char *from, const char *to) const override { int delta = min(this->width - this->line_offset - _iconsole_cmdline.pixels - ICON_RIGHT_BORDERWIDTH, 0); @@ -360,7 +360,7 @@ struct IConsoleWindow : Window return r; } - virtual const char *GetTextCharacterAtPosition(const Point &pt) const + const char *GetTextCharacterAtPosition(const Point &pt) const override { int delta = min(this->width - this->line_offset - _iconsole_cmdline.pixels - ICON_RIGHT_BORDERWIDTH, 0); @@ -369,12 +369,12 @@ struct IConsoleWindow : Window return GetCharAtPosition(_iconsole_cmdline.buf, pt.x - delta); } - virtual void OnMouseWheel(int wheel) + void OnMouseWheel(int wheel) override { this->Scroll(-wheel); } - virtual void OnFocusLost() + void OnFocusLost() override { VideoDriver::GetInstance()->EditBoxLostFocus(); } diff --git a/src/date_gui.cpp b/src/date_gui.cpp index 468a74db9..53e0cf735 100644 --- a/src/date_gui.cpp +++ b/src/date_gui.cpp @@ -55,7 +55,7 @@ struct SetDateWindow : Window { this->date.year = Clamp(this->date.year, min_year, max_year); } - virtual Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number) + Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number) override { Point pt = { this->parent->left + this->parent->width / 2 - sm_width / 2, this->parent->top + this->parent->height / 2 - sm_height / 2 }; return pt; @@ -100,7 +100,7 @@ struct SetDateWindow : Window { ShowDropDownList(this, list, selected, widget); } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { Dimension d = {0, 0}; switch (widget) { @@ -129,7 +129,7 @@ struct SetDateWindow : Window { *size = d; } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { switch (widget) { case WID_SD_DAY: SetDParam(0, this->date.day - 1 + STR_DAY_NUMBER_1ST); break; @@ -138,7 +138,7 @@ struct SetDateWindow : Window { } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_SD_DAY: @@ -154,7 +154,7 @@ struct SetDateWindow : Window { } } - virtual void OnDropdownSelect(int widget, int index) + void OnDropdownSelect(int widget, int index) override { switch (widget) { case WID_SD_DAY: diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp index 39accd65f..f2da7330e 100644 --- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -364,7 +364,7 @@ struct DepotWindow : Window { } } - void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { if (widget != WID_D_MATRIX) return; @@ -422,7 +422,7 @@ struct DepotWindow : Window { } } - void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { if (widget != WID_D_CAPTION) return; @@ -650,7 +650,7 @@ struct DepotWindow : Window { uint flag_width; uint flag_height; - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_D_MATRIX: { @@ -701,12 +701,12 @@ struct DepotWindow : Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { this->generate_list = true; } - virtual void OnPaint() + void OnPaint() override { if (this->generate_list) { /* Generate the vehicle list @@ -758,7 +758,7 @@ struct DepotWindow : Window { this->DrawWidgets(); } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_D_MATRIX: { // List @@ -837,7 +837,7 @@ struct DepotWindow : Window { } } - virtual void OnQueryTextFinished(char *str) + void OnQueryTextFinished(char *str) override { if (str == NULL) return; @@ -845,7 +845,7 @@ struct DepotWindow : Window { DoCommandP(0, GetDepotIndex(this->window_number), 0, CMD_RENAME_DEPOT | CMD_MSG(STR_ERROR_CAN_T_RENAME_DEPOT), NULL, str); } - virtual bool OnRightClick(Point pt, int widget) + bool OnRightClick(Point pt, int widget) override { if (widget != WID_D_MATRIX) return false; @@ -906,7 +906,7 @@ struct DepotWindow : Window { * @param v the original vehicle to clone * @return Always true. */ - virtual bool OnVehicleSelect(const Vehicle *v) + bool OnVehicleSelect(const Vehicle *v) override { if (_ctrl_pressed) { /* Share-clone, do not open new viewport, and keep tool active */ @@ -921,7 +921,7 @@ struct DepotWindow : Window { return true; } - virtual void OnPlaceObjectAbort() + void OnPlaceObjectAbort() override { /* abort clone */ this->RaiseWidget(WID_D_CLONE); @@ -939,7 +939,7 @@ struct DepotWindow : Window { } } - virtual void OnMouseDrag(Point pt, int widget) + void OnMouseDrag(Point pt, int widget) override { if (this->sel == INVALID_VEHICLE) return; if (widget != this->hovered_widget) { @@ -991,7 +991,7 @@ struct DepotWindow : Window { this->SetWidgetDirty(widget); } - virtual void OnDragDrop(Point pt, int widget) + void OnDragDrop(Point pt, int widget) override { switch (widget) { case WID_D_MATRIX: { @@ -1046,7 +1046,7 @@ struct DepotWindow : Window { _cursor.vehchain = false; } - virtual void OnTimeout() + void OnTimeout() override { if (!this->IsWidgetDisabled(WID_D_SELL)) { this->RaiseWidget(WID_D_SELL); @@ -1058,7 +1058,7 @@ struct DepotWindow : Window { } } - virtual void OnResize() + void OnResize() override { this->vscroll->SetCapacityFromWidget(this, WID_D_MATRIX); NWidgetCore *nwi = this->GetWidget<NWidgetCore>(WID_D_MATRIX); @@ -1069,7 +1069,7 @@ struct DepotWindow : Window { } } - virtual EventState OnCTRLStateChange() + EventState OnCTRLStateChange() override { if (this->sel != INVALID_VEHICLE) { _cursor.vehchain = _ctrl_pressed; diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index e2224dfa2..f5ebd1f7f 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -113,7 +113,7 @@ struct BuildDocksToolbarWindow : Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; @@ -129,7 +129,7 @@ struct BuildDocksToolbarWindow : Window { } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_DT_CANAL: // Build canal button @@ -173,7 +173,7 @@ struct BuildDocksToolbarWindow : Window { this->last_clicked_widget = (DockToolbarWidgets)widget; } - virtual void OnPlaceObject(Point pt, TileIndex tile) + void OnPlaceObject(Point pt, TileIndex tile) override { switch (this->last_clicked_widget) { case WID_DT_CANAL: // Build canal button @@ -222,12 +222,12 @@ struct BuildDocksToolbarWindow : Window { } } - virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) + void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) override { VpSelectTilesWithMethod(pt.x, pt.y, select_method); } - virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) + void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) override { if (pt.x != -1) { switch (select_proc) { @@ -246,7 +246,7 @@ struct BuildDocksToolbarWindow : Window { } } - virtual void OnPlaceObjectAbort() + void OnPlaceObjectAbort() override { this->RaiseButtons(); @@ -256,7 +256,7 @@ struct BuildDocksToolbarWindow : Window { DeleteWindowByClass(WC_BUILD_BRIDGE); } - virtual void OnPlacePresize(Point pt, TileIndex tile_from) + void OnPlacePresize(Point pt, TileIndex tile_from) override { TileIndex tile_to = tile_from; @@ -410,7 +410,7 @@ public: DeleteWindowById(WC_SELECT_STATION, 0); } - virtual void OnPaint() + void OnPaint() override { int rad = (_settings_game.station.modified_catchment) ? CA_DOCK : CA_UNMODIFIED; @@ -437,7 +437,7 @@ public: } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case BDSW_LT_OFF: @@ -451,7 +451,7 @@ public: } } - virtual void OnRealtimeTick(uint delta_ms) + void OnRealtimeTick(uint delta_ms) override { CheckRedrawStationCoverage(this); } @@ -505,7 +505,7 @@ public: UpdateDocksDirection(); } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_BDD_X: @@ -516,7 +516,7 @@ public: } } - virtual void OnPaint() + void OnPaint() override { this->DrawWidgets(); @@ -531,7 +531,7 @@ public: DrawShipDepotSprite(this->GetWidget<NWidgetBase>(WID_BDD_Y)->pos_x + x1, this->GetWidget<NWidgetBase>(WID_BDD_Y)->pos_y + y2, AXIS_Y, DEPOT_PART_SOUTH); } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_BDD_X: diff --git a/src/engine_gui.cpp b/src/engine_gui.cpp index 51c7e1483..8e7f1a824 100644 --- a/src/engine_gui.cpp +++ b/src/engine_gui.cpp @@ -75,7 +75,7 @@ struct EnginePreviewWindow : Window { this->flags |= WF_STICKY; } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { if (widget != WID_EP_QUESTION) return; @@ -102,7 +102,7 @@ struct EnginePreviewWindow : Window { size->height += GetStringHeight(GetEngineInfoString(engine), size->width); } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { if (widget != WID_EP_QUESTION) return; @@ -121,7 +121,7 @@ struct EnginePreviewWindow : Window { DrawStringMultiLine(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, r.bottom, GetEngineInfoString(engine), TC_FROMSTRING, SA_CENTER); } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_EP_YES: @@ -133,7 +133,7 @@ struct EnginePreviewWindow : Window { } } - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; diff --git a/src/error_gui.cpp b/src/error_gui.cpp index 1c59b7e8d..47bca2638 100644 --- a/src/error_gui.cpp +++ b/src/error_gui.cpp @@ -180,7 +180,7 @@ public: this->InitNested(); } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_EM_MESSAGE: { @@ -208,7 +208,7 @@ public: } } - virtual Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number) + Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number) override { /* Position (0, 0) given, center the window. */ if (this->position.x == 0 && this->position.y == 0) { @@ -244,18 +244,18 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { /* If company gets shut down, while displaying an error about it, remove the error message. */ if (this->face != INVALID_COMPANY && !Company::IsValidID(this->face)) delete this; } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { if (widget == WID_EM_CAPTION) CopyInDParam(0, this->decode_params, lengthof(this->decode_params)); } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (widget) { case WID_EM_FACE: { @@ -292,13 +292,13 @@ public: } } - virtual void OnMouseLoop() + void OnMouseLoop() override { /* Disallow closing the window too easily, if timeout is disabled */ if (_right_button_down && this->duration != 0) delete this; } - virtual void OnHundredthTick() + void OnHundredthTick() override { /* Timeout enabled? */ if (this->duration != 0) { @@ -313,7 +313,7 @@ public: if (_window_system_initialized) ShowFirstError(); } - virtual EventState OnKeyPress(WChar key, uint16 keycode) + EventState OnKeyPress(WChar key, uint16 keycode) override { if (keycode != WKC_SPACE) return ES_NOT_HANDLED; delete this; diff --git a/src/fios_gui.cpp b/src/fios_gui.cpp index a4eb12e3a..f2f96cd28 100644 --- a/src/fios_gui.cpp +++ b/src/fios_gui.cpp @@ -407,7 +407,7 @@ public: } } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (widget) { case WID_SL_SORT_BYNAME: @@ -553,7 +553,7 @@ public: } } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_SL_BACKGROUND: @@ -575,7 +575,7 @@ public: } } - virtual void OnPaint() + void OnPaint() override { if (_savegame_sort_dirty) { _savegame_sort_dirty = false; @@ -586,7 +586,7 @@ public: this->DrawWidgets(); } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_SL_SORT_BYNAME: // Sort save names by name @@ -718,7 +718,7 @@ public: } } - virtual EventState OnKeyPress(WChar key, uint16 keycode) + EventState OnKeyPress(WChar key, uint16 keycode) override { if (keycode == WKC_ESC) { delete this; @@ -728,7 +728,7 @@ public: return ES_NOT_HANDLED; } - virtual void OnTimeout() + void OnTimeout() override { /* Widgets WID_SL_DELETE_SELECTION and WID_SL_SAVE_GAME only exist when saving to a file. */ if (this->fop != SLO_SAVE) return; @@ -763,7 +763,7 @@ public: } } - virtual void OnResize() + void OnResize() override { this->vscroll->SetCapacityFromWidget(this, WID_SL_DRIVES_DIRECTORIES_LIST); } @@ -773,7 +773,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { switch (data) { case SLIWD_RESCAN_FILES: @@ -851,7 +851,7 @@ public: } } - virtual void OnEditboxChanged(int wid) + void OnEditboxChanged(int wid) override { if (wid == WID_SL_FILTER) { this->string_filter.SetFilterTerm(this->filter_editbox.text.buf); diff --git a/src/framerate_gui.cpp b/src/framerate_gui.cpp index 060b19a4a..fe8338899 100644 --- a/src/framerate_gui.cpp +++ b/src/framerate_gui.cpp @@ -432,7 +432,7 @@ struct FramerateWindow : Window { ResizeWindow(this, 0, (max(MIN_ELEMENTS, this->num_displayed) - MIN_ELEMENTS) * FONT_HEIGHT_NORMAL); } - virtual void OnRealtimeTick(uint delta_ms) + void OnRealtimeTick(uint delta_ms) override { bool elapsed = this->next_update.Elapsed(delta_ms); @@ -475,7 +475,7 @@ struct FramerateWindow : Window { } } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { switch (widget) { case WID_FRW_CAPTION: @@ -503,7 +503,7 @@ struct FramerateWindow : Window { } } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_FRW_RATE_GAMELOOP: @@ -582,7 +582,7 @@ struct FramerateWindow : Window { } } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (widget) { case WID_FRW_TIMES_NAMES: { @@ -621,7 +621,7 @@ struct FramerateWindow : Window { } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_FRW_TIMES_NAMES: @@ -646,7 +646,7 @@ struct FramerateWindow : Window { } } - virtual void OnResize() + void OnResize() override { auto *wid = this->GetWidget<NWidgetResizeBase>(WID_FRW_TIMES_NAMES); this->num_displayed = (wid->current_y - wid->min_y - VSPACING) / FONT_HEIGHT_NORMAL - 1; // subtract 1 for headings @@ -694,7 +694,7 @@ struct FrametimeGraphWindow : Window { this->InitNested(number); } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { switch (widget) { case WID_FGW_CAPTION: @@ -709,7 +709,7 @@ struct FrametimeGraphWindow : Window { } } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { if (widget == WID_FGW_GRAPH) { SetDParam(0, 100); @@ -807,7 +807,7 @@ struct FrametimeGraphWindow : Window { this->SelectVerticalScale(peak_value); } - virtual void OnRealtimeTick(uint delta_ms) + void OnRealtimeTick(uint delta_ms) override { this->SetDirty(); @@ -826,7 +826,7 @@ struct FrametimeGraphWindow : Window { return (value - src_min) * dst_diff / src_diff + dst_min; } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { if (widget == WID_FGW_GRAPH) { const TimingMeasurement *durations = _pf_data[this->element].durations; diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp index b22ba5287..4631d02ee 100644 --- a/src/genworld_gui.cpp +++ b/src/genworld_gui.cpp @@ -332,7 +332,7 @@ struct GenerateLandscapeWindow : public Window { } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { switch (widget) { case WID_GL_START_DATE_TEXT: SetDParam(0, ConvertYMDToDate(_settings_newgame.game_creation.starting_year, 0, 1)); break; @@ -393,7 +393,7 @@ struct GenerateLandscapeWindow : public Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; /* Update the climate buttons */ @@ -440,7 +440,7 @@ struct GenerateLandscapeWindow : public Window { } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { const StringID *strs = NULL; switch (widget) { @@ -518,7 +518,7 @@ struct GenerateLandscapeWindow : public Window { size->height = max(size->height, (uint)(FONT_HEIGHT_NORMAL + WD_DROPDOWNTEXT_TOP + WD_DROPDOWNTEXT_BOTTOM)); } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (widget) { case WID_GL_HEIGHTMAP_NAME_TEXT: { @@ -528,7 +528,7 @@ struct GenerateLandscapeWindow : public Window { } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_GL_TEMPERATE: @@ -703,7 +703,7 @@ struct GenerateLandscapeWindow : public Window { } } - virtual void OnTimeout() + void OnTimeout() override { static const int raise_widgets[] = {WID_GL_MAX_HEIGHTLEVEL_DOWN, WID_GL_MAX_HEIGHTLEVEL_UP, WID_GL_START_DATE_DOWN, WID_GL_START_DATE_UP, WID_GL_SNOW_LEVEL_UP, WID_GL_SNOW_LEVEL_DOWN, WIDGET_LIST_END}; for (const int *widget = raise_widgets; *widget != WIDGET_LIST_END; widget++) { @@ -714,7 +714,7 @@ struct GenerateLandscapeWindow : public Window { } } - virtual void OnDropdownSelect(int widget, int index) + void OnDropdownSelect(int widget, int index) override { switch (widget) { case WID_GL_MAPSIZE_X_PULLDOWN: _settings_newgame.game_creation.map_x = index; break; @@ -758,7 +758,7 @@ struct GenerateLandscapeWindow : public Window { this->InvalidateData(); } - virtual void OnQueryTextFinished(char *str) + void OnQueryTextFinished(char *str) override { /* Was 'cancel' pressed? */ if (str == NULL) return; @@ -888,7 +888,7 @@ struct CreateScenarioWindow : public Window this->LowerWidget(_settings_newgame.game_creation.landscape + WID_CS_TEMPERATE); } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { switch (widget) { case WID_CS_START_DATE_TEXT: @@ -909,7 +909,7 @@ struct CreateScenarioWindow : public Window } } - virtual void OnPaint() + void OnPaint() override { this->SetWidgetDisabledState(WID_CS_START_DATE_DOWN, _settings_newgame.game_creation.starting_year <= MIN_YEAR); this->SetWidgetDisabledState(WID_CS_START_DATE_UP, _settings_newgame.game_creation.starting_year >= MAX_YEAR); @@ -924,7 +924,7 @@ struct CreateScenarioWindow : public Window this->DrawWidgets(); } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { StringID str = STR_JUST_INT; switch (widget) { @@ -950,7 +950,7 @@ struct CreateScenarioWindow : public Window size->height += padding.height; } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_CS_TEMPERATE: @@ -1015,7 +1015,7 @@ struct CreateScenarioWindow : public Window } } - virtual void OnTimeout() + void OnTimeout() override { static const int raise_widgets[] = {WID_CS_START_DATE_DOWN, WID_CS_START_DATE_UP, WID_CS_FLAT_LAND_HEIGHT_DOWN, WID_CS_FLAT_LAND_HEIGHT_UP, WIDGET_LIST_END}; for (const int *widget = raise_widgets; *widget != WIDGET_LIST_END; widget++) { @@ -1026,7 +1026,7 @@ struct CreateScenarioWindow : public Window } } - virtual void OnDropdownSelect(int widget, int index) + void OnDropdownSelect(int widget, int index) override { switch (widget) { case WID_CS_MAPSIZE_X_PULLDOWN: _settings_newgame.game_creation.map_x = index; break; @@ -1035,7 +1035,7 @@ struct CreateScenarioWindow : public Window this->SetDirty(); } - virtual void OnQueryTextFinished(char *str) + void OnQueryTextFinished(char *str) override { if (!StrEmpty(str)) { int32 value = atoi(str); @@ -1187,7 +1187,7 @@ struct GenerateProgressWindow : public Window { this->InitNested(); } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_GP_ABORT: @@ -1202,7 +1202,7 @@ struct GenerateProgressWindow : public Window { } } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_GP_PROGRESS_BAR: { @@ -1223,7 +1223,7 @@ struct GenerateProgressWindow : public Window { } } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (widget) { case WID_GP_PROGRESS_BAR: diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp index 39df8ab6e..d74f833ce 100644 --- a/src/graph_gui.cpp +++ b/src/graph_gui.cpp @@ -56,7 +56,7 @@ struct GraphLegendWindow : Window { } } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { if (!IsInsideMM(widget, WID_GL_FIRST_COMPANY, MAX_COMPANIES + WID_GL_FIRST_COMPANY)) return; @@ -74,7 +74,7 @@ struct GraphLegendWindow : Window { DrawString(r.left + (rtl ? (uint)WD_FRAMERECT_LEFT : (d.width + 4)), r.right - (rtl ? (d.width + 4) : (uint)WD_FRAMERECT_RIGHT), r.top + (r.bottom - r.top + 1 - FONT_HEIGHT_NORMAL) / 2, STR_COMPANY_NAME_COMPANY_NUM, HasBit(_legend_excluded_companies, cid) ? TC_BLACK : TC_WHITE); } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { if (!IsInsideMM(widget, WID_GL_FIRST_COMPANY, MAX_COMPANIES + WID_GL_FIRST_COMPANY)) return; @@ -93,7 +93,7 @@ struct GraphLegendWindow : Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; if (Company::IsValidID(data)) return; @@ -485,7 +485,7 @@ protected: } public: - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { if (widget != this->graph_widget) return; @@ -521,7 +521,7 @@ public: size->height = max<uint>(size->height, size->width / 3); } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { if (widget != this->graph_widget) return; @@ -533,13 +533,13 @@ public: return INVALID_DATAPOINT; } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { /* Clicked on legend? */ if (widget == WID_CV_KEY_BUTTON) ShowGraphLegend(); } - virtual void OnGameTick() + void OnGameTick() override { this->UpdateStatistics(false); } @@ -549,7 +549,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; this->UpdateStatistics(true); @@ -621,7 +621,7 @@ struct OperatingProfitGraphWindow : BaseGraphWindow { this->InitializeWindow(window_number); } - virtual OverflowSafeInt64 GetGraphData(const Company *c, int j) + OverflowSafeInt64 GetGraphData(const Company *c, int j) override { return c->old_economy[j].income + c->old_economy[j].expenses; } @@ -672,7 +672,7 @@ struct IncomeGraphWindow : BaseGraphWindow { this->InitializeWindow(window_number); } - virtual OverflowSafeInt64 GetGraphData(const Company *c, int j) + OverflowSafeInt64 GetGraphData(const Company *c, int j) override { return c->old_economy[j].income; } @@ -721,7 +721,7 @@ struct DeliveredCargoGraphWindow : BaseGraphWindow { this->InitializeWindow(window_number); } - virtual OverflowSafeInt64 GetGraphData(const Company *c, int j) + OverflowSafeInt64 GetGraphData(const Company *c, int j) override { return c->old_economy[j].delivered_cargo.GetSum<OverflowSafeInt64>(); } @@ -770,12 +770,12 @@ struct PerformanceHistoryGraphWindow : BaseGraphWindow { this->InitializeWindow(window_number); } - virtual OverflowSafeInt64 GetGraphData(const Company *c, int j) + OverflowSafeInt64 GetGraphData(const Company *c, int j) override { return c->old_economy[j].performance_history; } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { if (widget == WID_PHG_DETAILED_PERFORMANCE) ShowPerformanceRatingDetail(); this->BaseGraphWindow::OnClick(pt, widget, click_count); @@ -826,7 +826,7 @@ struct CompanyValueGraphWindow : BaseGraphWindow { this->InitializeWindow(window_number); } - virtual OverflowSafeInt64 GetGraphData(const Company *c, int j) + OverflowSafeInt64 GetGraphData(const Company *c, int j) override { return c->old_economy[j].company_value; } @@ -903,7 +903,7 @@ struct PaymentRatesGraphWindow : BaseGraphWindow { } } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { if (widget != WID_CPR_MATRIX) { BaseGraphWindow::UpdateWidgetSize(widget, size, padding, fill, resize); @@ -926,7 +926,7 @@ struct PaymentRatesGraphWindow : BaseGraphWindow { resize->height = this->line_height; } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { if (widget != WID_CPR_MATRIX) { BaseGraphWindow::DrawWidget(r, widget); @@ -963,7 +963,7 @@ struct PaymentRatesGraphWindow : BaseGraphWindow { } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_CPR_ENABLE_CARGOES: @@ -1004,12 +1004,12 @@ struct PaymentRatesGraphWindow : BaseGraphWindow { } } - virtual void OnResize() + void OnResize() override { this->vscroll->SetCapacityFromWidget(this, WID_CPR_MATRIX); } - virtual void OnGameTick() + void OnGameTick() override { /* Override default OnGameTick */ } @@ -1019,13 +1019,13 @@ struct PaymentRatesGraphWindow : BaseGraphWindow { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; this->OnHundredthTick(); } - virtual void OnHundredthTick() + void OnHundredthTick() override { this->UpdateExcludedData(); @@ -1161,7 +1161,7 @@ public: this->companies.NeedResort(); } - virtual void OnPaint() + void OnPaint() override { this->BuildCompanyList(); this->companies.Sort(&PerformanceSorter); @@ -1169,7 +1169,7 @@ public: this->DrawWidgets(); } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { if (widget != WID_CL_BACKGROUND) return; @@ -1197,7 +1197,7 @@ public: } } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { if (widget != WID_CL_BACKGROUND) return; @@ -1236,7 +1236,7 @@ public: } - virtual void OnGameTick() + void OnGameTick() override { if (this->companies.NeedResort()) { this->SetDirty(); @@ -1248,7 +1248,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (data == 0) { /* This needs to be done in command-scope to enforce rebuilding before resorting invalid data */ @@ -1318,7 +1318,7 @@ struct PerformanceRatingDetailWindow : Window { uint score_detail_left; uint score_detail_right; - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_PRD_SCORE_FIRST: @@ -1376,7 +1376,7 @@ struct PerformanceRatingDetailWindow : Window { } } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { /* No need to draw when there's nothing to draw */ if (this->company == INVALID_COMPANY) return; @@ -1455,7 +1455,7 @@ struct PerformanceRatingDetailWindow : Window { } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { /* Check which button is clicked */ if (IsInsideMM(widget, WID_PRD_COMPANY_FIRST, WID_PRD_COMPANY_LAST + 1)) { @@ -1469,7 +1469,7 @@ struct PerformanceRatingDetailWindow : Window { } } - virtual void OnGameTick() + void OnGameTick() override { /* Update the company score every 5 days */ if (--this->timeout == 0) { @@ -1483,7 +1483,7 @@ struct PerformanceRatingDetailWindow : Window { * @param data the company ID of the company that is going to be removed * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; /* Disable the companies who are not active */ diff --git a/src/group_gui.cpp b/src/group_gui.cpp index b5f33ff52..299bf58cc 100644 --- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -359,7 +359,7 @@ public: *this->sorting = this->vehicles.GetListing(); } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_GL_LIST_GROUP: { @@ -423,7 +423,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (data == 0) { /* This needs to be done in command-scope to enforce rebuilding before resorting invalid data */ @@ -447,7 +447,7 @@ public: this->SetDirty(); } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { switch (widget) { case WID_GL_AVAILABLE_VEHICLES: @@ -474,7 +474,7 @@ public: } } - virtual void OnPaint() + void OnPaint() override { /* If we select the all vehicles, this->list will contain all vehicles of the owner * else this->list will contain all vehicles which belong to the selected group */ @@ -529,7 +529,7 @@ public: this->DrawWidgets(); } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (widget) { case WID_GL_ALL_VEHICLES: @@ -628,7 +628,7 @@ public: } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_GL_SORT_BY_ORDER: // Flip sorting method ascending/descending @@ -806,7 +806,7 @@ public: } } - virtual void OnDragDrop(Point pt, int widget) + void OnDragDrop(Point pt, int widget) override { if (this->vehicle_sel != INVALID_VEHICLE) OnDragDrop_Vehicle(pt, widget); if (this->group_sel != INVALID_GROUP) OnDragDrop_Group(pt, widget); @@ -814,19 +814,19 @@ public: _cursor.vehchain = false; } - virtual void OnQueryTextFinished(char *str) + void OnQueryTextFinished(char *str) override { if (str != NULL) DoCommandP(0, this->group_rename, 0, CMD_ALTER_GROUP | CMD_MSG(STR_ERROR_GROUP_CAN_T_RENAME), NULL, str); this->group_rename = INVALID_GROUP; } - virtual void OnResize() + void OnResize() override { this->group_sb->SetCapacityFromWidget(this, WID_GL_LIST_GROUP); this->vscroll->SetCapacityFromWidget(this, WID_GL_LIST_VEHICLE); } - virtual void OnDropdownSelect(int widget, int index) + void OnDropdownSelect(int widget, int index) override { switch (widget) { case WID_GL_SORT_BY_DROPDOWN: @@ -866,14 +866,14 @@ public: this->SetDirty(); } - virtual void OnGameTick() + void OnGameTick() override { if (this->groups.NeedResort() || this->vehicles.NeedResort()) { this->SetDirty(); } } - virtual void OnPlaceObjectAbort() + void OnPlaceObjectAbort() override { /* abort drag & drop */ this->vehicle_sel = INVALID_VEHICLE; @@ -882,7 +882,7 @@ public: this->SetWidgetDirty(WID_GL_LIST_VEHICLE); } - virtual void OnMouseDrag(Point pt, int widget) + void OnMouseDrag(Point pt, int widget) override { if (this->vehicle_sel == INVALID_VEHICLE && this->group_sel == INVALID_GROUP) return; diff --git a/src/highscore_gui.cpp b/src/highscore_gui.cpp index c67aaa170..d6ea8c0c1 100644 --- a/src/highscore_gui.cpp +++ b/src/highscore_gui.cpp @@ -63,12 +63,12 @@ struct EndGameHighScoreBaseWindow : Window { return pt; } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { delete this; } - virtual EventState OnKeyPress(WChar key, uint16 keycode) + EventState OnKeyPress(WChar key, uint16 keycode) override { /* All keys are 'handled' by this window but we want to make * sure that 'quit' still works correctly. Not handling the @@ -129,7 +129,7 @@ struct EndGameWindow : EndGameHighScoreBaseWindow { ShowHighscoreTable(this->window_number, this->rank); } - virtual void OnPaint() + void OnPaint() override { this->SetupHighScoreEndWindow(); Point pt = this->GetTopLeft(640, 480); @@ -177,7 +177,7 @@ struct HighScoreWindow : EndGameHighScoreBaseWindow { if (!_networking && !this->game_paused_by_player) DoCommandP(0, PM_PAUSED_NORMAL, 0, CMD_PAUSE); // unpause } - virtual void OnPaint() + void OnPaint() override { const HighScore *hs = _highscore_table[this->window_number]; diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index 78bf3f4a0..898786ff7 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -403,12 +403,12 @@ public: this->SetButtons(); } - virtual void OnInit() + void OnInit() override { this->SetupArrays(); } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_DPI_MATRIX_WIDGET: { @@ -477,7 +477,7 @@ public: } } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { switch (widget) { case WID_DPI_FUND_WIDGET: @@ -494,7 +494,7 @@ public: } } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (widget) { case WID_DPI_MATRIX_WIDGET: { @@ -581,7 +581,7 @@ public: } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_DPI_MATRIX_WIDGET: { @@ -635,13 +635,13 @@ public: } } - virtual void OnResize() + void OnResize() override { /* Adjust the number of items in the matrix depending of the resize */ this->vscroll->SetCapacityFromWidget(this, WID_DPI_MATRIX_WIDGET); } - virtual void OnPlaceObject(Point pt, TileIndex tile) + void OnPlaceObject(Point pt, TileIndex tile) override { bool success = true; /* We do not need to protect ourselves against "Random Many Industries" in this mode */ @@ -674,7 +674,7 @@ public: if (success && !_settings_client.gui.persistent_buildingtools) ResetObjectToPlace(); } - virtual void OnGameTick() + void OnGameTick() override { if (!this->timer_enabled) return; if (--this->callback_timer == 0) { @@ -697,12 +697,12 @@ public: } } - virtual void OnTimeout() + void OnTimeout() override { this->RaiseButtons(); } - virtual void OnPlaceObjectAbort() + void OnPlaceObjectAbort() override { this->RaiseButtons(); } @@ -712,7 +712,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; this->SetupArrays(); @@ -787,7 +787,7 @@ public: this->InvalidateData(); } - virtual void OnPaint() + void OnPaint() override { this->DrawWidgets(); @@ -924,17 +924,17 @@ public: return y + WD_FRAMERECT_BOTTOM; } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { if (widget == WID_IV_CAPTION) SetDParam(0, this->window_number); } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { if (widget == WID_IV_INFO) size->height = this->info_height; } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_IV_INFO: { @@ -1039,14 +1039,14 @@ public: } } - virtual void OnTimeout() + void OnTimeout() override { this->clicked_line = IL_NONE; this->clicked_button = 0; this->SetDirty(); } - virtual void OnResize() + void OnResize() override { if (this->viewport != NULL) { NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(WID_IV_VIEWPORT); @@ -1056,7 +1056,7 @@ public: } } - virtual void OnQueryTextFinished(char *str) + void OnQueryTextFinished(char *str) override { if (StrEmpty(str)) return; @@ -1082,7 +1082,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; const Industry *i = Industry::Get(this->window_number); @@ -1094,12 +1094,12 @@ public: } } - virtual bool IsNewGRFInspectable() const + bool IsNewGRFInspectable() const override { return ::IsNewGRFInspectable(GSF_INDUSTRIES, this->window_number); } - virtual void ShowNewGRFInspectWindow() const + void ShowNewGRFInspectWindow() const override { ::ShowNewGRFInspectWindow(GSF_INDUSTRIES, this->window_number); } @@ -1357,12 +1357,12 @@ public: this->last_sorting = this->industries.GetListing(); } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { if (widget == WID_ID_DROPDOWN_CRITERIA) SetDParam(0, IndustryDirectoryWindow::sorter_names[this->industries.SortType()]); } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (widget) { case WID_ID_DROPDOWN_ORDER: @@ -1387,7 +1387,7 @@ public: } } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_ID_DROPDOWN_ORDER: { @@ -1425,7 +1425,7 @@ public: } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_ID_DROPDOWN_ORDER: @@ -1451,7 +1451,7 @@ public: } } - virtual void OnDropdownSelect(int widget, int index) + void OnDropdownSelect(int widget, int index) override { if (this->industries.SortType() != index) { this->industries.SetSortType(index); @@ -1459,18 +1459,18 @@ public: } } - virtual void OnResize() + void OnResize() override { this->vscroll->SetCapacityFromWidget(this, WID_ID_INDUSTRY_LIST); } - virtual void OnPaint() + void OnPaint() override { if (this->industries.NeedRebuild()) this->BuildSortIndustriesList(); this->DrawWidgets(); } - virtual void OnHundredthTick() + void OnHundredthTick() override { this->industries.ForceResort(); this->BuildSortIndustriesList(); @@ -1481,7 +1481,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (data == 0) { /* This needs to be done in command-scope to enforce rebuilding before resorting invalid data */ @@ -2172,7 +2172,7 @@ struct IndustryCargoesWindow : public Window { this->OnInvalidateData(id); } - virtual void OnInit() + void OnInit() override { /* Initialize static CargoesField size variables. */ Dimension d = GetStringBoundingBox(STR_INDUSTRY_CARGOES_PRODUCERS); @@ -2219,7 +2219,7 @@ struct IndustryCargoesWindow : public Window { CargoesField::cargo_field_width = CargoesField::HOR_CARGO_BORDER_SPACE * 2 + CargoesField::HOR_CARGO_WIDTH * CargoesField::max_cargoes + CargoesField::HOR_CARGO_SPACE * (CargoesField::max_cargoes - 1); } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_IC_PANEL: @@ -2238,7 +2238,7 @@ struct IndustryCargoesWindow : public Window { CargoesFieldType type; ///< Type of field. - virtual void SetStringParameters (int widget) const + void SetStringParameters (int widget) const override { if (widget != WID_IC_CAPTION) return; @@ -2557,7 +2557,7 @@ struct IndustryCargoesWindow : public Window { * - data = NUM_INDUSTRYTYPES: Stop sending updates to the smallmap window. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; if (data == NUM_INDUSTRYTYPES) { @@ -2572,7 +2572,7 @@ struct IndustryCargoesWindow : public Window { this->ComputeIndustryDisplay(data); } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { if (widget != WID_IC_PANEL) return; @@ -2660,7 +2660,7 @@ struct IndustryCargoesWindow : public Window { return true; } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_IC_PANEL: { @@ -2738,7 +2738,7 @@ struct IndustryCargoesWindow : public Window { } } - virtual void OnDropdownSelect(int widget, int index) + void OnDropdownSelect(int widget, int index) override { if (index < 0) return; @@ -2753,7 +2753,7 @@ struct IndustryCargoesWindow : public Window { } } - bool OnTooltip(Point pt, int widget, TooltipCloseCondition close_cond) + bool OnTooltip(Point pt, int widget, TooltipCloseCondition close_cond) override { if (widget != WID_IC_PANEL) return false; @@ -2795,7 +2795,7 @@ struct IndustryCargoesWindow : public Window { return false; } - virtual void OnResize() + void OnResize() override { this->vscroll->SetCapacityFromWidget(this, WID_IC_PANEL); } diff --git a/src/intro_gui.cpp b/src/intro_gui.cpp index 001afde1d..307be4405 100644 --- a/src/intro_gui.cpp +++ b/src/intro_gui.cpp @@ -49,7 +49,7 @@ struct SelectGameWindow : public Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; this->SetWidgetLoweredState(WID_SGI_TEMPERATE_LANDSCAPE, _settings_newgame.game_creation.landscape == LT_TEMPERATE); @@ -58,7 +58,7 @@ struct SelectGameWindow : public Window { this->SetWidgetLoweredState(WID_SGI_TOYLAND_LANDSCAPE, _settings_newgame.game_creation.landscape == LT_TOYLAND); } - virtual void OnInit() + void OnInit() override { bool missing_sprites = _missing_extra_graphics > 0 && !IsReleasedVersion(); this->GetWidget<NWidgetStacked>(WID_SGI_BASESET_SELECTION)->SetDisplayedPlane(missing_sprites ? 0 : SZSP_NONE); @@ -67,7 +67,7 @@ struct SelectGameWindow : public Window { this->GetWidget<NWidgetStacked>(WID_SGI_TRANSLATION_SELECTION)->SetDisplayedPlane(missing_lang ? 0 : SZSP_NONE); } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (widget) { case WID_SGI_BASESET: @@ -82,7 +82,7 @@ struct SelectGameWindow : public Window { } } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { StringID str = 0; switch (widget) { @@ -111,7 +111,7 @@ struct SelectGameWindow : public Window { } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { /* Do not create a network server when you (just) have closed one of the game * creation/load windows for the network server. */ diff --git a/src/linkgraph/linkgraph_gui.h b/src/linkgraph/linkgraph_gui.h index 17fcd28b2..b913bb1f4 100644 --- a/src/linkgraph/linkgraph_gui.h +++ b/src/linkgraph/linkgraph_gui.h @@ -104,11 +104,11 @@ public: LinkGraphLegendWindow(WindowDesc *desc, int window_number); void SetOverlay(LinkGraphOverlay *overlay); - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize); - virtual void DrawWidget(const Rect &r, int widget) const; - virtual bool OnTooltip(Point pt, int widget, TooltipCloseCondition close_cond); - virtual void OnClick(Point pt, int widget, int click_count); - virtual void OnInvalidateData(int data = 0, bool gui_scope = true); + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override; + void DrawWidget(const Rect &r, int widget) const override; + bool OnTooltip(Point pt, int widget, TooltipCloseCondition close_cond) override; + void OnClick(Point pt, int widget, int click_count) override; + void OnInvalidateData(int data = 0, bool gui_scope = true) override; private: LinkGraphOverlay *overlay; diff --git a/src/main_gui.cpp b/src/main_gui.cpp index 7ab9bebb1..808484b0e 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -250,7 +250,7 @@ struct MainWindow : Window this->refresh.SetInterval(LINKGRAPH_DELAY); } - virtual void OnRealtimeTick(uint delta_ms) + void OnRealtimeTick(uint delta_ms) override { if (!this->refresh.Elapsed(delta_ms)) return; @@ -265,7 +265,7 @@ struct MainWindow : Window this->GetWidget<NWidgetBase>(WID_M_VIEWPORT)->SetDirty(this); } - virtual void OnPaint() + void OnPaint() override { this->DrawWidgets(); if (_game_mode == GM_MENU) { @@ -285,7 +285,7 @@ struct MainWindow : Window } } - virtual EventState OnHotkey(int hotkey) + EventState OnHotkey(int hotkey) override { if (hotkey == GHK_QUIT) { HandleExitGameRequest(); @@ -424,7 +424,7 @@ struct MainWindow : Window return ES_HANDLED; } - virtual void OnScroll(Point delta) + void OnScroll(Point delta) override { this->viewport->scrollpos_x += ScaleByZoom(delta.x, this->viewport->zoom); this->viewport->scrollpos_y += ScaleByZoom(delta.y, this->viewport->zoom); @@ -433,14 +433,14 @@ struct MainWindow : Window this->refresh.SetInterval(LINKGRAPH_DELAY); } - virtual void OnMouseWheel(int wheel) + void OnMouseWheel(int wheel) override { if (_settings_client.gui.scrollwheel_scrolling != 2) { ZoomInOrOutToCursorWindow(wheel < 0, this); } } - virtual void OnResize() + void OnResize() override { if (this->viewport != NULL) { NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(WID_M_VIEWPORT); @@ -454,7 +454,7 @@ struct MainWindow : Window * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; /* Forward the message to the appropriate toolbar (ingame or scenario editor) */ diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index 061070a2b..4aeb81736 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -72,7 +72,7 @@ public: char landinfo_data[LAND_INFO_LINE_END][LAND_INFO_LINE_BUFF_SIZE]; TileIndex tile; - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { if (widget != WID_LI_BACKGROUND) return; @@ -91,7 +91,7 @@ public: } } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { if (widget != WID_LI_BACKGROUND) return; @@ -137,7 +137,7 @@ public: #undef LANDINFOD_LEVEL } - virtual void OnInit() + void OnInit() override { Town *t = ClosestTownFromTile(tile, _settings_game.economy.dist_local_authority); @@ -328,12 +328,12 @@ public: if (!found) this->landinfo_data[LAND_INFO_MULTICENTER_LINE][0] = '\0'; } - virtual bool IsNewGRFInspectable() const + bool IsNewGRFInspectable() const override { return ::IsNewGRFInspectable(GetGrfSpecFeature(this->tile), this->tile); } - virtual void ShowNewGRFInspectWindow() const + void ShowNewGRFInspectWindow() const override { ::ShowNewGRFInspectWindow(GetGrfSpecFeature(this->tile), this->tile); } @@ -343,7 +343,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; switch (data) { @@ -469,12 +469,12 @@ struct AboutWindow : public Window { this->timer.SetInterval(TIMER_INTERVAL); } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { if (widget == WID_A_WEBSITE) SetDParamStr(0, "Website: http://www.openttd.org"); } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { if (widget != WID_A_SCROLLING_TEXT) return; @@ -490,7 +490,7 @@ struct AboutWindow : public Window { *size = maxdim(*size, d); } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { if (widget != WID_A_SCROLLING_TEXT) return; @@ -505,7 +505,7 @@ struct AboutWindow : public Window { } } - virtual void OnRealtimeTick(uint delta_ms) + void OnRealtimeTick(uint delta_ms) override { uint count = this->timer.CountElapsed(delta_ms); if (count > 0) { @@ -667,7 +667,7 @@ struct TooltipsWindow : public Window CLRBITS(this->flags, WF_WHITE_BORDER); } - virtual Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number) + Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number) override { /* Find the free screen space between the main toolbar at the top, and the statusbar at the bottom. * Add a fixed distance 2 so the tooltip floats free from both bars. @@ -687,7 +687,7 @@ struct TooltipsWindow : public Window return pt; } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { /* There is only one widget. */ for (uint i = 0; i != this->paramcount; i++) SetDParam(i, this->params[i]); @@ -700,7 +700,7 @@ struct TooltipsWindow : public Window size->height += 2 + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM; } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { /* There is only one widget. */ GfxFillRect(r.left, r.top, r.right, r.bottom, PC_BLACK); @@ -712,7 +712,7 @@ struct TooltipsWindow : public Window DrawStringMultiLine(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, r.bottom - WD_FRAMERECT_BOTTOM, this->string_id, TC_FROMSTRING, SA_CENTER); } - virtual void OnMouseLoop() + void OnMouseLoop() override { /* Always close tooltips when the cursor is not in our window. */ if (!_cursor.in_window) { @@ -973,7 +973,7 @@ struct QueryStringWindow : public Window this->SetFocusedWidget(WID_QS_TEXT); } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { if (widget == WID_QS_DEFAULT && (this->flags & QSF_ENABLE_DEFAULT) == 0) { /* We don't want this widget to show! */ @@ -983,7 +983,7 @@ struct QueryStringWindow : public Window } } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { if (widget == WID_QS_CAPTION) SetDParam(0, this->editbox.caption); } @@ -1002,7 +1002,7 @@ struct QueryStringWindow : public Window } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_QS_DEFAULT: @@ -1097,7 +1097,7 @@ struct QueryWindow : public Window { if (this->proc != NULL) this->proc(this->parent, false); } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { switch (widget) { case WID_Q_CAPTION: @@ -1111,7 +1111,7 @@ struct QueryWindow : public Window { } } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { if (widget != WID_Q_TEXT) return; @@ -1121,7 +1121,7 @@ struct QueryWindow : public Window { *size = d; } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { if (widget != WID_Q_TEXT) return; @@ -1129,7 +1129,7 @@ struct QueryWindow : public Window { this->message, TC_FROMSTRING, SA_CENTER); } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_Q_YES: { @@ -1152,7 +1152,7 @@ struct QueryWindow : public Window { } } - virtual EventState OnKeyPress(WChar key, uint16 keycode) + EventState OnKeyPress(WChar key, uint16 keycode) override { /* ESC closes the window, Enter confirms the action */ switch (keycode) { diff --git a/src/music_gui.cpp b/src/music_gui.cpp index 885647427..da63192e0 100644 --- a/src/music_gui.cpp +++ b/src/music_gui.cpp @@ -459,7 +459,7 @@ struct MusicTrackSelectionWindow : public Window { this->LowerWidget(WID_MTS_ALL + _settings_client.music.playlist); } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { switch (widget) { case WID_MTS_PLAYLIST: @@ -476,7 +476,7 @@ struct MusicTrackSelectionWindow : public Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; for (int i = 0; i < 6; i++) { @@ -486,7 +486,7 @@ struct MusicTrackSelectionWindow : public Window { this->SetDirty(); } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_MTS_PLAYLIST: { @@ -521,7 +521,7 @@ struct MusicTrackSelectionWindow : public Window { } } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (widget) { case WID_MTS_LIST_LEFT: { @@ -554,7 +554,7 @@ struct MusicTrackSelectionWindow : public Window { } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_MTS_LIST_LEFT: { // add to playlist @@ -587,7 +587,7 @@ struct MusicTrackSelectionWindow : public Window { } } - virtual void OnDropdownSelect(int widget, int index) + void OnDropdownSelect(int widget, int index) override { switch (widget) { case WID_MTS_MUSICSET: @@ -672,7 +672,7 @@ struct MusicWindow : public Window { ); } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { /* Make sure that WID_M_SHUFFLE and WID_M_PROGRAMME have the same size. @@ -714,7 +714,7 @@ struct MusicWindow : public Window { } } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (widget) { case WID_M_TRACK_NR: { @@ -763,7 +763,7 @@ struct MusicWindow : public Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; for (int i = 0; i < 6; i++) { @@ -775,7 +775,7 @@ struct MusicWindow : public Window { this->SetDirty(); } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_M_PREV: // skip to prev diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp index 94e289885..21607e9e8 100644 --- a/src/network/network_chat_gui.cpp +++ b/src/network/network_chat_gui.cpp @@ -320,7 +320,7 @@ struct NetworkChatWindow : public Window { InvalidateWindowData(WC_NEWS_WINDOW, 0, 0); } - virtual void FindWindowPlacementAndResize(int def_width, int def_height) + void FindWindowPlacementAndResize(int def_width, int def_height) override { Window::FindWindowPlacementAndResize(_toolbar_width, def_height); } @@ -458,13 +458,13 @@ struct NetworkChatWindow : public Window { free(pre_buf); } - virtual Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number) + Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number) override { Point pt = { 0, _screen.height - sm_height - FindWindowById(WC_STATUS_BAR, 0)->height }; return pt; } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { if (widget != WID_NC_DESTINATION) return; @@ -477,7 +477,7 @@ struct NetworkChatWindow : public Window { *size = maxdim(*size, d); } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { if (widget != WID_NC_DESTINATION) return; @@ -487,7 +487,7 @@ struct NetworkChatWindow : public Window { DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, this->dest_string, TC_BLACK, SA_RIGHT); } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_NC_SENDBUTTON: /* Send */ @@ -500,7 +500,7 @@ struct NetworkChatWindow : public Window { } } - virtual EventState OnKeyPress(WChar key, uint16 keycode) + EventState OnKeyPress(WChar key, uint16 keycode) override { EventState state = ES_NOT_HANDLED; if (keycode == WKC_TAB) { @@ -510,7 +510,7 @@ struct NetworkChatWindow : public Window { return state; } - virtual void OnEditboxChanged(int wid) + void OnEditboxChanged(int wid) override { _chat_tab_completion_active = false; } @@ -520,7 +520,7 @@ struct NetworkChatWindow : public Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (data == this->dest) delete this; } diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp index 321a53bc7..49ecf2b24 100644 --- a/src/network/network_content_gui.cpp +++ b/src/network/network_content_gui.cpp @@ -257,7 +257,7 @@ public: InvalidateWindowData(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_CONTENT_LIST, 2); } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { if (widget == WID_NCDS_CANCELOK) { if (this->downloaded_bytes != this->total_bytes) { @@ -271,7 +271,7 @@ public: } } - virtual void OnDownloadProgress(const ContentInfo *ci, int bytes) + void OnDownloadProgress(const ContentInfo *ci, int bytes) override { BaseNetworkContentDownloadStatusWindow::OnDownloadProgress(ci, bytes); this->receivedTypes.Include(ci->type); @@ -562,7 +562,7 @@ public: _network_content_client.RemoveCallback(this); } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_NCL_FILTER_CAPT: @@ -590,7 +590,7 @@ public: } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (widget) { case WID_NCL_FILTER_CAPT: @@ -607,7 +607,7 @@ public: } } - virtual void OnPaint() + void OnPaint() override { const SortButtonState arrow = this->content.IsDescSortOrder() ? SBS_DOWN : SBS_UP; @@ -779,7 +779,7 @@ public: } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { if (widget >= WID_NCL_TEXTFILE && widget < WID_NCL_TEXTFILE + TFT_END) { if (this->selected == NULL || this->selected->state != ContentInfo::ALREADY_HERE) return; @@ -865,7 +865,7 @@ public: } } - virtual EventState OnKeyPress(WChar key, uint16 keycode) + EventState OnKeyPress(WChar key, uint16 keycode) override { switch (keycode) { case WKC_UP: @@ -937,7 +937,7 @@ public: return ES_HANDLED; } - virtual void OnEditboxChanged(int wid) + void OnEditboxChanged(int wid) override { if (wid == WID_NCL_FILTER) { this->filter_data.string_filter.SetFilterTerm(this->filter_editbox.text.buf); @@ -947,25 +947,25 @@ public: } } - virtual void OnResize() + void OnResize() override { this->vscroll->SetCapacityFromWidget(this, WID_NCL_MATRIX); } - virtual void OnReceiveContentInfo(const ContentInfo *rci) + void OnReceiveContentInfo(const ContentInfo *rci) override { if (this->auto_select && !rci->IsSelected()) _network_content_client.ToggleSelectedState(rci); this->content.ForceRebuild(); this->InvalidateData(); } - virtual void OnDownloadComplete(ContentID cid) + void OnDownloadComplete(ContentID cid) override { this->content.ForceResort(); this->InvalidateData(); } - virtual void OnConnect(bool success) + void OnConnect(bool success) override { if (!success) { ShowErrorMessage(STR_CONTENT_ERROR_COULD_NOT_CONNECT, INVALID_STRING_ID, WL_ERROR); @@ -981,7 +981,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; if (this->content.NeedRebuild()) this->BuildContentList(); diff --git a/src/network/network_content_gui.h b/src/network/network_content_gui.h index 139701001..8afd245d7 100644 --- a/src/network/network_content_gui.h +++ b/src/network/network_content_gui.h @@ -39,8 +39,8 @@ public: */ ~BaseNetworkContentDownloadStatusWindow(); - virtual void DrawWidget(const Rect &r, int widget) const; - virtual void OnDownloadProgress(const ContentInfo *ci, int bytes); + void DrawWidget(const Rect &r, int widget) const override; + void OnDownloadProgress(const ContentInfo *ci, int bytes) override; }; void BuildContentTypeStringList(); diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index f90370312..b12aaa823 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -494,7 +494,7 @@ public: this->last_sorting = this->servers.GetListing(); } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { switch (widget) { case WID_NG_CONN_BTN: @@ -503,7 +503,7 @@ public: } } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_NG_CONN_BTN: @@ -558,7 +558,7 @@ public: } } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (widget) { case WID_NG_MATRIX: { @@ -595,7 +595,7 @@ public: } - virtual void OnPaint() + void OnPaint() override { if (this->servers.NeedRebuild()) { this->BuildGUINetworkGameList(); @@ -691,7 +691,7 @@ public: } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_NG_CANCEL: // Cancel button @@ -788,7 +788,7 @@ public: } } - virtual void OnDropdownSelect(int widget, int index) + void OnDropdownSelect(int widget, int index) override { switch (widget) { case WID_NG_CONN_BTN: @@ -807,13 +807,13 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { this->servers.ForceRebuild(); this->SetDirty(); } - virtual EventState OnKeyPress(WChar key, uint16 keycode) + EventState OnKeyPress(WChar key, uint16 keycode) override { EventState state = ES_NOT_HANDLED; @@ -874,7 +874,7 @@ public: return state; } - virtual void OnEditboxChanged(int wid) + void OnEditboxChanged(int wid) override { switch (wid) { case WID_NG_FILTER: { @@ -896,17 +896,17 @@ public: } } - virtual void OnQueryTextFinished(char *str) + void OnQueryTextFinished(char *str) override { if (!StrEmpty(str)) NetworkAddServer(str); } - virtual void OnResize() + void OnResize() override { this->vscroll->SetCapacityFromWidget(this, WID_NG_MATRIX); } - virtual void OnRealtimeTick(uint delta_ms) + void OnRealtimeTick(uint delta_ms) override { if (!this->requery_timer.Elapsed(delta_ms)) return; this->requery_timer.SetInterval(MILLISECONDS_PER_TICK); @@ -1067,7 +1067,7 @@ struct NetworkStartServerWindow : public Window { this->SetFocusedWidget(WID_NSS_GAMENAME); } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { switch (widget) { case WID_NSS_CONNTYPE_BTN: @@ -1092,7 +1092,7 @@ struct NetworkStartServerWindow : public Window { } } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_NSS_CONNTYPE_BTN: @@ -1103,7 +1103,7 @@ struct NetworkStartServerWindow : public Window { } } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (widget) { case WID_NSS_SETPWD: @@ -1112,7 +1112,7 @@ struct NetworkStartServerWindow : public Window { } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_NSS_CANCEL: // Cancel button @@ -1208,7 +1208,7 @@ struct NetworkStartServerWindow : public Window { } } - virtual void OnDropdownSelect(int widget, int index) + void OnDropdownSelect(int widget, int index) override { switch (widget) { case WID_NSS_CONNTYPE_BTN: @@ -1224,14 +1224,14 @@ struct NetworkStartServerWindow : public Window { this->SetDirty(); } - virtual void OnEditboxChanged(int wid) + void OnEditboxChanged(int wid) override { if (wid == WID_NSS_GAMENAME) { strecpy(_settings_client.network.server_name, this->name_editbox.text.buf, lastof(_settings_client.network.server_name)); } } - virtual void OnTimeout() + void OnTimeout() override { static const int raise_widgets[] = {WID_NSS_CLIENTS_BTND, WID_NSS_CLIENTS_BTNU, WID_NSS_COMPANIES_BTND, WID_NSS_COMPANIES_BTNU, WID_NSS_SPECTATORS_BTND, WID_NSS_SPECTATORS_BTNU, WIDGET_LIST_END}; for (const int *widget = raise_widgets; *widget != WIDGET_LIST_END; widget++) { @@ -1242,7 +1242,7 @@ struct NetworkStartServerWindow : public Window { } } - virtual void OnQueryTextFinished(char *str) + void OnQueryTextFinished(char *str) override { if (str == NULL) return; @@ -1384,7 +1384,7 @@ struct NetworkLobbyWindow : public Window { return COMPANY_FIRST; } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_NL_HEADER: @@ -1402,7 +1402,7 @@ struct NetworkLobbyWindow : public Window { } } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { switch (widget) { case WID_NL_TEXT: @@ -1411,7 +1411,7 @@ struct NetworkLobbyWindow : public Window { } } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (widget) { case WID_NL_DETAILS: @@ -1424,7 +1424,7 @@ struct NetworkLobbyWindow : public Window { } } - virtual void OnPaint() + void OnPaint() override { const NetworkGameInfo *gi = &this->server->info; @@ -1546,7 +1546,7 @@ struct NetworkLobbyWindow : public Window { DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_NETWORK_GAME_LOBBY_PLAYERS); // players } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_NL_CANCEL: // Cancel button @@ -1585,7 +1585,7 @@ struct NetworkLobbyWindow : public Window { } } - virtual void OnResize() + void OnResize() override { this->vscroll->SetCapacityFromWidget(this, WID_NL_MATRIX); } @@ -1777,12 +1777,12 @@ struct NetworkClientListPopupWindow : Window { CLRBITS(this->flags, WF_WHITE_BORDER); } - virtual Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number) + Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number) override { return this->desired_location; } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { Dimension d = *size; for (const ClientListAction *action = this->actions.Begin(); action != this->actions.End(); action++) { @@ -1795,7 +1795,7 @@ struct NetworkClientListPopupWindow : Window { *size = d; } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { /* Draw the actions */ int sel = this->sel_index; @@ -1813,7 +1813,7 @@ struct NetworkClientListPopupWindow : Window { } } - virtual void OnMouseLoop() + void OnMouseLoop() override { /* We selected an action */ uint index = (_cursor.pos.y - this->top - WD_FRAMERECT_TOP) / FONT_HEIGHT_NORMAL; @@ -1904,7 +1904,7 @@ struct NetworkClientListWindow : Window { return true; } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { if (widget != WID_CL_PANEL) return; @@ -1921,7 +1921,7 @@ struct NetworkClientListWindow : Window { size->width = WD_FRAMERECT_LEFT + this->server_client_width + this->icon_size.width + WD_FRAMERECT_LEFT + width + WD_FRAMERECT_RIGHT; } - virtual void OnPaint() + void OnPaint() override { /* Check if we need to reset the height */ if (!this->CheckClientListHeight()) return; @@ -1929,7 +1929,7 @@ struct NetworkClientListWindow : Window { this->DrawWidgets(); } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { if (widget != WID_CL_PANEL) return; @@ -1975,7 +1975,7 @@ struct NetworkClientListWindow : Window { } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { /* Show the popup with option */ if (this->selected_item != -1) { @@ -1991,7 +1991,7 @@ struct NetworkClientListWindow : Window { } } - virtual void OnMouseOver(Point pt, int widget) + void OnMouseOver(Point pt, int widget) override { /* -1 means we left the current window */ if (pt.y == -1) { @@ -2035,7 +2035,7 @@ struct NetworkJoinStatusWindow : Window { this->InitNested(WN_NETWORK_STATUS_WINDOW_JOIN); } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { if (widget != WID_NJS_BACKGROUND) return; @@ -2069,7 +2069,7 @@ struct NetworkJoinStatusWindow : Window { DrawFrameRect(r.left + 20, r.top + 5, (int)((this->width - 20) * progress / 100), r.top + 15, COLOUR_MAUVE, FR_NONE); } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { if (widget != WID_NJS_BACKGROUND) return; @@ -2095,7 +2095,7 @@ struct NetworkJoinStatusWindow : Window { size->width = width + WD_FRAMERECT_LEFT + WD_FRAMERECT_BOTTOM + 10; } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { if (widget == WID_NJS_CANCELOK) { // Disconnect button NetworkDisconnect(); @@ -2104,7 +2104,7 @@ struct NetworkJoinStatusWindow : Window { } } - virtual void OnQueryTextFinished(char *str) + void OnQueryTextFinished(char *str) override { if (StrEmpty(str)) { NetworkDisconnect(); @@ -2184,7 +2184,7 @@ struct NetworkCompanyPasswordWindow : public Window { NetworkChangeCompanyPassword(_local_company, this->password_editbox.text.buf); } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_NCP_OK: diff --git a/src/newgrf_debug_gui.cpp b/src/newgrf_debug_gui.cpp index 75b06967f..e8fc4efcc 100644 --- a/src/newgrf_debug_gui.cpp +++ b/src/newgrf_debug_gui.cpp @@ -363,14 +363,14 @@ struct NewGRFInspectWindow : Window { this->OnInvalidateData(0, true); } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { if (widget != WID_NGRFI_CAPTION) return; GetFeatureHelper(this->window_number)->SetStringParameters(this->GetFeatureIndex()); } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_NGRFI_VEH_CHAIN: { @@ -410,7 +410,7 @@ struct NewGRFInspectWindow : Window { ::DrawString(r.left + LEFT_OFFSET, r.right - RIGHT_OFFSET, r.top + TOP_OFFSET + (offset * this->resize.step_height), buf, TC_BLACK); } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (widget) { case WID_NGRFI_VEH_CHAIN: { @@ -550,7 +550,7 @@ struct NewGRFInspectWindow : Window { const_cast<NewGRFInspectWindow*>(this)->vscroll->SetCount(i); } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_NGRFI_PARENT: { @@ -600,7 +600,7 @@ struct NewGRFInspectWindow : Window { } } - virtual void OnQueryTextFinished(char *str) + void OnQueryTextFinished(char *str) override { if (StrEmpty(str)) return; @@ -608,7 +608,7 @@ struct NewGRFInspectWindow : Window { this->SetDirty(); } - virtual void OnResize() + void OnResize() override { this->vscroll->SetCapacityFromWidget(this, WID_NGRFI_MAINPANEL, TOP_OFFSET + BOTTOM_OFFSET); } @@ -618,7 +618,7 @@ struct NewGRFInspectWindow : Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; if (this->HasChainIndex()) { @@ -822,7 +822,7 @@ struct SpriteAlignerWindow : Window { while (GetSpriteType(this->current_sprite) != ST_NORMAL) this->current_sprite++; } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { const Sprite *spr = GetSprite(this->current_sprite, ST_NORMAL); switch (widget) { @@ -856,7 +856,7 @@ struct SpriteAlignerWindow : Window { } } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { if (widget != WID_SA_LIST) return; @@ -867,7 +867,7 @@ struct SpriteAlignerWindow : Window { size->height = (1 + 200 / resize->height) * resize->height; } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (widget) { case WID_SA_SPRITE: { @@ -908,7 +908,7 @@ struct SpriteAlignerWindow : Window { } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_SA_PREVIOUS: @@ -992,7 +992,7 @@ struct SpriteAlignerWindow : Window { } } - virtual void OnQueryTextFinished(char *str) + void OnQueryTextFinished(char *str) override { if (StrEmpty(str)) return; @@ -1009,7 +1009,7 @@ struct SpriteAlignerWindow : Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; if (data == 1) { @@ -1019,7 +1019,7 @@ struct SpriteAlignerWindow : Window { } } - virtual void OnResize() + void OnResize() override { this->vscroll->SetCapacityFromWidget(this, WID_SA_LIST); } diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index adf38b164..37844423a 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -190,7 +190,7 @@ struct NewGRFParametersWindow : public Window { return &dummy_parameter_info; } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_NP_NUMPAR_DEC: @@ -234,7 +234,7 @@ struct NewGRFParametersWindow : public Window { } } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { switch (widget) { case WID_NP_NUMPAR: @@ -243,7 +243,7 @@ struct NewGRFParametersWindow : public Window { } } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { if (widget == WID_NP_DESCRIPTION) { const GRFParameterInfo *par_info = (this->clicked_row < this->grf_config->param_info.Length()) ? this->grf_config->param_info[this->clicked_row] : NULL; @@ -304,7 +304,7 @@ struct NewGRFParametersWindow : public Window { } } - virtual void OnPaint() + void OnPaint() override { if (this->closing_dropdown) { this->closing_dropdown = false; @@ -313,7 +313,7 @@ struct NewGRFParametersWindow : public Window { this->DrawWidgets(); } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_NP_NUMPAR_DEC: @@ -427,7 +427,7 @@ struct NewGRFParametersWindow : public Window { } } - virtual void OnQueryTextFinished(char *str) + void OnQueryTextFinished(char *str) override { if (StrEmpty(str)) return; int32 value = atoi(str); @@ -438,7 +438,7 @@ struct NewGRFParametersWindow : public Window { this->SetDirty(); } - virtual void OnDropdownSelect(int widget, int index) + void OnDropdownSelect(int widget, int index) override { assert(this->clicked_dropdown); GRFParameterInfo *par_info = ((uint)this->clicked_row < this->grf_config->param_info.Length()) ? this->grf_config->param_info[this->clicked_row] : NULL; @@ -447,7 +447,7 @@ struct NewGRFParametersWindow : public Window { this->SetDirty(); } - virtual void OnDropdownClose(Point pt, int widget, int index, bool instant_close) + void OnDropdownClose(Point pt, int widget, int index, bool instant_close) override { /* We cannot raise the dropdown button just yet. OnClick needs some hint, whether * the same dropdown button was clicked again, and then not open the dropdown again. @@ -458,7 +458,7 @@ struct NewGRFParametersWindow : public Window { this->SetDirty(); } - virtual void OnResize() + void OnResize() override { this->vscroll->SetCapacityFromWidget(this, WID_NP_BACKGROUND); } @@ -468,7 +468,7 @@ struct NewGRFParametersWindow : public Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; if (!this->action14present) { @@ -483,7 +483,7 @@ struct NewGRFParametersWindow : public Window { } } - virtual void OnRealtimeTick(uint delta_ms) + void OnRealtimeTick(uint delta_ms) override { if (timeout.Elapsed(delta_ms)) { this->clicked_button = UINT_MAX; @@ -718,7 +718,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { } } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_NS_FILE_LIST: @@ -769,13 +769,13 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { } } - virtual void OnResize() + void OnResize() override { this->vscroll->SetCapacityFromWidget(this, WID_NS_FILE_LIST); this->vscroll2->SetCapacityFromWidget(this, WID_NS_AVAIL_LIST); } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { switch (widget) { case WID_NS_PRESET_LIST: @@ -824,7 +824,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { return pal; } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (widget) { case WID_NS_FILE_LIST: { @@ -913,7 +913,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { if (widget >= WID_NS_NEWGRF_TEXTFILE && widget < WID_NS_NEWGRF_TEXTFILE + TFT_END) { if (this->active_sel == NULL && this->avail_sel == NULL) return; @@ -1139,7 +1139,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { } } - virtual void OnNewGRFsScanned() + void OnNewGRFsScanned() override { if (this->active_sel == NULL) DeleteWindowByClass(WC_TEXTFILE); this->avail_sel = NULL; @@ -1148,7 +1148,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { this->DeleteChildWindows(WC_QUERY_STRING); // Remove the parameter query window } - virtual void OnDropdownSelect(int widget, int index) + void OnDropdownSelect(int widget, int index) override { if (!this->editable) return; @@ -1167,7 +1167,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { this->InvalidateData(GOID_NEWGRF_PRESET_LOADED); } - virtual void OnQueryTextFinished(char *str) + void OnQueryTextFinished(char *str) override { if (str == NULL) return; @@ -1190,7 +1190,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { * @param data Information about the changed data. @see GameOptionsInvalidationData * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; switch (data) { @@ -1296,7 +1296,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { this->SetWidgetDisabledState(WID_NS_PRESET_SAVE, has_missing); } - virtual EventState OnKeyPress(WChar key, uint16 keycode) + EventState OnKeyPress(WChar key, uint16 keycode) override { if (!this->editable) return ES_NOT_HANDLED; @@ -1348,7 +1348,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { return ES_HANDLED; } - virtual void OnEditboxChanged(int wid) + void OnEditboxChanged(int wid) override { if (!this->editable) return; @@ -1358,7 +1358,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { this->InvalidateData(0); } - virtual void OnDragDrop(Point pt, int widget) + void OnDragDrop(Point pt, int widget) override { if (!this->editable) return; @@ -1406,7 +1406,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { } } - virtual void OnMouseDrag(Point pt, int widget) + void OnMouseDrag(Point pt, int widget) override { if (!this->editable) return; @@ -1605,7 +1605,7 @@ public: this->editable = true; // Temporary setting, 'real' value is set in SetupSmallestSize(). } - virtual void SetupSmallestSize(Window *w, bool init_array) + void SetupSmallestSize(Window *w, bool init_array) override { /* Copy state flag from the window. */ assert(dynamic_cast<NewGRFWindow *>(w) != NULL); @@ -1648,7 +1648,7 @@ public: this->smallest_y = ComputeMaxSize(min_acs_height, this->smallest_y + this->resize_y - 1, this->resize_y); } - virtual void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) + void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override { this->StoreSizePosition(sizing, x, y, given_width, given_height); @@ -1767,7 +1767,7 @@ public: } } - virtual NWidgetCore *GetWidgetFromPos(int x, int y) + NWidgetCore *GetWidgetFromPos(int x, int y) override { if (!IsInsideBS(x, this->pos_x, this->current_x) || !IsInsideBS(y, this->pos_y, this->current_y)) return NULL; @@ -1777,7 +1777,7 @@ public: return nw; } - virtual void Draw(const Window *w) + void Draw(const Window *w) override { if (this->editable) this->avs->Draw(w); this->acs->Draw(w); @@ -2074,7 +2074,7 @@ struct SavePresetWindow : public Window { { } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_SVP_PRESET_LIST: { @@ -2091,7 +2091,7 @@ struct SavePresetWindow : public Window { } } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (widget) { case WID_SVP_PRESET_LIST: { @@ -2115,7 +2115,7 @@ struct SavePresetWindow : public Window { } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_SVP_PRESET_LIST: { @@ -2142,7 +2142,7 @@ struct SavePresetWindow : public Window { } } - virtual void OnResize() + void OnResize() override { this->vscroll->SetCapacityFromWidget(this, WID_SVP_PRESET_LIST); } @@ -2197,7 +2197,7 @@ struct ScanProgressWindow : public Window { free(last_name); } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_SP_PROGRESS_BAR: { @@ -2220,7 +2220,7 @@ struct ScanProgressWindow : public Window { } } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (widget) { case WID_SP_PROGRESS_BAR: { diff --git a/src/news_gui.cpp b/src/news_gui.cpp index b79418c89..59c75eb51 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -308,13 +308,13 @@ struct NewsWindow : Window { GfxFillRect(r.left, r.bottom, r.right, r.bottom, PC_BLACK); } - virtual Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number) + Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number) override { Point pt = { 0, _screen.height }; return pt; } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { StringID str = STR_NULL; switch (widget) { @@ -365,12 +365,12 @@ struct NewsWindow : Window { *size = maxdim(*size, d); } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { if (widget == WID_N_DATE) SetDParam(0, this->ni->date); } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (widget) { case WID_N_CAPTION: @@ -427,7 +427,7 @@ struct NewsWindow : Window { } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_N_CLOSEBOX: @@ -466,7 +466,7 @@ struct NewsWindow : Window { } } - virtual EventState OnKeyPress(WChar key, uint16 keycode) + EventState OnKeyPress(WChar key, uint16 keycode) override { if (keycode == WKC_SPACE) { /* Don't continue. */ @@ -481,7 +481,7 @@ struct NewsWindow : Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; /* The chatbar has notified us that is was either created or closed */ @@ -490,7 +490,7 @@ struct NewsWindow : Window { this->SetWindowTop(newtop); } - virtual void OnRealtimeTick(uint delta_ms) + void OnRealtimeTick(uint delta_ms) override { int count = this->timer.CountElapsed(delta_ms); if (count > 0) { @@ -1024,7 +1024,7 @@ struct MessageHistoryWindow : Window { this->OnInvalidateData(0); } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { if (widget == WID_MH_BACKGROUND) { this->line_height = FONT_HEIGHT_NORMAL + 2; @@ -1040,13 +1040,13 @@ struct MessageHistoryWindow : Window { } } - virtual void OnPaint() + void OnPaint() override { this->OnInvalidateData(0); this->DrawWidgets(); } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { if (widget != WID_MH_BACKGROUND || _total_news == 0) return; @@ -1081,13 +1081,13 @@ struct MessageHistoryWindow : Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; this->vscroll->SetCount(_total_news); } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { if (widget == WID_MH_BACKGROUND) { NewsItem *ni = _latest_news; @@ -1102,7 +1102,7 @@ struct MessageHistoryWindow : Window { } } - virtual void OnResize() + void OnResize() override { this->vscroll->SetCapacityFromWidget(this, WID_MH_BACKGROUND); } diff --git a/src/object_gui.cpp b/src/object_gui.cpp index 8aabcfdc4..6684566f1 100644 --- a/src/object_gui.cpp +++ b/src/object_gui.cpp @@ -99,7 +99,7 @@ public: this->GetWidget<NWidgetMatrix>(WID_BO_OBJECT_MATRIX)->SetCount(4); } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { switch (widget) { case WID_BO_OBJECT_NAME: { @@ -120,7 +120,7 @@ public: } } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_BO_CLASS_LIST: { @@ -210,7 +210,7 @@ public: } } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (GB(widget, 0, 16)) { case WID_BO_CLASS_LIST: { @@ -382,12 +382,12 @@ public: this->SetDirty(); } - virtual void OnResize() + void OnResize() override { this->vscroll->SetCapacityFromWidget(this, WID_BO_CLASS_LIST); } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (GB(widget, 0, 16)) { case WID_BO_CLASS_LIST: { @@ -415,13 +415,13 @@ public: } } - virtual void OnPlaceObject(Point pt, TileIndex tile) + void OnPlaceObject(Point pt, TileIndex tile) override { DoCommandP(tile, ObjectClass::Get(_selected_object_class)->GetSpec(_selected_object_index)->Index(), _selected_object_view, CMD_BUILD_OBJECT | CMD_MSG(STR_ERROR_CAN_T_BUILD_OBJECT), CcTerraform); } - virtual void OnPlaceObjectAbort() + void OnPlaceObjectAbort() override { this->UpdateButtons(_selected_object_class, -1, _selected_object_view); } diff --git a/src/order_gui.cpp b/src/order_gui.cpp index e50247e27..612c1ba81 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -798,7 +798,7 @@ public: this->OnInvalidateData(VIWD_MODIFY_ORDERS); } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_O_ORDER_LIST: @@ -835,7 +835,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { VehicleOrderID from = INVALID_VEH_ORDER_ID; VehicleOrderID to = INVALID_VEH_ORDER_ID; @@ -1070,7 +1070,7 @@ public: this->SetDirty(); } - virtual void OnPaint() + void OnPaint() override { if (this->vehicle->owner != _local_company) { this->selected_order = -1; // Disable selection any selected row at a competitor order window. @@ -1080,7 +1080,7 @@ public: this->DrawWidgets(); } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { if (widget != WID_O_ORDER_LIST) return; @@ -1138,7 +1138,7 @@ public: } } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { switch (widget) { case WID_O_COND_VALUE: { @@ -1159,7 +1159,7 @@ public: } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_O_ORDER_LIST: { @@ -1324,7 +1324,7 @@ public: } } - virtual void OnQueryTextFinished(char *str) + void OnQueryTextFinished(char *str) override { if (!StrEmpty(str)) { VehicleOrderID sel = this->OrderGetSel(); @@ -1347,7 +1347,7 @@ public: } } - virtual void OnDropdownSelect(int widget, int index) + void OnDropdownSelect(int widget, int index) override { switch (widget) { case WID_O_NON_STOP: @@ -1390,7 +1390,7 @@ public: } } - virtual void OnDragDrop(Point pt, int widget) + void OnDragDrop(Point pt, int widget) override { switch (widget) { case WID_O_ORDER_LIST: { @@ -1423,7 +1423,7 @@ public: } } - virtual EventState OnHotkey(int hotkey) + EventState OnHotkey(int hotkey) override { if (this->vehicle->owner != _local_company) return ES_NOT_HANDLED; @@ -1444,7 +1444,7 @@ public: return ES_HANDLED; } - virtual void OnPlaceObject(Point pt, TileIndex tile) + void OnPlaceObject(Point pt, TileIndex tile) override { if (this->goto_type == OPOS_GOTO) { const Order cmd = GetOrderCmdFromTile(this->vehicle, tile); @@ -1457,7 +1457,7 @@ public: } } - virtual bool OnVehicleSelect(const Vehicle *v) + bool OnVehicleSelect(const Vehicle *v) override { /* v is vehicle getting orders. Only copy/clone orders if vehicle doesn't have any orders yet. * We disallow copying orders of other vehicles if we already have at least one order entry @@ -1475,7 +1475,7 @@ public: return true; } - virtual void OnPlaceObjectAbort() + void OnPlaceObjectAbort() override { this->goto_type = OPOS_NONE; this->SetWidgetDirty(WID_O_GOTO); @@ -1487,7 +1487,7 @@ public: } } - virtual void OnMouseDrag(Point pt, int widget) + void OnMouseDrag(Point pt, int widget) override { if (this->selected_order != -1 && widget == WID_O_ORDER_LIST) { /* An order is dragged.. */ @@ -1507,7 +1507,7 @@ public: } } - virtual void OnResize() + void OnResize() override { /* Update the scroll bar */ this->vscroll->SetCapacityFromWidget(this, WID_O_ORDER_LIST); diff --git a/src/osk_gui.cpp b/src/osk_gui.cpp index dc069d168..de8be373e 100644 --- a/src/osk_gui.cpp +++ b/src/osk_gui.cpp @@ -94,12 +94,12 @@ struct OskWindow : public Window { this->SetWidgetLoweredState(WID_OSK_CAPS, HasBit(_keystate, KEYS_CAPS)); } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { if (widget == WID_OSK_CAPTION) SetDParam(0, this->caption); } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { if (widget < WID_OSK_LETTERS) return; @@ -110,7 +110,7 @@ struct OskWindow : public Window { TC_BLACK); } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { /* clicked a letter */ if (widget >= WID_OSK_LETTERS) { @@ -192,21 +192,21 @@ struct OskWindow : public Window { } } - virtual void OnEditboxChanged(int widget) + void OnEditboxChanged(int widget) override { this->SetWidgetDirty(WID_OSK_TEXT); this->parent->OnEditboxChanged(this->text_btn); this->parent->SetWidgetDirty(this->text_btn); } - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; this->SetWidgetDirty(WID_OSK_TEXT); this->parent->SetWidgetDirty(this->text_btn); } - virtual void OnFocusLost() + void OnFocusLost() override { VideoDriver::GetInstance()->EditBoxLostFocus(); delete this; diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index d0789f337..a26cc9902 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -440,7 +440,7 @@ struct BuildRailToolbarWindow : Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; @@ -507,7 +507,7 @@ struct BuildRailToolbarWindow : Window { } } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { if (widget == WID_RAT_CAPTION) { const RailtypeInfo *rti = GetRailTypeInfo(this->railtype); @@ -521,7 +521,7 @@ struct BuildRailToolbarWindow : Window { } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { if (widget < WID_RAT_BUILD_NS) return; @@ -613,13 +613,13 @@ struct BuildRailToolbarWindow : Window { if (_ctrl_pressed) RailToolbar_CtrlChanged(this); } - virtual EventState OnHotkey(int hotkey) + EventState OnHotkey(int hotkey) override { MarkTileDirtyByTile(TileVirtXY(_thd.pos.x, _thd.pos.y)); // redraw tile selection return Window::OnHotkey(hotkey); } - virtual void OnPlaceObject(Point pt, TileIndex tile) + void OnPlaceObject(Point pt, TileIndex tile) override { switch (this->last_user_action) { case WID_RAT_BUILD_NS: @@ -680,7 +680,7 @@ struct BuildRailToolbarWindow : Window { } } - virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) + void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) override { /* no dragging if you have pressed the convert button */ if (FindWindowById(WC_BUILD_SIGNAL, 0) != NULL && _convert_signal_button && this->IsWidgetLowered(WID_RAT_BUILD_SIGNALS)) return; @@ -688,7 +688,7 @@ struct BuildRailToolbarWindow : Window { VpSelectTilesWithMethod(pt.x, pt.y, select_method); } - virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) + void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) override { if (pt.x != -1) { switch (select_proc) { @@ -741,7 +741,7 @@ struct BuildRailToolbarWindow : Window { } } - virtual void OnPlaceObjectAbort() + void OnPlaceObjectAbort() override { this->RaiseButtons(); this->DisableWidget(WID_RAT_REMOVE); @@ -755,13 +755,13 @@ struct BuildRailToolbarWindow : Window { DeleteWindowByClass(WC_BUILD_BRIDGE); } - virtual void OnPlacePresize(Point pt, TileIndex tile) + void OnPlacePresize(Point pt, TileIndex tile) override { DoCommand(tile, _cur_railtype | (TRANSPORT_RAIL << 8), 0, DC_AUTO, CMD_BUILD_TUNNEL); VpSetPresizeRange(tile, _build_tunnel_endtile == 0 ? tile : _build_tunnel_endtile); } - virtual EventState OnCTRLStateChange() + EventState OnCTRLStateChange() override { /* do not toggle Remove button by Ctrl when placing station */ if (!this->IsWidgetLowered(WID_RAT_BUILD_STATION) && !this->IsWidgetLowered(WID_RAT_BUILD_WAYPOINT) && RailToolbar_CtrlChanged(this)) return ES_HANDLED; @@ -996,7 +996,7 @@ public: DeleteWindowById(WC_SELECT_STATION, 0); } - virtual void OnPaint() + void OnPaint() override { bool newstations = _railstation.newstations; const StationSpec *statspec = newstations ? StationClass::Get(_railstation.station_class)->GetSpec(_railstation.station_type) : NULL; @@ -1047,7 +1047,7 @@ public: } } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_BRAS_NEWST_LIST: { @@ -1104,7 +1104,7 @@ public: } } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { DrawPixelInfo tmp_dpi; @@ -1178,14 +1178,14 @@ public: } } - virtual void OnResize() + void OnResize() override { if (this->vscroll != NULL) { // New stations available. this->vscroll->SetCapacityFromWidget(this, WID_BRAS_NEWST_LIST); } } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { if (widget == WID_BRAS_SHOW_NEWST_TYPE) { const StationSpec *statspec = StationClass::Get(_railstation.station_class)->GetSpec(_railstation.station_type); @@ -1193,7 +1193,7 @@ public: } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (GB(widget, 0, 16)) { case WID_BRAS_PLATFORM_DIR_X: @@ -1369,7 +1369,7 @@ public: } } - virtual void OnRealtimeTick(uint delta_ms) + void OnRealtimeTick(uint delta_ms) override { CheckRedrawStationCoverage(this); } @@ -1523,7 +1523,7 @@ public: _convert_signal_button = false; } - virtual void OnInit() + void OnInit() override { /* Calculate maximum signal sprite size. */ this->sig_sprite_size.width = 0; @@ -1543,7 +1543,7 @@ public: } } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { if (widget == WID_BS_DRAG_SIGNALS_DENSITY_LABEL) { /* Two digits for signals density. */ @@ -1554,7 +1554,7 @@ public: } } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { switch (widget) { case WID_BS_DRAG_SIGNALS_DENSITY_LABEL: @@ -1563,7 +1563,7 @@ public: } } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { if (IsInsideMM(widget, WID_BS_SEMAPHORE_NORM, WID_BS_ELECTRIC_PBS_OWAY + 1)) { /* Extract signal from widget number. */ @@ -1575,7 +1575,7 @@ public: } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_BS_SEMAPHORE_NORM: @@ -1632,7 +1632,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; this->LowerWidget((_cur_signal_variant == SIG_ELECTRIC ? WID_BS_ELECTRIC_NORM : WID_BS_SEMAPHORE_NORM) + _cur_signal_type); @@ -1704,7 +1704,7 @@ struct BuildRailDepotWindow : public PickerWindowBase { this->LowerWidget(_build_depot_direction + WID_BRAD_DEPOT_NE); } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { if (!IsInsideMM(widget, WID_BRAD_DEPOT_NE, WID_BRAD_DEPOT_NW + 1)) return; @@ -1712,14 +1712,14 @@ struct BuildRailDepotWindow : public PickerWindowBase { size->height = ScaleGUITrad(48) + 2; } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { if (!IsInsideMM(widget, WID_BRAD_DEPOT_NE, WID_BRAD_DEPOT_NW + 1)) return; DrawTrainDepotSprite(r.left + 1 + ScaleGUITrad(31), r.bottom - ScaleGUITrad(31), widget - WID_BRAD_DEPOT_NE + DIAGDIR_NE, _cur_railtype); } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_BRAD_DEPOT_NE: @@ -1793,7 +1793,7 @@ struct BuildRailWaypointWindow : PickerWindowBase { matrix->SetClicked(_cur_waypoint_type); } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_BRW_WAYPOINT_MATRIX: @@ -1812,7 +1812,7 @@ struct BuildRailWaypointWindow : PickerWindowBase { } } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (GB(widget, 0, 16)) { case WID_BRW_WAYPOINT: { @@ -1827,7 +1827,7 @@ struct BuildRailWaypointWindow : PickerWindowBase { } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (GB(widget, 0, 16)) { case WID_BRW_WAYPOINT: { diff --git a/src/road_gui.cpp b/src/road_gui.cpp index e3091ec8a..40212e8fb 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -335,7 +335,7 @@ struct BuildRoadToolbarWindow : Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; @@ -403,7 +403,7 @@ struct BuildRoadToolbarWindow : Window { } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { _remove_button_clicked = false; _one_way_button_clicked = false; @@ -483,13 +483,13 @@ struct BuildRoadToolbarWindow : Window { if (_ctrl_pressed) RoadToolbar_CtrlChanged(this); } - virtual EventState OnHotkey(int hotkey) + EventState OnHotkey(int hotkey) override { MarkTileDirtyByTile(TileVirtXY(_thd.pos.x, _thd.pos.y)); // redraw tile selection return Window::OnHotkey(hotkey); } - virtual void OnPlaceObject(Point pt, TileIndex tile) + void OnPlaceObject(Point pt, TileIndex tile) override { _remove_button_clicked = this->IsWidgetLowered(WID_ROT_REMOVE); _one_way_button_clicked = this->IsWidgetLowered(WID_ROT_ONE_WAY); @@ -543,7 +543,7 @@ struct BuildRoadToolbarWindow : Window { } } - virtual void OnPlaceObjectAbort() + void OnPlaceObjectAbort() override { this->RaiseButtons(); this->SetWidgetsDisabledState(true, @@ -560,7 +560,7 @@ struct BuildRoadToolbarWindow : Window { DeleteWindowByClass(WC_BUILD_BRIDGE); } - virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) + void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) override { /* Here we update the end tile flags * of the road placement actions. @@ -603,7 +603,7 @@ struct BuildRoadToolbarWindow : Window { VpSelectTilesWithMethod(pt.x, pt.y, select_method); } - virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) + void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) override { if (pt.x != -1) { switch (select_proc) { @@ -659,13 +659,13 @@ struct BuildRoadToolbarWindow : Window { } } - virtual void OnPlacePresize(Point pt, TileIndex tile) + void OnPlacePresize(Point pt, TileIndex tile) override { DoCommand(tile, RoadTypeToRoadTypes(_cur_roadtype) | (TRANSPORT_ROAD << 8), 0, DC_AUTO, CMD_BUILD_TUNNEL); VpSetPresizeRange(tile, _build_tunnel_endtile == 0 ? tile : _build_tunnel_endtile); } - virtual EventState OnCTRLStateChange() + EventState OnCTRLStateChange() override { if (RoadToolbar_CtrlChanged(this)) return ES_HANDLED; return ES_NOT_HANDLED; @@ -874,7 +874,7 @@ struct BuildRoadDepotWindow : public PickerWindowBase { this->FinishInitNested(TRANSPORT_ROAD); } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { if (!IsInsideMM(widget, WID_BROD_DEPOT_NE, WID_BROD_DEPOT_NW + 1)) return; @@ -882,14 +882,14 @@ struct BuildRoadDepotWindow : public PickerWindowBase { size->height = ScaleGUITrad(48) + 2; } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { if (!IsInsideMM(widget, WID_BROD_DEPOT_NE, WID_BROD_DEPOT_NW + 1)) return; DrawRoadDepotSprite(r.left + 1 + ScaleGUITrad(31), r.bottom - ScaleGUITrad(31), (DiagDirection)(widget - WID_BROD_DEPOT_NE + DIAGDIR_NE), _cur_roadtype); } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_BROD_DEPOT_NW: @@ -979,7 +979,7 @@ struct BuildRoadStationWindow : public PickerWindowBase { DeleteWindowById(WC_SELECT_STATION, 0); } - virtual void OnPaint() + void OnPaint() override { this->DrawWidgets(); @@ -1006,7 +1006,7 @@ struct BuildRoadStationWindow : public PickerWindowBase { } } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { if (!IsInsideMM(widget, WID_BROS_STATION_NE, WID_BROS_STATION_Y + 1)) return; @@ -1014,7 +1014,7 @@ struct BuildRoadStationWindow : public PickerWindowBase { size->height = ScaleGUITrad(48) + 2; } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { if (!IsInsideMM(widget, WID_BROS_STATION_NE, WID_BROS_STATION_Y + 1)) return; @@ -1022,7 +1022,7 @@ struct BuildRoadStationWindow : public PickerWindowBase { StationPickerDrawSprite(r.left + 1 + ScaleGUITrad(31), r.bottom - ScaleGUITrad(31), st, INVALID_RAILTYPE, widget < WID_BROS_STATION_X ? ROADTYPE_ROAD : _cur_roadtype, widget - WID_BROS_STATION_NE); } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_BROS_STATION_NE: @@ -1053,7 +1053,7 @@ struct BuildRoadStationWindow : public PickerWindowBase { } } - virtual void OnRealtimeTick(uint delta_ms) + void OnRealtimeTick(uint delta_ms) override { CheckRedrawStationCoverage(this); } diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index c92701f0d..fda7cfa52 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -339,7 +339,7 @@ struct GameOptionsWindow : Window { return list; } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { switch (widget) { case WID_GO_CURRENCY_DROPDOWN: SetDParam(0, _currency_specs[this->opt->locale.currency].name); break; @@ -358,7 +358,7 @@ struct GameOptionsWindow : Window { } } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (widget) { case WID_GO_BASE_GRF_DESCRIPTION: @@ -378,7 +378,7 @@ struct GameOptionsWindow : Window { } } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_GO_BASE_GRF_DESCRIPTION: @@ -445,7 +445,7 @@ struct GameOptionsWindow : Window { } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { if (widget >= WID_GO_BASE_GRF_TEXTFILE && widget < WID_GO_BASE_GRF_TEXTFILE + TFT_END) { if (BaseGraphics::GetUsedSet() == NULL) return; @@ -508,7 +508,7 @@ struct GameOptionsWindow : Window { } } - virtual void OnDropdownSelect(int widget, int index) + void OnDropdownSelect(int widget, int index) override { switch (widget) { case WID_GO_CURRENCY_DROPDOWN: // Currency @@ -587,7 +587,7 @@ struct GameOptionsWindow : Window { * @param data Information about the changed data. @see GameOptionsInvalidationData * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; this->SetWidgetLoweredState(WID_GO_FULLSCREEN_BUTTON, _fullscreen); @@ -1858,7 +1858,7 @@ struct GameSettingsWindow : Window { this->InvalidateData(); } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_GS_OPTIONSPANEL: @@ -1893,7 +1893,7 @@ struct GameSettingsWindow : Window { } } - virtual void OnPaint() + void OnPaint() override { if (this->closing_dropdown) { this->closing_dropdown = false; @@ -1934,7 +1934,7 @@ struct GameSettingsWindow : Window { } } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { switch (widget) { case WID_GS_RESTRICT_DROPDOWN: @@ -1979,7 +1979,7 @@ struct GameSettingsWindow : Window { return list; } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (widget) { case WID_GS_OPTIONSPANEL: { @@ -2029,7 +2029,7 @@ struct GameSettingsWindow : Window { this->last_clicked = pe; } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_GS_EXPAND_ALL: @@ -2212,7 +2212,7 @@ struct GameSettingsWindow : Window { } } - virtual void OnTimeout() + void OnTimeout() override { if (this->clicked_entry != NULL) { // On timeout, release any depressed buttons this->clicked_entry->SetButtons(0); @@ -2221,7 +2221,7 @@ struct GameSettingsWindow : Window { } } - virtual void OnQueryTextFinished(char *str) + void OnQueryTextFinished(char *str) override { /* The user pressed cancel */ if (str == NULL) return; @@ -2247,7 +2247,7 @@ struct GameSettingsWindow : Window { this->SetDirty(); } - virtual void OnDropdownSelect(int widget, int index) + void OnDropdownSelect(int widget, int index) override { switch (widget) { case WID_GS_RESTRICT_DROPDOWN: @@ -2291,7 +2291,7 @@ struct GameSettingsWindow : Window { } } - virtual void OnDropdownClose(Point pt, int widget, int index, bool instant_close) + void OnDropdownClose(Point pt, int widget, int index, bool instant_close) override { if (widget >= 0) { /* Normally the default implementation of OnDropdownClose() takes care of @@ -2310,7 +2310,7 @@ struct GameSettingsWindow : Window { } } - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; @@ -2340,7 +2340,7 @@ struct GameSettingsWindow : Window { this->SetWidgetDisabledState(WID_GS_COLLAPSE_ALL, all_folded); } - virtual void OnEditboxChanged(int wid) + void OnEditboxChanged(int wid) override { if (wid == WID_GS_FILTER) { this->filter.string.SetFilterTerm(this->filter_editbox.text.buf); @@ -2353,7 +2353,7 @@ struct GameSettingsWindow : Window { } } - virtual void OnResize() + void OnResize() override { this->vscroll->SetCapacityFromWidget(this, WID_GS_OPTIONSPANEL, SETTINGTREE_TOP_OFFSET + SETTINGTREE_BOTTOM_OFFSET); } @@ -2497,7 +2497,7 @@ struct CustomCurrencyWindow : Window { this->SetWidgetDisabledState(WID_CC_YEAR_UP, _custom_currency.to_euro == MAX_YEAR); } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { switch (widget) { case WID_CC_RATE: SetDParam(0, 1); SetDParam(1, 1); break; @@ -2515,7 +2515,7 @@ struct CustomCurrencyWindow : Window { } } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { /* Set the appropriate width for the edit 'buttons' */ @@ -2534,7 +2534,7 @@ struct CustomCurrencyWindow : Window { } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { int line = 0; int len = 0; @@ -2616,7 +2616,7 @@ struct CustomCurrencyWindow : Window { this->SetDirty(); } - virtual void OnQueryTextFinished(char *str) + void OnQueryTextFinished(char *str) override { if (str == NULL) return; @@ -2648,7 +2648,7 @@ struct CustomCurrencyWindow : Window { SetButtonState(); } - virtual void OnTimeout() + void OnTimeout() override { this->SetDirty(); } diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp index 56af6e665..5e752da52 100644 --- a/src/signs_gui.cpp +++ b/src/signs_gui.cpp @@ -166,7 +166,7 @@ struct SignListWindow : Window, SignList { this->BuildSortSignList(); } - virtual void OnInit() + void OnInit() override { /* Default sign name, used if Sign::name is NULL. */ GetString(SignList::default_name, STR_DEFAULT_SIGN_NAME, lastof(SignList::default_name)); @@ -190,13 +190,13 @@ struct SignListWindow : Window, SignList { this->InvalidateData(); } - virtual void OnPaint() + void OnPaint() override { if (!this->IsShaded() && this->signs.NeedRebuild()) this->BuildSortSignList(); this->DrawWidgets(); } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (widget) { case WID_SIL_LIST: { @@ -228,12 +228,12 @@ struct SignListWindow : Window, SignList { } } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { if (widget == WID_SIL_CAPTION) SetDParam(0, this->vscroll->GetCount()); } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_SIL_LIST: { @@ -260,12 +260,12 @@ struct SignListWindow : Window, SignList { } } - virtual void OnResize() + void OnResize() override { this->vscroll->SetCapacityFromWidget(this, WID_SIL_LIST, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM); } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_SIL_LIST: { @@ -286,7 +286,7 @@ struct SignListWindow : Window, SignList { } } - virtual EventState OnHotkey(int hotkey) + EventState OnHotkey(int hotkey) override { switch (hotkey) { case SLHK_FOCUS_FILTER_BOX: @@ -301,7 +301,7 @@ struct SignListWindow : Window, SignList { return ES_HANDLED; } - virtual void OnEditboxChanged(int widget) + void OnEditboxChanged(int widget) override { if (widget == WID_SIL_FILTER_TEXT) this->SetFilterString(this->filter_editbox.text.buf); } @@ -316,7 +316,7 @@ struct SignListWindow : Window, SignList { this->SortSignsList(); } - virtual void OnHundredthTick() + void OnHundredthTick() override { this->BuildSortSignList(); this->SetDirty(); @@ -327,7 +327,7 @@ struct SignListWindow : Window, SignList { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { /* When there is a filter string, we always need to rebuild the list even if * the amount of signs in total is unchanged, as the subset of signs that is @@ -482,7 +482,7 @@ struct SignWindow : Window, SignList { return this->signs[next ? 0 : this->signs.Length() - 1]; } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { switch (widget) { case WID_QES_CAPTION: @@ -491,7 +491,7 @@ struct SignWindow : Window, SignList { } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_QES_PREVIOUS: diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp index 97d01325a..41848cdf0 100644 --- a/src/smallmap_gui.cpp +++ b/src/smallmap_gui.cpp @@ -1685,7 +1685,7 @@ public: this->smallmap_window = NULL; } - virtual void SetupSmallestSize(Window *w, bool init_array) + void SetupSmallestSize(Window *w, bool init_array) override { NWidgetBase *display = this->head; NWidgetBase *bar = display->next; @@ -1703,7 +1703,7 @@ public: this->resize_y = min(display->resize_y, bar->resize_y); } - virtual void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) + void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override { this->pos_x = x; this->pos_y = y; @@ -1727,7 +1727,7 @@ public: bar->AssignSizePosition(ST_RESIZE, x, y + display_height, given_width, bar_height, rtl); } - virtual NWidgetCore *GetWidgetFromPos(int x, int y) + NWidgetCore *GetWidgetFromPos(int x, int y) override { if (!IsInsideBS(x, this->pos_x, this->current_x) || !IsInsideBS(y, this->pos_y, this->current_y)) return NULL; for (NWidgetBase *child_wid = this->head; child_wid != NULL; child_wid = child_wid->next) { @@ -1737,7 +1737,7 @@ public: return NULL; } - virtual void Draw(const Window *w) + void Draw(const Window *w) override { for (NWidgetBase *child_wid = this->head; child_wid != NULL; child_wid = child_wid->next) child_wid->Draw(w); } diff --git a/src/station_gui.cpp b/src/station_gui.cpp index 5c2e06070..ef434c4ff 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -337,7 +337,7 @@ public: this->last_sorting = this->stations.GetListing(); } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_STL_SORTBY: { @@ -393,7 +393,7 @@ public: } } - virtual void OnPaint() + void OnPaint() override { this->BuildStationsList((Owner)this->window_number); this->SortStationsList(); @@ -401,7 +401,7 @@ public: this->DrawWidgets(); } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (widget) { case WID_STL_SORTBY: @@ -485,7 +485,7 @@ public: } } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { if (widget == WID_STL_CAPTION) { SetDParam(0, this->window_number); @@ -493,7 +493,7 @@ public: } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_STL_LIST: { @@ -609,7 +609,7 @@ public: } } - virtual void OnDropdownSelect(int widget, int index) + void OnDropdownSelect(int widget, int index) override { if (this->stations.SortType() != index) { this->stations.SetSortType(index); @@ -621,7 +621,7 @@ public: } } - virtual void OnGameTick() + void OnGameTick() override { if (this->stations.NeedResort()) { DEBUG(misc, 3, "Periodic rebuild station list company %d", this->window_number); @@ -629,7 +629,7 @@ public: } } - virtual void OnResize() + void OnResize() override { this->vscroll->SetCapacityFromWidget(this, WID_STL_LIST, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM); } @@ -639,7 +639,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (data == 0) { /* This needs to be done in command-scope to enforce rebuilding before resorting invalid data */ @@ -1361,7 +1361,7 @@ struct StationViewWindow : public Window { data->Update(count); } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_SV_WAITING: @@ -1385,7 +1385,7 @@ struct StationViewWindow : public Window { } } - virtual void OnPaint() + void OnPaint() override { const Station *st = Station::Get(this->window_number); CargoDataEntry cargo; @@ -1441,7 +1441,7 @@ struct StationViewWindow : public Window { } } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { const Station *st = Station::Get(this->window_number); SetDParam(0, st->index); @@ -1876,7 +1876,7 @@ struct StationViewWindow : public Window { this->SetWidgetDirty(WID_SV_WAITING); } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_SV_WAITING: @@ -2037,7 +2037,7 @@ struct StationViewWindow : public Window { this->SetDirty(); } - virtual void OnDropdownSelect(int widget, int index) + void OnDropdownSelect(int widget, int index) override { if (widget == WID_SV_SORT_BY) { this->SelectSortBy(index); @@ -2046,14 +2046,14 @@ struct StationViewWindow : public Window { } } - virtual void OnQueryTextFinished(char *str) + void OnQueryTextFinished(char *str) override { if (str == NULL) return; DoCommandP(0, this->window_number, 0, CMD_RENAME_STATION | CMD_MSG(STR_ERROR_CAN_T_RENAME_STATION), NULL, str); } - virtual void OnResize() + void OnResize() override { this->vscroll->SetCapacityFromWidget(this, WID_SV_WAITING, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM); } @@ -2063,7 +2063,7 @@ struct StationViewWindow : public Window { * @param data Information about the changed data. If it's a valid cargo ID, invalidate the cargo data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (gui_scope) { if (data >= 0 && data < NUM_CARGO) { @@ -2249,7 +2249,7 @@ struct SelectStationWindow : Window { this->OnInvalidateData(0); } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { if (widget != WID_JS_PANEL) return; @@ -2269,7 +2269,7 @@ struct SelectStationWindow : Window { *size = d; } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { if (widget != WID_JS_PANEL) return; @@ -2290,7 +2290,7 @@ struct SelectStationWindow : Window { } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { if (widget != WID_JS_PANEL) return; @@ -2311,7 +2311,7 @@ struct SelectStationWindow : Window { DeleteWindowById(WC_SELECT_STATION, 0); } - virtual void OnRealtimeTick(uint delta_ms) + void OnRealtimeTick(uint delta_ms) override { if (_thd.dirty & 2) { _thd.dirty &= ~2; @@ -2319,7 +2319,7 @@ struct SelectStationWindow : Window { } } - virtual void OnResize() + void OnResize() override { this->vscroll->SetCapacityFromWidget(this, WID_JS_PANEL, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM); } @@ -2329,7 +2329,7 @@ struct SelectStationWindow : Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; FindStationsNearby<T>(this->area, true); diff --git a/src/statusbar_gui.cpp b/src/statusbar_gui.cpp index 88ba495f3..281b4eb98 100644 --- a/src/statusbar_gui.cpp +++ b/src/statusbar_gui.cpp @@ -99,18 +99,18 @@ struct StatusBarWindow : Window { PositionStatusbar(this); } - virtual Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number) + Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number) override { Point pt = { 0, _screen.height - sm_height }; return pt; } - virtual void FindWindowPlacementAndResize(int def_width, int def_height) + void FindWindowPlacementAndResize(int def_width, int def_height) override { Window::FindWindowPlacementAndResize(_toolbar_width, def_height); } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { Dimension d; switch (widget) { @@ -137,7 +137,7 @@ struct StatusBarWindow : Window { *size = maxdim(d, *size); } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (widget) { case WID_S_LEFT: @@ -195,7 +195,7 @@ struct StatusBarWindow : Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; switch (data) { @@ -211,7 +211,7 @@ struct StatusBarWindow : Window { } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_S_MIDDLE: ShowLastNewsMessage(); break; @@ -220,7 +220,7 @@ struct StatusBarWindow : Window { } } - virtual void OnRealtimeTick(uint delta_ms) + void OnRealtimeTick(uint delta_ms) override { if (_pause_mode != PM_UNPAUSED) return; diff --git a/src/story_gui.cpp b/src/story_gui.cpp index 003843310..8b12207e3 100644 --- a/src/story_gui.cpp +++ b/src/story_gui.cpp @@ -463,7 +463,7 @@ public: } } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { switch (widget) { case WID_SB_SEL_PAGE: { @@ -482,7 +482,7 @@ public: } } - virtual void OnPaint() + void OnPaint() override { /* Detect if content has changed height. This can happen if a * multi-line text contains eg. {COMPANY} and that company is @@ -497,7 +497,7 @@ public: this->DrawWidgets(); } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { if (widget != WID_SB_PAGE_PANEL) return; @@ -563,7 +563,7 @@ public: _cur_dpi = old_dpi; } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { if (widget != WID_SB_SEL_PAGE && widget != WID_SB_PAGE_PANEL) return; @@ -606,13 +606,13 @@ public: } - virtual void OnResize() + void OnResize() override { this->vscroll->SetCapacityFromWidget(this, WID_SB_PAGE_PANEL, WD_FRAMETEXT_TOP + WD_FRAMETEXT_BOTTOM); this->vscroll->SetCount(this->GetContentHeight()); } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_SB_SEL_PAGE: { @@ -667,7 +667,7 @@ public: } } - virtual void OnDropdownSelect(int widget, int index) + void OnDropdownSelect(int widget, int index) override { if (widget != WID_SB_SEL_PAGE) return; @@ -682,7 +682,7 @@ public: * >= 0 Id of the page that needs to be refreshed. If it is not the current page, nothing happens. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; diff --git a/src/subsidy_gui.cpp b/src/subsidy_gui.cpp index 04e5ae262..e71b62f94 100644 --- a/src/subsidy_gui.cpp +++ b/src/subsidy_gui.cpp @@ -38,7 +38,7 @@ struct SubsidyListWindow : Window { this->OnInvalidateData(0); } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { if (widget != WID_SUL_PANEL) return; @@ -129,7 +129,7 @@ struct SubsidyListWindow : Window { return 3 + num_awarded + num_not_awarded; } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { if (widget != WID_SUL_PANEL) return; Dimension d = maxdim(GetStringBoundingBox(STR_SUBSIDIES_OFFERED_TITLE), GetStringBoundingBox(STR_SUBSIDIES_SUBSIDISED_TITLE)); @@ -142,7 +142,7 @@ struct SubsidyListWindow : Window { *size = maxdim(*size, d); } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { if (widget != WID_SUL_PANEL) return; @@ -207,7 +207,7 @@ struct SubsidyListWindow : Window { } } - virtual void OnResize() + void OnResize() override { this->vscroll->SetCapacityFromWidget(this, WID_SUL_PANEL); } @@ -217,7 +217,7 @@ struct SubsidyListWindow : Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; this->vscroll->SetCount(this->CountLines()); diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp index 97749a8dc..a69917040 100644 --- a/src/terraform_gui.cpp +++ b/src/terraform_gui.cpp @@ -165,14 +165,14 @@ struct TerraformToolbarWindow : Window { { } - virtual void OnInit() + void OnInit() override { /* Don't show the place object button when there are no objects to place. */ NWidgetStacked *show_object = this->GetWidget<NWidgetStacked>(WID_TT_SHOW_PLACE_OBJECT); show_object->SetDisplayedPlane(ObjectClass::GetUIClassCount() != 0 ? 0 : SZSP_NONE); } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { if (widget < WID_TT_BUTTONS_START) return; @@ -219,7 +219,7 @@ struct TerraformToolbarWindow : Window { } } - virtual void OnPlaceObject(Point pt, TileIndex tile) + void OnPlaceObject(Point pt, TileIndex tile) override { switch (this->last_user_action) { case WID_TT_LOWER_LAND: // Lower land button @@ -250,19 +250,19 @@ struct TerraformToolbarWindow : Window { } } - virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) + void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) override { VpSelectTilesWithMethod(pt.x, pt.y, select_method); } - virtual Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number) + Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number) override { Point pt = GetToolbarAlignedWindowPosition(sm_width); pt.y += sm_height; return pt; } - virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) + void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) override { if (pt.x != -1) { switch (select_proc) { @@ -277,7 +277,7 @@ struct TerraformToolbarWindow : Window { } } - virtual void OnPlaceObjectAbort() + void OnPlaceObjectAbort() override { this->RaiseButtons(); } @@ -538,7 +538,7 @@ struct ScenarioEditorLandscapeGenerationWindow : Window { this->last_user_action = WIDGET_LIST_END; } - virtual void OnPaint() + void OnPaint() override { this->DrawWidgets(); @@ -547,7 +547,7 @@ struct ScenarioEditorLandscapeGenerationWindow : Window { } } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { if (widget != WID_ETT_DOTS) return; @@ -555,7 +555,7 @@ struct ScenarioEditorLandscapeGenerationWindow : Window { size->height = max<uint>(size->height, ScaleGUITrad(31)); } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { if (widget != WID_ETT_DOTS) return; @@ -572,7 +572,7 @@ struct ScenarioEditorLandscapeGenerationWindow : Window { } while (--n); } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { if (widget < WID_ETT_BUTTONS_START) return; @@ -638,7 +638,7 @@ struct ScenarioEditorLandscapeGenerationWindow : Window { } } - virtual void OnTimeout() + void OnTimeout() override { for (uint i = WID_ETT_START; i < this->nested_array_size; i++) { if (i == WID_ETT_BUTTONS_START) i = WID_ETT_BUTTONS_END; // skip the buttons @@ -649,7 +649,7 @@ struct ScenarioEditorLandscapeGenerationWindow : Window { } } - virtual void OnPlaceObject(Point pt, TileIndex tile) + void OnPlaceObject(Point pt, TileIndex tile) override { switch (this->last_user_action) { case WID_ETT_DEMOLISH: // Demolish aka dynamite button @@ -680,12 +680,12 @@ struct ScenarioEditorLandscapeGenerationWindow : Window { } } - virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) + void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) override { VpSelectTilesWithMethod(pt.x, pt.y, select_method); } - virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) + void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) override { if (pt.x != -1) { switch (select_proc) { @@ -702,7 +702,7 @@ struct ScenarioEditorLandscapeGenerationWindow : Window { } } - virtual void OnPlaceObjectAbort() + void OnPlaceObjectAbort() override { this->RaiseButtons(); this->SetDirty(); diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp index 5dd45561f..8280c0e89 100644 --- a/src/timetable_gui.cpp +++ b/src/timetable_gui.cpp @@ -189,7 +189,7 @@ struct TimetableWindow : Window { return (travelling && v->lateness_counter < 0); } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_VT_ARRIVAL_DEPARTURE_PANEL: @@ -227,7 +227,7 @@ struct TimetableWindow : Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { switch (data) { case VIWD_AUTOREPLACE: @@ -297,7 +297,7 @@ struct TimetableWindow : Window { } - virtual void OnPaint() + void OnPaint() override { const Vehicle *v = this->vehicle; int selected = this->sel_index; @@ -341,7 +341,7 @@ struct TimetableWindow : Window { this->DrawWidgets(); } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { switch (widget) { case WID_VT_CAPTION: SetDParam(0, this->vehicle->index); break; @@ -349,7 +349,7 @@ struct TimetableWindow : Window { } } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { const Vehicle *v = this->vehicle; int selected = this->sel_index; @@ -513,7 +513,7 @@ struct TimetableWindow : Window { return v->index | (order_number << 20) | (mtf << 28); } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { const Vehicle *v = this->vehicle; @@ -614,7 +614,7 @@ struct TimetableWindow : Window { this->SetDirty(); } - virtual void OnQueryTextFinished(char *str) + void OnQueryTextFinished(char *str) override { if (str == NULL) return; @@ -634,7 +634,7 @@ struct TimetableWindow : Window { DoCommandP(0, p1, p2, CMD_CHANGE_TIMETABLE | CMD_MSG(STR_ERROR_CAN_T_TIMETABLE_VEHICLE)); } - virtual void OnResize() + void OnResize() override { /* Update the scroll bar */ this->vscroll->SetCapacityFromWidget(this, WID_VT_TIMETABLE_PANEL, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM); diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp index c3555f107..7052dc4e2 100644 --- a/src/toolbar_gui.cpp +++ b/src/toolbar_gui.cpp @@ -1997,12 +1997,12 @@ struct MainToolbarWindow : Window { this->timer.SetInterval(MILLISECONDS_PER_TICK); } - virtual void FindWindowPlacementAndResize(int def_width, int def_height) + void FindWindowPlacementAndResize(int def_width, int def_height) override { Window::FindWindowPlacementAndResize(_toolbar_width, def_height); } - virtual void OnPaint() + void OnPaint() override { /* If spectator, disable all construction buttons * ie : Build road, rail, ships, airports and landscaping @@ -2020,18 +2020,18 @@ struct MainToolbarWindow : Window { this->DrawWidgets(); } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { if (_game_mode != GM_MENU && !this->IsWidgetDisabled(widget)) _toolbar_button_procs[widget](this); } - virtual void OnDropdownSelect(int widget, int index) + void OnDropdownSelect(int widget, int index) override { CallBackFunction cbf = _menu_clicked_procs[widget](index); if (cbf != CBF_NONE) _last_started_action = cbf; } - virtual EventState OnHotkey(int hotkey) + EventState OnHotkey(int hotkey) override { switch (hotkey) { case MTHK_PAUSE: ToolbarPauseClick(this); break; @@ -2077,7 +2077,7 @@ struct MainToolbarWindow : Window { return ES_HANDLED; } - virtual void OnPlaceObject(Point pt, TileIndex tile) + void OnPlaceObject(Point pt, TileIndex tile) override { switch (_last_started_action) { case CBF_PLACE_SIGN: @@ -2092,12 +2092,12 @@ struct MainToolbarWindow : Window { } } - virtual void OnPlaceObjectAbort() + void OnPlaceObjectAbort() override { _last_started_action = CBF_NONE; } - virtual void OnRealtimeTick(uint delta_ms) + void OnRealtimeTick(uint delta_ms) override { if (!this->timer.Elapsed(delta_ms)) return; this->timer.SetInterval(MILLISECONDS_PER_TICK); @@ -2113,7 +2113,7 @@ struct MainToolbarWindow : Window { } } - virtual void OnTimeout() + void OnTimeout() override { /* We do not want to automatically raise the pause, fast forward and * switchbar buttons; they have to stay down when pressed etc. */ @@ -2130,7 +2130,7 @@ struct MainToolbarWindow : Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; if (FindWindowById(WC_MAIN_WINDOW, 0) != NULL) HandleZoomMessage(this, FindWindowById(WC_MAIN_WINDOW, 0)->viewport, WID_TN_ZOOM_IN, WID_TN_ZOOM_OUT); @@ -2330,12 +2330,12 @@ struct ScenarioEditorToolbarWindow : Window { this->timer.SetInterval(MILLISECONDS_PER_TICK); } - virtual void FindWindowPlacementAndResize(int def_width, int def_height) + void FindWindowPlacementAndResize(int def_width, int def_height) override { Window::FindWindowPlacementAndResize(_toolbar_width, def_height); } - virtual void OnPaint() + void OnPaint() override { this->SetWidgetDisabledState(WID_TE_DATE_BACKWARD, _settings_game.game_creation.starting_year <= MIN_YEAR); this->SetWidgetDisabledState(WID_TE_DATE_FORWARD, _settings_game.game_creation.starting_year >= MAX_YEAR); @@ -2343,7 +2343,7 @@ struct ScenarioEditorToolbarWindow : Window { this->DrawWidgets(); } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (widget) { case WID_TE_DATE: @@ -2364,7 +2364,7 @@ struct ScenarioEditorToolbarWindow : Window { } } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_TE_SPACER: @@ -2379,14 +2379,14 @@ struct ScenarioEditorToolbarWindow : Window { } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { if (_game_mode == GM_MENU) return; CallBackFunction cbf = _scen_toolbar_button_procs[widget](this); if (cbf != CBF_NONE) _last_started_action = cbf; } - virtual void OnDropdownSelect(int widget, int index) + void OnDropdownSelect(int widget, int index) override { /* The map button is in a different location on the scenario * editor toolbar, so we need to adjust for it. */ @@ -2396,7 +2396,7 @@ struct ScenarioEditorToolbarWindow : Window { if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); } - virtual EventState OnHotkey(int hotkey) + EventState OnHotkey(int hotkey) override { CallBackFunction cbf = CBF_NONE; switch (hotkey) { @@ -2428,7 +2428,7 @@ struct ScenarioEditorToolbarWindow : Window { return ES_HANDLED; } - virtual void OnPlaceObject(Point pt, TileIndex tile) + void OnPlaceObject(Point pt, TileIndex tile) override { switch (_last_started_action) { case CBF_PLACE_SIGN: @@ -2443,19 +2443,19 @@ struct ScenarioEditorToolbarWindow : Window { } } - virtual void OnPlaceObjectAbort() + void OnPlaceObjectAbort() override { _last_started_action = CBF_NONE; } - virtual void OnTimeout() + void OnTimeout() override { this->SetWidgetsLoweredState(false, WID_TE_DATE_BACKWARD, WID_TE_DATE_FORWARD, WIDGET_LIST_END); this->SetWidgetDirty(WID_TE_DATE_BACKWARD); this->SetWidgetDirty(WID_TE_DATE_FORWARD); } - virtual void OnRealtimeTick(uint delta_ms) + void OnRealtimeTick(uint delta_ms) override { if (!this->timer.Elapsed(delta_ms)) return; this->timer.SetInterval(MILLISECONDS_PER_TICK); @@ -2476,13 +2476,13 @@ struct ScenarioEditorToolbarWindow : Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; if (FindWindowById(WC_MAIN_WINDOW, 0) != NULL) HandleZoomMessage(this, FindWindowById(WC_MAIN_WINDOW, 0)->viewport, WID_TE_ZOOM_IN, WID_TE_ZOOM_OUT); } - virtual void OnQueryTextFinished(char *str) + void OnQueryTextFinished(char *str) override { /* Was 'cancel' pressed? */ if (str == NULL) return; diff --git a/src/town_gui.cpp b/src/town_gui.cpp index bc322b08f..18b767ebc 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -99,7 +99,7 @@ public: this->vscroll->SetCapacity((this->GetWidget<NWidgetBase>(WID_TA_COMMAND_LIST)->current_y - WD_FRAMERECT_TOP - WD_FRAMERECT_BOTTOM) / FONT_HEIGHT_NORMAL); } - virtual void OnPaint() + void OnPaint() override { int numact; uint buttons = GetMaskOfTownActions(&numact, _local_company, this->town); @@ -180,12 +180,12 @@ public: } } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { if (widget == WID_TA_CAPTION) SetDParam(0, this->window_number); } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (widget) { case WID_TA_ACTION_INFO: @@ -220,7 +220,7 @@ public: } } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_TA_ACTION_INFO: { @@ -254,7 +254,7 @@ public: } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_TA_COMMAND_LIST: { @@ -277,7 +277,7 @@ public: } } - virtual void OnHundredthTick() + void OnHundredthTick() override { this->SetDirty(); } @@ -321,12 +321,12 @@ public: this->SetWidgetDisabledState(WID_TV_CHANGE_NAME, _networking && !_network_server); } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { if (widget == WID_TV_CAPTION) SetDParam(0, this->town->index); } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { if (widget != WID_TV_INFO) return; @@ -412,7 +412,7 @@ public: } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_TV_CENTER_VIEW: // scroll to location @@ -451,7 +451,7 @@ public: } } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_TV_INFO: @@ -501,7 +501,7 @@ public: } } - virtual void OnResize() + void OnResize() override { if (this->viewport != NULL) { NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(WID_TV_VIEWPORT); @@ -516,7 +516,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; /* Called when setting station noise or required cargoes have changed, in order to resize the window */ @@ -524,7 +524,7 @@ public: this->ResizeWindowAsNeeded(); } - virtual void OnQueryTextFinished(char *str) + void OnQueryTextFinished(char *str) override { if (str == NULL) return; @@ -733,7 +733,7 @@ public: this->FinishInitNested(0); } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { switch (widget) { case WID_TD_WORLD_POPULATION: @@ -756,7 +756,7 @@ public: return t->larger_town ? STR_TOWN_DIRECTORY_CITY : STR_TOWN_DIRECTORY_TOWN; } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (widget) { case WID_TD_SORT_ORDER: @@ -804,7 +804,7 @@ public: } } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_TD_SORT_ORDER: { @@ -856,7 +856,7 @@ public: } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_TD_SORT_ORDER: // Click on sort order button @@ -893,7 +893,7 @@ public: } } - virtual void OnDropdownSelect(int widget, int index) + void OnDropdownSelect(int widget, int index) override { if (widget != WID_TD_SORT_CRITERIA) return; @@ -904,19 +904,19 @@ public: } } - virtual void OnPaint() + void OnPaint() override { if (this->towns.NeedRebuild()) this->BuildSortTownList(); this->DrawWidgets(); } - virtual void OnHundredthTick() + void OnHundredthTick() override { this->BuildSortTownList(); this->SetDirty(); } - virtual void OnResize() + void OnResize() override { this->vscroll->SetCapacityFromWidget(this, WID_TD_LIST); } @@ -926,7 +926,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (data == 0) { /* This needs to be done in command-scope to enforce rebuilding before resorting invalid data */ @@ -1129,7 +1129,7 @@ public: if (success && !_shift_pressed) this->RandomTownName(); } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_TF_NEW_TOWN: @@ -1174,12 +1174,12 @@ public: } } - virtual void OnPlaceObject(Point pt, TileIndex tile) + void OnPlaceObject(Point pt, TileIndex tile) override { this->ExecuteFoundTownCommand(tile, false, STR_ERROR_CAN_T_FOUND_TOWN_HERE, CcFoundTown); } - virtual void OnPlaceObjectAbort() + void OnPlaceObjectAbort() override { this->RaiseButtons(); this->UpdateButtons(false); @@ -1190,7 +1190,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; this->UpdateButtons(true); diff --git a/src/transparency_gui.cpp b/src/transparency_gui.cpp index 4bad2b056..c396b52f5 100644 --- a/src/transparency_gui.cpp +++ b/src/transparency_gui.cpp @@ -35,13 +35,13 @@ public: this->InitNested(window_number); } - virtual void OnPaint() + void OnPaint() override { this->OnInvalidateData(0); // Must be sure that the widgets show the transparency variable changes, also when we use shortcuts. this->DrawWidgets(); } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (widget) { case WID_TT_SIGNS: @@ -69,7 +69,7 @@ public: } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { if (widget >= WID_TT_BEGIN && widget < WID_TT_END) { if (_ctrl_pressed) { @@ -104,7 +104,7 @@ public: } } - virtual Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number) + Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number) override { Point pt = GetToolbarAlignedWindowPosition(sm_width); pt.y += 2 * (sm_height - this->GetWidget<NWidgetBase>(WID_TT_BUTTONS)->current_y); @@ -116,7 +116,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; for (uint i = WID_TT_BEGIN; i < WID_TT_END; i++) { diff --git a/src/tree_gui.cpp b/src/tree_gui.cpp index f21eeaef2..1b1dce95a 100644 --- a/src/tree_gui.cpp +++ b/src/tree_gui.cpp @@ -84,7 +84,7 @@ public: return size; } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { if (widget >= WID_BT_TYPE_11 && widget <= WID_BT_TYPE_34) { Dimension d = GetMaxTreeSpriteSize(); @@ -102,7 +102,7 @@ public: } } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { if (widget < WID_BT_TYPE_11 || widget > WID_BT_TYPE_34 || widget - WID_BT_TYPE_11 >= this->count) return; @@ -111,7 +111,7 @@ public: DrawSprite(tree_sprites[i].sprite, tree_sprites[i].pal, (r.left + r.right) / 2 + WD_FRAMERECT_LEFT, r.bottom - 7); } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_BT_TYPE_11: case WID_BT_TYPE_12: case WID_BT_TYPE_13: case WID_BT_TYPE_14: @@ -138,17 +138,17 @@ public: } } - virtual void OnPlaceObject(Point pt, TileIndex tile) + void OnPlaceObject(Point pt, TileIndex tile) override { VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_PLANT_TREES); } - virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) + void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) override { VpSelectTilesWithMethod(pt.x, pt.y, select_method); } - virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) + void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) override { if (pt.x != -1 && select_proc == DDSP_PLANT_TREES) { DoCommandP(end_tile, this->tree_to_plant, start_tile, @@ -159,13 +159,13 @@ public: /** * Initialize the window data */ - virtual void OnInit() + void OnInit() override { this->base = _tree_base_by_landscape[_settings_game.game_creation.landscape]; this->count = _tree_count_by_landscape[_settings_game.game_creation.landscape]; } - virtual void OnPlaceObjectAbort() + void OnPlaceObjectAbort() override { this->RaiseButtons(); } diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 777716c64..f4e766589 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -605,7 +605,7 @@ struct RefitWindow : public Window { this->SetWidgetDisabledState(WID_VR_REFIT, this->sel[0] < 0); } - virtual void OnInit() + void OnInit() override { if (this->cargo != NULL) { /* Store the RefitOption currently in use. */ @@ -635,7 +635,7 @@ struct RefitWindow : public Window { } } - virtual void OnPaint() + void OnPaint() override { /* Determine amount of items for scroller. */ if (this->hscroll != NULL) this->hscroll->SetCount(this->vehicle_width); @@ -656,7 +656,7 @@ struct RefitWindow : public Window { this->DrawWidgets(); } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_VR_MATRIX: @@ -674,7 +674,7 @@ struct RefitWindow : public Window { } } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { if (widget == WID_VR_CAPTION) SetDParam(0, Vehicle::Get(this->window_number)->index); } @@ -726,7 +726,7 @@ struct RefitWindow : public Window { } } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (widget) { case WID_VR_VEHICLE_PANEL_DISPLAY: { @@ -808,7 +808,7 @@ struct RefitWindow : public Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { switch (data) { case VIWD_AUTOREPLACE: // Autoreplace replaced the vehicle; selected_vehicle became invalid. @@ -916,7 +916,7 @@ struct RefitWindow : public Window { } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_VR_VEHICLE_PANEL_DISPLAY: { // Vehicle image. @@ -958,7 +958,7 @@ struct RefitWindow : public Window { } } - virtual void OnMouseDrag(Point pt, int widget) + void OnMouseDrag(Point pt, int widget) override { switch (widget) { case WID_VR_VEHICLE_PANEL_DISPLAY: { // Vehicle image. @@ -971,7 +971,7 @@ struct RefitWindow : public Window { } } - virtual void OnDragDrop(Point pt, int widget) + void OnDragDrop(Point pt, int widget) override { switch (widget) { case WID_VR_VEHICLE_PANEL_DISPLAY: { // Vehicle image. @@ -984,7 +984,7 @@ struct RefitWindow : public Window { } } - virtual void OnResize() + void OnResize() override { this->vehicle_width = GetVehicleWidth(Vehicle::Get(this->window_number), EIT_IN_DETAILS); this->vscroll->SetCapacityFromWidget(this, WID_VR_MATRIX); @@ -1485,7 +1485,7 @@ public: *this->sorting = this->vehicles.GetListing(); } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_VL_LIST: @@ -1522,7 +1522,7 @@ public: } } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { switch (widget) { case WID_VL_AVAILABLE_VEHICLES: @@ -1565,7 +1565,7 @@ public: } } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { switch (widget) { case WID_VL_SORT_ORDER: @@ -1579,7 +1579,7 @@ public: } } - virtual void OnPaint() + void OnPaint() override { this->BuildVehicleList(); this->SortVehicleList(); @@ -1611,7 +1611,7 @@ public: this->DrawWidgets(); } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_VL_SORT_ORDER: // Flip sorting method ascending/descending @@ -1650,7 +1650,7 @@ public: } } - virtual void OnDropdownSelect(int widget, int index) + void OnDropdownSelect(int widget, int index) override { switch (widget) { case WID_VL_SORT_BY_PULLDOWN: @@ -1676,7 +1676,7 @@ public: this->SetDirty(); } - virtual void OnGameTick() + void OnGameTick() override { if (this->vehicles.NeedResort()) { StationID station = (this->vli.type == VL_STATION_LIST) ? this->vli.index : INVALID_STATION; @@ -1686,7 +1686,7 @@ public: } } - virtual void OnResize() + void OnResize() override { this->vscroll->SetCapacityFromWidget(this, WID_VL_LIST); } @@ -1696,7 +1696,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope && HasBit(data, 31) && this->vli.type == VL_SHARED_ORDERS) { /* Needs to be done in command-scope, so everything stays valid */ @@ -1886,7 +1886,7 @@ struct VehicleDetailsWindow : Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (data == VIWD_AUTOREPLACE) { /* Autoreplace replaced the vehicle. @@ -1926,7 +1926,7 @@ struct VehicleDetailsWindow : Window { return desired_height; } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { case WID_VD_TOP_DETAILS: { @@ -2030,12 +2030,12 @@ struct VehicleDetailsWindow : Window { } } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { if (widget == WID_VD_CAPTION) SetDParam(0, Vehicle::Get(this->window_number)->index); } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { const Vehicle *v = Vehicle::Get(this->window_number); @@ -2133,7 +2133,7 @@ struct VehicleDetailsWindow : Window { } /** Repaint vehicle details window. */ - virtual void OnPaint() + void OnPaint() override { const Vehicle *v = Vehicle::Get(this->window_number); @@ -2158,7 +2158,7 @@ struct VehicleDetailsWindow : Window { this->DrawWidgets(); } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_VD_RENAME_VEHICLE: { // rename @@ -2206,7 +2206,7 @@ struct VehicleDetailsWindow : Window { } } - virtual void OnDropdownSelect(int widget, int index) + void OnDropdownSelect(int widget, int index) override { switch (widget) { case WID_VD_SERVICE_INTERVAL_DROPDOWN: { @@ -2220,14 +2220,14 @@ struct VehicleDetailsWindow : Window { } } - virtual void OnQueryTextFinished(char *str) + void OnQueryTextFinished(char *str) override { if (str == NULL) return; DoCommandP(0, this->window_number, 0, CMD_RENAME_VEHICLE | CMD_MSG(STR_ERROR_CAN_T_RENAME_TRAIN + Vehicle::Get(this->window_number)->type), NULL, str); } - virtual void OnResize() + void OnResize() override { NWidgetCore *nwi = this->GetWidget<NWidgetCore>(WID_VD_MATRIX); if (nwi != NULL) { @@ -2515,7 +2515,7 @@ public: DeleteWindowById(WC_VEHICLE_TIMETABLE, this->window_number, false); } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { const Vehicle *v = Vehicle::Get(this->window_number); switch (widget) { @@ -2537,7 +2537,7 @@ public: } } - virtual void OnPaint() + void OnPaint() override { const Vehicle *v = Vehicle::Get(this->window_number); bool is_localcompany = v->owner == _local_company; @@ -2556,7 +2556,7 @@ public: this->DrawWidgets(); } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { if (widget != WID_VV_CAPTION) return; @@ -2564,7 +2564,7 @@ public: SetDParam(0, v->index); } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { if (widget != WID_VV_START_STOP) return; @@ -2663,7 +2663,7 @@ public: DrawString(text_left + lowered, text_right + lowered, r.top + WD_FRAMERECT_TOP + lowered, str, TC_FROMSTRING, SA_HOR_CENTER); } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { const Vehicle *v = Vehicle::Get(this->window_number); @@ -2726,7 +2726,7 @@ public: } } - virtual void OnResize() + void OnResize() override { if (this->viewport != NULL) { NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(WID_VV_VIEWPORT); @@ -2764,7 +2764,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (data == VIWD_AUTOREPLACE) { /* Autoreplace replaced the vehicle. @@ -2775,12 +2775,12 @@ public: this->UpdateButtonStatus(); } - virtual bool IsNewGRFInspectable() const + bool IsNewGRFInspectable() const override { return ::IsNewGRFInspectable(GetGrfSpecFeature(Vehicle::Get(this->window_number)->type), this->window_number); } - virtual void ShowNewGRFInspectWindow() const + void ShowNewGRFInspectWindow() const override { ::ShowNewGRFInspectWindow(GetGrfSpecFeature(Vehicle::Get(this->window_number)->type), this->window_number); } diff --git a/src/viewport_gui.cpp b/src/viewport_gui.cpp index 9c89a85f8..936990ac5 100644 --- a/src/viewport_gui.cpp +++ b/src/viewport_gui.cpp @@ -80,7 +80,7 @@ public: this->viewport->dest_scrollpos_y = this->viewport->scrollpos_y; } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { switch (widget) { case WID_EV_CAPTION: @@ -90,7 +90,7 @@ public: } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_EV_ZOOM_IN: DoZoomInOutWindow(ZOOM_IN, this); break; @@ -120,7 +120,7 @@ public: } } - virtual void OnResize() + void OnResize() override { if (this->viewport != NULL) { NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(WID_EV_VIEWPORT); @@ -128,7 +128,7 @@ public: } } - virtual void OnScroll(Point delta) + void OnScroll(Point delta) override { this->viewport->scrollpos_x += ScaleByZoom(delta.x, this->viewport->zoom); this->viewport->scrollpos_y += ScaleByZoom(delta.y, this->viewport->zoom); @@ -136,7 +136,7 @@ public: this->viewport->dest_scrollpos_y = this->viewport->scrollpos_y; } - virtual void OnMouseWheel(int wheel) + void OnMouseWheel(int wheel) override { if (_settings_client.gui.scrollwheel_scrolling != 2) { ZoomInOrOutToCursorWindow(wheel < 0, this); @@ -148,7 +148,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; /* Only handle zoom message if intended for us (msg ZOOM_IN/ZOOM_OUT) */ diff --git a/src/waypoint_gui.cpp b/src/waypoint_gui.cpp index fa4deaac6..5dd57c080 100644 --- a/src/waypoint_gui.cpp +++ b/src/waypoint_gui.cpp @@ -81,12 +81,12 @@ public: DeleteWindowById(GetWindowClassForVehicleType(this->vt), VehicleListIdentifier(VL_STATION_LIST, this->vt, this->owner, this->window_number).Pack(), false); } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { if (widget == WID_W_CAPTION) SetDParam(0, this->wp->index); } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_W_CENTER_VIEW: // scroll to location @@ -113,7 +113,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; /* You can only change your own waypoints */ @@ -124,7 +124,7 @@ public: ScrollWindowToTile(this->GetCenterTile(), this, true); } - virtual void OnResize() + void OnResize() override { if (this->viewport != NULL) { NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(WID_W_VIEWPORT); @@ -135,7 +135,7 @@ public: } } - virtual void OnQueryTextFinished(char *str) + void OnQueryTextFinished(char *str) override { if (str == NULL) return; |