diff options
author | Gabda87 <gabda87@gmail.com> | 2019-01-10 10:45:38 +0100 |
---|---|---|
committer | Ingo von Borstel <github@planetmaker.de> | 2019-01-10 10:45:38 +0100 |
commit | a0293d313ddad5d649c966f87585417729018836 (patch) | |
tree | 38f0ca2407a13f92e538b59e7437b180ea77dbb6 | |
parent | ad5a9daed52c7793a465b58b5407a5e58688e842 (diff) | |
download | openttd-a0293d313ddad5d649c966f87585417729018836.tar.xz |
Add #4115: default company colour setting (#6998)
Works only in single player.
-rw-r--r-- | src/lang/english.txt | 4 | ||||
-rw-r--r-- | src/openttd.cpp | 8 | ||||
-rw-r--r-- | src/settings_gui.cpp | 1 | ||||
-rw-r--r-- | src/settings_type.h | 1 | ||||
-rw-r--r-- | src/table/settings.ini | 12 |
5 files changed, 26 insertions, 0 deletions
diff --git a/src/lang/english.txt b/src/lang/english.txt index cb4e685c4..c0231557c 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -189,6 +189,7 @@ STR_COLOUR_ORANGE :Orange STR_COLOUR_BROWN :Brown STR_COLOUR_GREY :Grey STR_COLOUR_WHITE :White +STR_COLOUR_RANDOM :Random # Units used in OpenTTD STR_UNITS_VELOCITY_IMPERIAL :{COMMA}{NBSP}mph @@ -1258,6 +1259,9 @@ STR_CONFIG_SETTING_DYNAMIC_ENGINES_EXISTING_VEHICLES :{WHITE}Changing STR_CONFIG_SETTING_INFRASTRUCTURE_MAINTENANCE :Infrastructure maintenance: {STRING2} STR_CONFIG_SETTING_INFRASTRUCTURE_MAINTENANCE_HELPTEXT :When enabled, infrastructure causes maintenance costs. The cost grows over-proportional with the network size, thus affecting bigger companies more than smaller ones +STR_CONFIG_SETTING_COMPANY_STARTING_COLOUR :Starting company colour: {STRING2} +STR_CONFIG_SETTING_COMPANY_STARTING_COLOUR_HELPTEXT :Choose starting colour for the company + STR_CONFIG_SETTING_NEVER_EXPIRE_AIRPORTS :Airports never expire: {STRING2} STR_CONFIG_SETTING_NEVER_EXPIRE_AIRPORTS_HELPTEXT :Enabling this setting makes each airport type stay available forever after its introduction diff --git a/src/openttd.cpp b/src/openttd.cpp index 703f04f01..3d25f5d3d 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -942,6 +942,14 @@ static void MakeNewGameDone() Company *c = Company::Get(COMPANY_FIRST); c->settings = _settings_client.company; + /* Overwrite color from settings if needed + * COLOUR_END corresponds to Random colour */ + if (_settings_client.gui.starting_colour != COLOUR_END) { + c->colour = _settings_client.gui.starting_colour; + ResetCompanyLivery(c); + _company_colours[c->index] = (Colours)c->colour; + } + IConsoleCmdExec("exec scripts/game_start.scr 0"); SetLocalCompany(COMPANY_FIRST); diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 5ebac0280..134b1f58f 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -1584,6 +1584,7 @@ static SettingsContainer &GetSettingsTree() company->Add(new SettingEntry("gui.drag_signals_fixed_distance")); company->Add(new SettingEntry("gui.new_nonstop")); company->Add(new SettingEntry("gui.stop_location")); + company->Add(new SettingEntry("gui.starting_colour")); company->Add(new SettingEntry("company.engine_renew")); company->Add(new SettingEntry("company.engine_renew_months")); company->Add(new SettingEntry("company.engine_renew_money")); diff --git a/src/settings_type.h b/src/settings_type.h index 690f6d803..8f03b1dc1 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -146,6 +146,7 @@ struct GUISettings { byte missing_strings_threshold; ///< the number of missing strings before showing the warning uint8 graph_line_thickness; ///< the thickness of the lines in the various graph guis uint8 osk_activation; ///< Mouse gesture to trigger the OSK. + byte starting_colour; ///< default color scheme for the company to start a new game with uint16 console_backlog_timeout; ///< the minimum amount of time items should be in the console backlog before they will be removed in ~3 seconds granularity. uint16 console_backlog_length; ///< the minimum amount of items in the console backlog before items will be removed. diff --git a/src/table/settings.ini b/src/table/settings.ini index c061c394f..bb6159693 100644 --- a/src/table/settings.ini +++ b/src/table/settings.ini @@ -2755,6 +2755,18 @@ strhelp = STR_CONFIG_SETTING_LIVERIES_HELPTEXT strval = STR_CONFIG_SETTING_LIVERIES_NONE proc = InvalidateCompanyLiveryWindow +[SDTC_VAR] +var = gui.starting_colour +type = SLE_UINT8 +flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC +guiflags = SGF_MULTISTRING +def = COLOUR_END +min = 0 +max = COLOUR_END +str = STR_CONFIG_SETTING_COMPANY_STARTING_COLOUR +strhelp = STR_CONFIG_SETTING_COMPANY_STARTING_COLOUR_HELPTEXT +strval = STR_COLOUR_DARK_BLUE + [SDTC_BOOL] var = gui.prefer_teamchat flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC |