[Change] Reworked stockpile settings into 1 dropdown.
This commit is contained in:
@@ -3239,6 +3239,12 @@ void ShowIndustryCargoesWindow()
|
|||||||
ShowIndustryCargoesWindow(NUM_INDUSTRYTYPES);
|
ShowIndustryCargoesWindow(NUM_INDUSTRYTYPES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum DisplayStockpiledCargoesMode : uint8 {
|
||||||
|
DSCM_OFF,
|
||||||
|
DSCM_REQUIRED,
|
||||||
|
DSCM_STOCKPILED
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fills given data buffer with a string of characters that describe given industry, to be used to display a tooltip, when hovering over the industry tile.
|
* Fills given data buffer with a string of characters that describe given industry, to be used to display a tooltip, when hovering over the industry tile.
|
||||||
* @param tile Index of the industry tile.
|
* @param tile Index of the industry tile.
|
||||||
@@ -3248,6 +3254,10 @@ void ShowIndustryCargoesWindow()
|
|||||||
*/
|
*/
|
||||||
bool GetIndustryTooltipString(const TileIndex tile, char *buffer_position, const char *buffer_tail)
|
bool GetIndustryTooltipString(const TileIndex tile, char *buffer_position, const char *buffer_tail)
|
||||||
{
|
{
|
||||||
|
if (!_settings_client.gui.industry_tooltip_show ||
|
||||||
|
!(_settings_client.gui.industry_tooltip_show_name || _settings_client.gui.industry_tooltip_show_produced ||
|
||||||
|
_settings_client.gui.industry_tooltip_show_required || _settings_client.gui.industry_tooltip_show_stockpiled != DSCM_OFF)) return false;
|
||||||
|
|
||||||
const Industry *industry = Industry::GetByTile(tile);
|
const Industry *industry = Industry::GetByTile(tile);
|
||||||
const IndustrySpec *industry_spec = GetIndustrySpec(industry->type);
|
const IndustrySpec *industry_spec = GetIndustrySpec(industry->type);
|
||||||
|
|
||||||
@@ -3291,7 +3301,7 @@ bool GetIndustryTooltipString(const TileIndex tile, char *buffer_position, const
|
|||||||
bool isStockpileWithoutSuffix = suffix->display == CSD_CARGO_AMOUNT;
|
bool isStockpileWithoutSuffix = suffix->display == CSD_CARGO_AMOUNT;
|
||||||
bool isProperStockpileWithoutSuffix = isStockpileWithoutSuffix && stockpiling; // If callback 37 fails, the result is interpreted as a stockpile, for some reason.
|
bool isProperStockpileWithoutSuffix = isStockpileWithoutSuffix && stockpiling; // If callback 37 fails, the result is interpreted as a stockpile, for some reason.
|
||||||
if (isStockpileWithSuffix || isProperStockpileWithoutSuffix) {
|
if (isStockpileWithSuffix || isProperStockpileWithoutSuffix) {
|
||||||
if (_settings_client.gui.industry_tooltip_show_stockpiled || !_settings_client.gui.industry_tooltip_show_stockpiled_as_required) continue;
|
if (_settings_client.gui.industry_tooltip_show_stockpiled != DSCM_REQUIRED) continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto format = STR_INDUSTRY_VIEW_REQUIRED_TOOLTIP_NEXT;
|
auto format = STR_INDUSTRY_VIEW_REQUIRED_TOOLTIP_NEXT;
|
||||||
@@ -3321,7 +3331,7 @@ bool GetIndustryTooltipString(const TileIndex tile, char *buffer_position, const
|
|||||||
|
|
||||||
// Print out stockpiled cargo.
|
// Print out stockpiled cargo.
|
||||||
|
|
||||||
if (stockpiling && _settings_client.gui.industry_tooltip_show_stockpiled) {
|
if (stockpiling && _settings_client.gui.industry_tooltip_show_stockpiled == DSCM_STOCKPILED) {
|
||||||
for (byte i = 0; i < accepted_cargo_count; ++i) {
|
for (byte i = 0; i < accepted_cargo_count; ++i) {
|
||||||
auto stockpiled_cargo = industry->accepts_cargo[i];
|
auto stockpiled_cargo = industry->accepts_cargo[i];
|
||||||
if (stockpiled_cargo == CT_INVALID) continue;
|
if (stockpiled_cargo == CT_INVALID) continue;
|
||||||
|
@@ -2174,6 +2174,10 @@ STR_CONFIG_SETTING_INDUSTRY_TOOLTIP_REQUIRED :Show required c
|
|||||||
STR_CONFIG_SETTING_INDUSTRY_TOOLTIP_REQUIRED_HELPTEXT :Show a list of cargoes required by industries in viewport tooltips when hovering over industry tiles.
|
STR_CONFIG_SETTING_INDUSTRY_TOOLTIP_REQUIRED_HELPTEXT :Show a list of cargoes required by industries in viewport tooltips when hovering over industry tiles.
|
||||||
STR_CONFIG_SETTING_INDUSTRY_TOOLTIP_STOCKPILED :Show stockpiled cargoes in industry viewport tooltips: {STRING2}
|
STR_CONFIG_SETTING_INDUSTRY_TOOLTIP_STOCKPILED :Show stockpiled cargoes in industry viewport tooltips: {STRING2}
|
||||||
STR_CONFIG_SETTING_INDUSTRY_TOOLTIP_STOCKPILED_HELPTEXT :Show a list of cargoes stockpiled by industries in viewport tooltips when hovering over industry tiles.
|
STR_CONFIG_SETTING_INDUSTRY_TOOLTIP_STOCKPILED_HELPTEXT :Show a list of cargoes stockpiled by industries in viewport tooltips when hovering over industry tiles.
|
||||||
|
STR_CONFIG_SETTING_INDUSTRY_TOOLTIP_STOCKPILED_OFF :Don't show
|
||||||
|
STR_CONFIG_SETTING_INDUSTRY_TOOLTIP_STOCKPILED_REQUIRED :Show in the list of required cargoes, if the latter is shown
|
||||||
|
STR_CONFIG_SETTING_INDUSTRY_TOOLTIP_STOCKPILED_STOCKPILED :Show as a list of amounts waiting to be processed
|
||||||
|
|
||||||
STR_CONFIG_SETTING_INDUSTRY_TOOLTIP_STOCKPILED_AS_REQUIRED :Show stockpiled cargoes as required in viewport tooltips: {STRING2}
|
STR_CONFIG_SETTING_INDUSTRY_TOOLTIP_STOCKPILED_AS_REQUIRED :Show stockpiled cargoes as required in viewport tooltips: {STRING2}
|
||||||
STR_CONFIG_SETTING_INDUSTRY_TOOLTIP_STOCKPILED_AS_REQUIRED_HELPTEXT:If normal display of stockpiled cargoes in viewport tooltips is disabled, then allow them to, at least, be displayed as required ones.
|
STR_CONFIG_SETTING_INDUSTRY_TOOLTIP_STOCKPILED_AS_REQUIRED_HELPTEXT:If normal display of stockpiled cargoes in viewport tooltips is disabled, then allow them to, at least, be displayed as required ones.
|
||||||
STR_CONFIG_SETTING_INDUSTRY_TOOLTIP_PRODUCED :Show produced cargoes in industry viewport tooltips: {STRING2}
|
STR_CONFIG_SETTING_INDUSTRY_TOOLTIP_PRODUCED :Show produced cargoes in industry viewport tooltips: {STRING2}
|
||||||
|
@@ -1982,7 +1982,6 @@ static SettingsContainer &GetSettingsTree()
|
|||||||
tooltips->Add(new ConditionallyHiddenSettingEntry("gui.industry_tooltip_show_name", []() -> bool { return !_settings_client.gui.industry_tooltip_show; }));
|
tooltips->Add(new ConditionallyHiddenSettingEntry("gui.industry_tooltip_show_name", []() -> bool { return !_settings_client.gui.industry_tooltip_show; }));
|
||||||
tooltips->Add(new ConditionallyHiddenSettingEntry("gui.industry_tooltip_show_required", []() -> bool { return !_settings_client.gui.industry_tooltip_show; }));
|
tooltips->Add(new ConditionallyHiddenSettingEntry("gui.industry_tooltip_show_required", []() -> bool { return !_settings_client.gui.industry_tooltip_show; }));
|
||||||
tooltips->Add(new ConditionallyHiddenSettingEntry("gui.industry_tooltip_show_stockpiled", []() -> bool { return !_settings_client.gui.industry_tooltip_show; }));
|
tooltips->Add(new ConditionallyHiddenSettingEntry("gui.industry_tooltip_show_stockpiled", []() -> bool { return !_settings_client.gui.industry_tooltip_show; }));
|
||||||
tooltips->Add(new ConditionallyHiddenSettingEntry("gui.industry_tooltip_show_stockpiled_as_required", []() -> bool { return !_settings_client.gui.industry_tooltip_show || _settings_client.gui.industry_tooltip_show_stockpiled || !_settings_client.gui.industry_tooltip_show_required; }));
|
|
||||||
tooltips->Add(new ConditionallyHiddenSettingEntry("gui.industry_tooltip_show_produced", []() -> bool { return !_settings_client.gui.industry_tooltip_show; }));
|
tooltips->Add(new ConditionallyHiddenSettingEntry("gui.industry_tooltip_show_produced", []() -> bool { return !_settings_client.gui.industry_tooltip_show; }));
|
||||||
tooltips->Add(new SettingEntry("gui.depot_tooltip_mode"));
|
tooltips->Add(new SettingEntry("gui.depot_tooltip_mode"));
|
||||||
tooltips->Add(new SettingEntry("gui.station_viewport_tooltip_name"));
|
tooltips->Add(new SettingEntry("gui.station_viewport_tooltip_name"));
|
||||||
|
@@ -144,8 +144,7 @@ struct GUISettings : public TimeSettings {
|
|||||||
bool industry_tooltip_show; ///< whether to display tooltips, when hovering over industry tiles.
|
bool industry_tooltip_show; ///< whether to display tooltips, when hovering over industry tiles.
|
||||||
bool industry_tooltip_show_name; ///< whether to display the name of the industry, when hovering over one of its tiles.
|
bool industry_tooltip_show_name; ///< whether to display the name of the industry, when hovering over one of its tiles.
|
||||||
bool industry_tooltip_show_required; ///< whether to display cargoes required by the industry, when hovering over one of its tiles.
|
bool industry_tooltip_show_required; ///< whether to display cargoes required by the industry, when hovering over one of its tiles.
|
||||||
bool industry_tooltip_show_stockpiled; ///< whether to display cargoes stockpiled by the industry, when hovering over one of its tiles.
|
uint8 industry_tooltip_show_stockpiled; ///< whether and how to display cargoes stockpiled by the industry, when hovering over one of its tiles.
|
||||||
bool industry_tooltip_show_stockpiled_as_required; ///< whether to display cargoes stockpiled by the industry as ones required by the industry, when hovering over one of its tiles and normal display of stockpiled cargoes in viewport tooltips is turned off.
|
|
||||||
bool industry_tooltip_show_produced; ///< whether to display cargoes produced by the industry, when hovering over one of its tiles.
|
bool industry_tooltip_show_produced; ///< whether to display cargoes produced by the industry, when hovering over one of its tiles.
|
||||||
uint8 depot_tooltip_mode; ///< Display mode for depot viewport tooltips. (0 = never, 1 = just a total number of vehicles, 2 = total number of vehicles in the depot along with a breakdown of numbers)
|
uint8 depot_tooltip_mode; ///< Display mode for depot viewport tooltips. (0 = never, 1 = just a total number of vehicles, 2 = total number of vehicles in the depot along with a breakdown of numbers)
|
||||||
uint8 station_viewport_tooltip_name; ///< Show the name of the station in a viewport tooltip. (0 = never, 1 = only if station names are hidden, 2 = always)
|
uint8 station_viewport_tooltip_name; ///< Show the name of the station in a viewport tooltip. (0 = never, 1 = only if station names are hidden, 2 = always)
|
||||||
|
@@ -4584,22 +4584,17 @@ flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC
|
|||||||
def = false
|
def = false
|
||||||
str = STR_CONFIG_SETTING_INDUSTRY_TOOLTIP_REQUIRED
|
str = STR_CONFIG_SETTING_INDUSTRY_TOOLTIP_REQUIRED
|
||||||
strhelp = STR_CONFIG_SETTING_INDUSTRY_TOOLTIP_REQUIRED_HELPTEXT
|
strhelp = STR_CONFIG_SETTING_INDUSTRY_TOOLTIP_REQUIRED_HELPTEXT
|
||||||
post_cb = [](auto) { InvalidateWindowClassesData(WC_GAME_OPTIONS); }
|
|
||||||
|
|
||||||
[SDTC_BOOL]
|
[SDTC_VAR]
|
||||||
var = gui.industry_tooltip_show_stockpiled
|
var = gui.industry_tooltip_show_stockpiled
|
||||||
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC
|
type = SLE_UINT8
|
||||||
def = false
|
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_GUI_DROPDOWN
|
||||||
|
def = 1
|
||||||
|
min = 0
|
||||||
|
max = 2
|
||||||
str = STR_CONFIG_SETTING_INDUSTRY_TOOLTIP_STOCKPILED
|
str = STR_CONFIG_SETTING_INDUSTRY_TOOLTIP_STOCKPILED
|
||||||
strhelp = STR_CONFIG_SETTING_INDUSTRY_TOOLTIP_STOCKPILED_HELPTEXT
|
strhelp = STR_CONFIG_SETTING_INDUSTRY_TOOLTIP_STOCKPILED_HELPTEXT
|
||||||
post_cb = [](auto) { InvalidateWindowClassesData(WC_GAME_OPTIONS); }
|
strval = STR_CONFIG_SETTING_INDUSTRY_TOOLTIP_STOCKPILED_OFF
|
||||||
|
|
||||||
[SDTC_BOOL]
|
|
||||||
var = gui.industry_tooltip_show_stockpiled_as_required
|
|
||||||
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC
|
|
||||||
def = true
|
|
||||||
str = STR_CONFIG_SETTING_INDUSTRY_TOOLTIP_STOCKPILED_AS_REQUIRED
|
|
||||||
strhelp = STR_CONFIG_SETTING_INDUSTRY_TOOLTIP_STOCKPILED_AS_REQUIRED_HELPTEXT
|
|
||||||
|
|
||||||
[SDTC_BOOL]
|
[SDTC_BOOL]
|
||||||
var = gui.industry_tooltip_show_produced
|
var = gui.industry_tooltip_show_produced
|
||||||
|
@@ -264,10 +264,6 @@ bool GetIndustryTooltipString(TileIndex tile, char *buffer_position, const char
|
|||||||
|
|
||||||
void ShowIndustryTooltip(Window *w, const TileIndex tile, char *buffer_position, const char *buffer_tail)
|
void ShowIndustryTooltip(Window *w, const TileIndex tile, char *buffer_position, const char *buffer_tail)
|
||||||
{
|
{
|
||||||
if (!_settings_client.gui.industry_tooltip_show ||
|
|
||||||
!(_settings_client.gui.industry_tooltip_show_name || _settings_client.gui.industry_tooltip_show_produced ||
|
|
||||||
_settings_client.gui.industry_tooltip_show_required || _settings_client.gui.industry_tooltip_show_stockpiled)) return;
|
|
||||||
|
|
||||||
if (!GetIndustryTooltipString(tile, buffer_position, buffer_tail)) return;
|
if (!GetIndustryTooltipString(tile, buffer_position, buffer_tail)) return;
|
||||||
|
|
||||||
SetDParamStr(0, buffer_position);
|
SetDParamStr(0, buffer_position);
|
||||||
|
Reference in New Issue
Block a user