mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-10 08:00:05 +00:00
Fix #12365: Company Window now displays proper inauguration year and period while in wallclock mode.
This commit is contained in:
parent
55ca1c77be
commit
7a698c7f1c
@ -92,6 +92,7 @@ struct CompanyProperties {
|
||||
TileIndex last_build_coordinate; ///< Coordinate of the last build thing by this company.
|
||||
|
||||
TimerGameEconomy::Year inaugurated_year; ///< Economy year of starting the company.
|
||||
TimerGameCalendar::Year inaugurated_year_calendar; ///< Calendar year of starting the company. Used to display proper Inauguration year while in wallclock mode.
|
||||
|
||||
uint8_t months_empty = 0; ///< NOSAVE: Number of months this company has not had a client in multiplayer.
|
||||
uint8_t months_of_bankruptcy; ///< Number of months that the company is unable to pay its debts
|
||||
|
@ -608,6 +608,7 @@ Company *DoStartupNewCompany(bool is_ai, CompanyID company = INVALID_COMPANY)
|
||||
c->avail_railtypes = GetCompanyRailTypes(c->index);
|
||||
c->avail_roadtypes = GetCompanyRoadTypes(c->index);
|
||||
c->inaugurated_year = TimerGameEconomy::year;
|
||||
c->inaugurated_year_calendar = TimerGameCalendar::year;
|
||||
|
||||
/* If starting a player company in singleplayer and a favorite company manager face is selected, choose it. Otherwise, use a random face.
|
||||
* In a network game, we'll choose the favorite face later in CmdCompanyCtrl to sync it to all clients. */
|
||||
|
@ -2113,7 +2113,7 @@ static constexpr NWidgetPart _nested_company_widgets[] = {
|
||||
NWidget(NWID_VERTICAL), SetPIP(0, WidgetDimensions::unscaled.vsep_normal, 0),
|
||||
NWidget(NWID_HORIZONTAL), SetPIP(0, WidgetDimensions::unscaled.hsep_normal, 0),
|
||||
NWidget(NWID_VERTICAL), SetPIP(0, WidgetDimensions::unscaled.vsep_normal, 0),
|
||||
NWidget(WWT_TEXT, COLOUR_GREY, WID_C_DESC_INAUGURATION), SetDataTip(STR_COMPANY_VIEW_INAUGURATED_TITLE, STR_NULL), SetFill(1, 0),
|
||||
NWidget(WWT_TEXT, COLOUR_GREY, WID_C_DESC_INAUGURATION), SetDataTip(STR_JUST_STRING2, STR_NULL), SetFill(1, 0),
|
||||
NWidget(NWID_HORIZONTAL), SetPIP(0, WidgetDimensions::unscaled.hsep_normal, 0),
|
||||
NWidget(WWT_LABEL, COLOUR_GREY, WID_C_DESC_COLOUR_SCHEME), SetDataTip(STR_COMPANY_VIEW_COLOUR_SCHEME_TITLE, STR_NULL),
|
||||
NWidget(WWT_EMPTY, INVALID_COLOUR, WID_C_DESC_COLOUR_SCHEME_EXAMPLE), SetMinimalSize(30, 0), SetFill(1, 1),
|
||||
@ -2401,7 +2401,14 @@ struct CompanyWindow : Window
|
||||
break;
|
||||
|
||||
case WID_C_DESC_INAUGURATION:
|
||||
SetDParam(0, Company::Get((CompanyID)this->window_number)->inaugurated_year);
|
||||
if (TimerGameEconomy::UsingWallclockUnits()) {
|
||||
SetDParam(0, STR_COMPANY_VIEW_INAUGURATED_TITLE_WALLCLOCK);
|
||||
SetDParam(1, Company::Get(static_cast<CompanyID>(this->window_number))->inaugurated_year_calendar);
|
||||
SetDParam(2, Company::Get(static_cast<CompanyID>(this->window_number))->inaugurated_year);
|
||||
} else {
|
||||
SetDParam(0, STR_COMPANY_VIEW_INAUGURATED_TITLE);
|
||||
SetDParam(1, Company::Get(static_cast<CompanyID>(this->window_number))->inaugurated_year);
|
||||
}
|
||||
break;
|
||||
|
||||
case WID_C_DESC_COMPANY_VALUE:
|
||||
|
@ -3895,6 +3895,7 @@ STR_COMPANY_VIEW_CAPTION :{WHITE}{COMPANY
|
||||
STR_COMPANY_VIEW_PRESIDENT_MANAGER_TITLE :{WHITE}{PRESIDENT_NAME}{}{GOLD}(Manager)
|
||||
|
||||
STR_COMPANY_VIEW_INAUGURATED_TITLE :{GOLD}Inaugurated: {WHITE}{NUM}
|
||||
STR_COMPANY_VIEW_INAUGURATED_TITLE_WALLCLOCK :{GOLD}Inaugurated: {WHITE}{NUM} (period {NUM})
|
||||
STR_COMPANY_VIEW_COLOUR_SCHEME_TITLE :{GOLD}Colour Scheme:
|
||||
STR_COMPANY_VIEW_VEHICLES_TITLE :{GOLD}Vehicles:
|
||||
STR_COMPANY_VIEW_TRAINS :{WHITE}{COMMA} train{P "" s}
|
||||
|
@ -3272,6 +3272,12 @@ bool AfterLoadGame()
|
||||
ScriptObject::InitializeRandomizers();
|
||||
}
|
||||
|
||||
if (IsSavegameVersionBefore(SLV_COMPANY_INAUGURATED_PERIOD)) {
|
||||
for (Company *c : Company::Iterate()) {
|
||||
c->inaugurated_year_calendar = _settings_game.game_creation.starting_year;
|
||||
}
|
||||
}
|
||||
|
||||
for (Company *c : Company::Iterate()) {
|
||||
UpdateCompanyLiveries(c);
|
||||
}
|
||||
|
@ -383,6 +383,7 @@ enum SaveLoadVersion : uint16_t {
|
||||
SLV_GROUP_NUMBERS, ///< 336 PR#12297 Add per-company group numbers.
|
||||
SLV_INCREASE_STATION_TYPE_FIELD_SIZE, ///< 337 PR#12572 Increase size of StationType field in map array
|
||||
SLV_ROAD_WAYPOINTS, ///< 338 PR#12572 Road waypoints
|
||||
SLV_COMPANY_INAUGURATED_PERIOD, ///< 339 PR#12798 Companies show the period inaugurated in wallclock mode.
|
||||
|
||||
SL_MAX_VERSION, ///< Highest possible saveload version
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user