Simplify industry_tooltip_show_stockpiled setting

See: #564
pull/567/head
Jonathan G Rennison 11 months ago
parent 5d7721a2d4
commit 3e03cebad1

@ -3239,17 +3239,11 @@ void ShowIndustryCargoesWindow()
ShowIndustryCargoesWindow(NUM_INDUSTRYTYPES);
}
enum DisplayStockpiledCargoesMode : uint8 {
DSCM_OFF,
DSCM_REQUIRED,
DSCM_STOCKPILED
};
void ShowIndustryTooltip(Window *w, const TileIndex tile)
{
if (!_settings_client.gui.industry_tooltip_show) return;
if (!(_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;
_settings_client.gui.industry_tooltip_show_required || _settings_client.gui.industry_tooltip_show_stockpiled)) return;
const Industry *industry = Industry::GetByTile(tile);
const IndustrySpec *industry_spec = GetIndustrySpec(industry->type);
@ -3289,7 +3283,7 @@ void ShowIndustryTooltip(Window *w, const TileIndex tile)
const bool is_stockpile_without_suffix = (suffix.display == CSD_CARGO_AMOUNT);
const bool is_proper_stockpile_without_suffix = (is_stockpile_without_suffix && stockpiling); // If callback 37 fails, the result is interpreted as a stockpile, for some reason.
if (is_stockpile_with_suffix || is_proper_stockpile_without_suffix) {
if (_settings_client.gui.industry_tooltip_show_stockpiled != DSCM_REQUIRED) continue;
if (_settings_client.gui.industry_tooltip_show_stockpiled) continue;
}
StringID format = STR_INDUSTRY_VIEW_REQUIRED_TOOLTIP_NEXT;
@ -3311,7 +3305,7 @@ void ShowIndustryTooltip(Window *w, const TileIndex tile)
// Print out stockpiled cargo.
if (stockpiling && _settings_client.gui.industry_tooltip_show_stockpiled == DSCM_STOCKPILED) {
if (stockpiling && _settings_client.gui.industry_tooltip_show_stockpiled) {
for (size_t i = 0; i < accepted_cargo_count; ++i) {
CargoID stockpiled_cargo = industry->accepts_cargo[i];
if (stockpiled_cargo == CT_INVALID) continue;

@ -2169,12 +2169,7 @@ 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_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_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_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_HELPTEXT :Show a list of cargoes produced by industries in viewport tooltips when hovering over industry tiles.

@ -144,7 +144,7 @@ struct GUISettings : public TimeSettings {
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_required; ///< whether to display cargoes required 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; ///< whether to display cargoes stockpiled 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 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)

@ -4585,16 +4585,12 @@ def = false
str = STR_CONFIG_SETTING_INDUSTRY_TOOLTIP_REQUIRED
strhelp = STR_CONFIG_SETTING_INDUSTRY_TOOLTIP_REQUIRED_HELPTEXT
[SDTC_VAR]
[SDTC_BOOL]
var = gui.industry_tooltip_show_stockpiled
type = SLE_UINT8
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_GUI_DROPDOWN
def = 1
min = 0
max = 2
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC
def = false
str = STR_CONFIG_SETTING_INDUSTRY_TOOLTIP_STOCKPILED
strhelp = STR_CONFIG_SETTING_INDUSTRY_TOOLTIP_STOCKPILED_HELPTEXT
strval = STR_CONFIG_SETTING_INDUSTRY_TOOLTIP_STOCKPILED_OFF
[SDTC_BOOL]
var = gui.industry_tooltip_show_produced

Loading…
Cancel
Save