Update to 1.10.0-beta1

This commit is contained in:
dP
2019-10-31 22:24:28 +03:00
parent b84a475e14
commit 599ccf0c2b
1470 changed files with 354219 additions and 16795 deletions
+38 -38
View File
@@ -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);
@@ -595,7 +595,7 @@ public:
int numd = 0;
for (CompanyID k = COMPANY_FIRST; k < MAX_COMPANIES; k++) {
c = Company::GetIfValid(k);
if (c != NULL) {
if (c != nullptr) {
this->colours[numd] = _colour_gradient[c->colour][6];
for (int j = this->num_on_x_axis, i = 0; --j >= 0;) {
this->cost[numd][i] = (j >= c->num_valid_stat_ent) ? INVALID_DATAPOINT : GetGraphData(c, j);
@@ -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();
@@ -1136,21 +1136,21 @@ private:
{
if (!this->companies.NeedRebuild()) return;
this->companies.Clear();
this->companies.clear();
const Company *c;
FOR_ALL_COMPANIES(c) {
*this->companies.Append() = c;
this->companies.push_back(c);
}
this->companies.Compact();
this->companies.shrink_to_fit();
this->companies.RebuildDone();
}
/** Sort the company league by performance history */
static int CDECL PerformanceSorter(const Company * const *c1, const Company * const *c2)
static bool PerformanceSorter(const Company * const &c1, const Company * const &c2)
{
return (*c2)->old_economy[0].performance_history - (*c1)->old_economy[0].performance_history;
return c2->old_economy[0].performance_history < c1->old_economy[0].performance_history;
}
public:
@@ -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;
@@ -1183,7 +1183,7 @@ public:
uint text_left = rtl ? r.left + WD_FRAMERECT_LEFT : r.right - WD_FRAMERECT_LEFT - this->text_width;
uint text_right = rtl ? r.left + WD_FRAMERECT_LEFT + this->text_width : r.right - WD_FRAMERECT_LEFT;
for (uint i = 0; i != this->companies.Length(); i++) {
for (uint i = 0; i != this->companies.size(); i++) {
const Company *c = this->companies[i];
DrawString(ordinal_left, ordinal_right, y, i + STR_ORDINAL_NUMBER_1ST, i == 0 ? TC_WHITE : TC_YELLOW);
@@ -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 */