Codechange: Use override specifier in Window-derived classes.
This commit is contained in:
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user