Changeset - r27751:1abb293ce3a8
[Not reviewed]
master
0 5 0
Henry Wilson - 12 months ago 2023-06-24 20:50:04
henry@henryandlizzy.uk
Feature: Add config option to set default company secondary colour for new games

This does duplicate translation strings for the colours
5 files changed with 42 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/lang/english.txt
Show inline comments
 
@@ -187,12 +187,32 @@ STR_COLOUR_PURPLE                       
 
STR_COLOUR_ORANGE                                               :Orange
 
STR_COLOUR_BROWN                                                :Brown
 
STR_COLOUR_GREY                                                 :Grey
 
STR_COLOUR_WHITE                                                :White
 
STR_COLOUR_RANDOM                                               :Random
 

	
 
###length 17
 
STR_COLOUR_SECONDARY_DARK_BLUE                                  :Dark Blue
 
STR_COLOUR_SECONDARY_PALE_GREEN                                 :Pale Green
 
STR_COLOUR_SECONDARY_SECONDARY_PINK                             :Pink
 
STR_COLOUR_SECONDARY_YELLOW                                     :Yellow
 
STR_COLOUR_SECONDARY_RED                                        :Red
 
STR_COLOUR_SECONDARY_LIGHT_BLUE                                 :Light Blue
 
STR_COLOUR_SECONDARY_GREEN                                      :Green
 
STR_COLOUR_SECONDARY_DARK_GREEN                                 :Dark Green
 
STR_COLOUR_SECONDARY_BLUE                                       :Blue
 
STR_COLOUR_SECONDARY_CREAM                                      :Cream
 
STR_COLOUR_SECONDARY_MAUVE                                      :Mauve
 
STR_COLOUR_SECONDARY_PURPLE                                     :Purple
 
STR_COLOUR_SECONDARY_ORANGE                                     :Orange
 
STR_COLOUR_SECONDARY_BROWN                                      :Brown
 
STR_COLOUR_SECONDARY_GREY                                       :Grey
 
STR_COLOUR_SECONDARY_WHITE                                      :White
 
STR_COLOUR_SECONDARY_SAME_AS_PRIMARY                            :Same As Primary
 

	
 

	
 
# Units used in OpenTTD
 
STR_UNITS_VELOCITY_IMPERIAL                                     :{DECIMAL}{NBSP}mph
 
STR_UNITS_VELOCITY_METRIC                                       :{DECIMAL}{NBSP}km/h
 
STR_UNITS_VELOCITY_SI                                           :{DECIMAL}{NBSP}m/s
 
STR_UNITS_VELOCITY_GAMEUNITS                                    :{DECIMAL}{NBSP}tiles/day
 
STR_UNITS_VELOCITY_KNOTS                                        :{DECIMAL}{NBSP}knots
 
@@ -1415,12 +1435,15 @@ STR_CONFIG_SETTING_DYNAMIC_ENGINES_EXIST
 
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_COMPANY_STARTING_COLOUR_SECONDARY            :Starting company secondary colour: {STRING2}
 
STR_CONFIG_SETTING_COMPANY_STARTING_COLOUR_SECONDARY_HELPTEXT   :Choose starting secondary colour for the company, if using a NewGRF that enables it.
 

	
 
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
 

	
 
STR_CONFIG_SETTING_WARN_LOST_VEHICLE                            :Warn if vehicle is lost: {STRING2}
 
STR_CONFIG_SETTING_WARN_LOST_VEHICLE_HELPTEXT                   :Trigger messages about vehicles unable to find a path to their ordered destination
 

	
src/openttd.cpp
Show inline comments
 
@@ -19,12 +19,13 @@
 
#include "error.h"
 
#include "error_func.h"
 
#include "gui.h"
 

	
 
#include "base_media_base.h"
 
#include "saveload/saveload.h"
 
#include "company_cmd.h"
 
#include "company_func.h"
 
#include "command_func.h"
 
