Add an optional "(City)" in Viewport labels
This commit is contained in:

committed by
Jonathan G Rennison

parent
4d2db01a0f
commit
924b2ab9ec
@@ -2167,5 +2167,11 @@ STR_CONFIG_SETTING_STATION_RATING_TOOLTIP_MODE_OFF :Off
|
||||
STR_CONFIG_SETTING_STATION_RATING_TOOLTIP_MODE_SIMPLE :Simple
|
||||
STR_CONFIG_SETTING_STATION_RATING_TOOLTIP_MODE_DETAILED :Detailed
|
||||
|
||||
STR_CONFIG_SETTING_CITY_IN_LABEL :Show city in town name label: {STRING2}
|
||||
STR_CONFIG_SETTING_CITY_IN_LABEL_HELPTEXT :Display if a town is also a city in their label on the map
|
||||
|
||||
###length 4
|
||||
STR_VIEWPORT_TOWN_COLOUR :{1:SET_COLOUR}{0:TOWN}
|
||||
STR_VIEWPORT_TOWN_COLOUR_POP :{WHITE}{TOWN} {SET_COLOUR}({COMMA})
|
||||
STR_VIEWPORT_TOWN_COLOUR_CITY :{1:SET_COLOUR}{0:TOWN} (City)
|
||||
STR_VIEWPORT_TOWN_COLOUR_CITY_POP :{WHITE}{TOWN} {SET_COLOUR}(City, {COMMA})
|
||||
|
@@ -2039,6 +2039,7 @@ static SettingsContainer &GetSettingsTree()
|
||||
viewports->Add(new SettingEntry("gui.right_mouse_btn_emulation"));
|
||||
#endif
|
||||
viewports->Add(new SettingEntry("gui.population_in_label"));
|
||||
viewports->Add(new SettingEntry("gui.city_in_label"));
|
||||
viewports->Add(new SettingEntry("gui.liveries"));
|
||||
viewports->Add(new SettingEntry("gui.measure_tooltip"));
|
||||
viewports->Add(new SettingEntry("gui.loading_indicators"));
|
||||
|
@@ -181,6 +181,7 @@ struct GUISettings : public TimeSettings {
|
||||
byte max_num_lt_autosaves; ///< controls how many long-term autosavegames are made before the game starts to overwrite (names them 0 to max_num_lt_autosaves - 1)
|
||||
uint8 savegame_overwrite_confirm; ///< Mode for when to warn about overwriting an existing savegame
|
||||
bool population_in_label; ///< show the population of a town in its label?
|
||||
bool city_in_label; ///< show cities in label?
|
||||
uint8 right_mouse_btn_emulation; ///< should we emulate right mouse clicking?
|
||||
uint8 scrollwheel_scrolling; ///< scrolling using the scroll wheel?
|
||||
uint8 scrollwheel_multiplier; ///< how much 'wheel' per incoming event from the OS?
|
||||
|
@@ -1938,9 +1938,7 @@ static char *FormatString(char *buff, const char *str_arg, StringParameters *arg
|
||||
|
||||
bool tiny = (b == SCC_VIEWPORT_TOWN_LABEL2);
|
||||
StringID string_id = STR_VIEWPORT_TOWN_COLOUR;
|
||||
if (!tiny && HasBit(data, 40)) {
|
||||
string_id = STR_VIEWPORT_TOWN_COLOUR_POP;
|
||||
}
|
||||
if (!tiny) string_id += GB(data, 40, 2);
|
||||
int64 args_array[] = {t, GB(data, 32, 8), GB(data, 0, 32)};
|
||||
StringParameters tmp_params(args_array);
|
||||
buff = GetStringWithArgs(buff, string_id, &tmp_params, last);
|
||||
|
@@ -4762,6 +4762,14 @@ str = STR_CONFIG_SETTING_POPULATION_IN_LABEL
|
||||
strhelp = STR_CONFIG_SETTING_POPULATION_IN_LABEL_HELPTEXT
|
||||
post_cb = [](auto) { UpdateAllTownVirtCoords(); }
|
||||
|
||||
[SDTC_BOOL]
|
||||
var = gui.city_in_label
|
||||
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC
|
||||
def = false
|
||||
str = STR_CONFIG_SETTING_CITY_IN_LABEL
|
||||
strhelp = STR_CONFIG_SETTING_CITY_IN_LABEL_HELPTEXT
|
||||
post_cb = [](auto) { UpdateAllTownVirtCoords(); }
|
||||
|
||||
[SDTC_BOOL]
|
||||
var = gui.link_terraform_toolbar
|
||||
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC
|
||||
|
@@ -244,6 +244,7 @@ uint64 Town::LabelParam2() const
|
||||
SB(value, 32, 8, TC_WHITE);
|
||||
}
|
||||
if (_settings_client.gui.population_in_label) SetBit(value, 40);
|
||||
if (_settings_client.gui.city_in_label && this->larger_town) SetBit(value, 41);
|
||||
return value;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user