#include "news_func.h"
 
#include "fios.h"
 
#include "aircraft.h"
 
#include "roadveh.h"
 
@@ -858,18 +859,23 @@ 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;
 
	}
 

	
 
	if (_settings_client.gui.starting_colour_secondary != COLOUR_END && HasBit(_loaded_newgrf_features.used_liveries, LS_DEFAULT)) {
 
		Command<CMD_SET_COMPANY_COLOUR>::Post(LS_DEFAULT, false, (Colours)_settings_client.gui.starting_colour_secondary);
 
	}
 

	
 
	OnStartGame(false);
 

	
 
	InitializeRailGUI();
 
	InitializeRoadGUI();
 

	
 
	/* We are the server, we start a new company (not dedicated),
src/settings_gui.cpp
Show inline comments
 
@@ -1857,12 +1857,13 @@ static SettingsContainer &GetSettingsTre
 
			company->Add(new SettingEntry("gui.signal_gui_mode"));
 
			company->Add(new SettingEntry("gui.drag_signals_fixed_distance"));
 
			company->Add(new SettingEntry("gui.auto_remove_signals"));
 
			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("gui.starting_colour_secondary"));
 
			company->Add(new SettingEntry("company.engine_renew"));
 
			company->Add(new SettingEntry("company.engine_renew_months"));
 
			company->Add(new SettingEntry("company.engine_renew_money"));
 
			company->Add(new SettingEntry("vehicle.servint_ispercent"));
 
			company->Add(new SettingEntry("vehicle.servint_trains"));
 
			company->Add(new SettingEntry("vehicle.servint_roadveh"));
src/settings_type.h
Show inline comments
 
@@ -183,12 +183,13 @@ struct GUISettings {
 
	bool   expenses_layout;                  ///< layout of expenses window
 
	uint32_t last_newgrf_count;                ///< the numbers of NewGRFs we found during the last scan
 
	byte   missing_strings_threshold;        ///< the number of missing strings before showing the warning
 
	uint8_t  graph_line_thickness;             ///< the thickness of the lines in the various graph guis
 
	uint8_t  osk_activation;                   ///< Mouse gesture to trigger the OSK.
 
	byte   starting_colour;                  ///< default color scheme for the company to start a new game with
 
	byte   starting_colour_secondary;        ///< default secondary color scheme for the company to start a new game with
 
	bool   show_newgrf_name;                 ///< Show the name of the NewGRF in the build vehicle window
 
	bool   show_cargo_in_vehicle_lists;      ///< Show the cargoes the vehicles can carry in the list windows
 
	bool   auto_remove_signals;              ///< automatically remove signals when in the way during rail construction
 
	uint16_t refresh_rate;                     ///< How often we refresh the screen (time between draw-ticks).
 
	uint16_t fast_forward_speed_limit;         ///< Game speed to use when fast-forward is enabled.
 

	
src/table/settings/gui_settings.ini
Show inline comments
 
@@ -349,12 +349,23 @@ 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_VAR]
 
var      = gui.starting_colour_secondary
 
type     = SLE_UINT8
 
flags    = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_GUI_DROPDOWN
 
def      = COLOUR_END
 
min      = 0
 
max      = COLOUR_END
 
str      = STR_CONFIG_SETTING_COMPANY_STARTING_COLOUR_SECONDARY
 
strhelp  = STR_CONFIG_SETTING_COMPANY_STARTING_COLOUR_SECONDARY_HELPTEXT
 
strval   = STR_COLOUR_SECONDARY_DARK_BLUE
 

	
 
[SDTC_BOOL]
 
var      = gui.auto_remove_signals
 
flags    = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC
 
def      = false
 
str      = STR_CONFIG_SETTING_AUTO_REMOVE_SIGNALS
 
strhelp  = STR_CONFIG_SETTING_AUTO_REMOVE_SIGNALS_HELPTEXT
0 comments (0 inline, 0 general)