diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index bf2b74863e..cdb3b8d946 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -368,27 +368,18 @@ class BuildIndustryWindow : public Window { assert(cargolist.size() == cargo_suffix.size()); std::string cargostring; - size_t numcargo = 0; - size_t firstcargo = 0; + std::string_view list_separator = GetListSeparator(); for (size_t j = 0; j < cargolist.size(); j++) { if (!IsValidCargoType(cargolist[j])) continue; - numcargo++; - if (numcargo == 1) { - firstcargo = j; - continue; - } + + if (!cargostring.empty()) cargostring += list_separator; auto params = MakeParameters(CargoSpec::Get(cargolist[j])->name, cargo_suffix[j].text); AppendStringWithArgsInPlace(cargostring, STR_INDUSTRY_VIEW_CARGO_LIST_EXTENSION, params); } - if (numcargo > 0) { - cargostring = GetString(prefixstr, CargoSpec::Get(cargolist[firstcargo])->name, cargo_suffix[firstcargo].text) + cargostring; - } else { - cargostring = GetString(prefixstr, STR_JUST_NOTHING, ""sv); - } - - return cargostring; + if (cargostring.empty()) AppendStringInPlace(cargostring, STR_JUST_NOTHING); + return GetString(prefixstr, cargostring); } public: diff --git a/src/lang/english.txt b/src/lang/english.txt index a663c238bc..aac211f0e8 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -4066,9 +4066,9 @@ STR_INDUSTRY_VIEW_CARGO_GRAPH_TOOLTIP :{BLACK}Shows th STR_INDUSTRY_VIEW_PRODUCTION_LEVEL :{BLACK}Production level: {YELLOW}{COMMA}% STR_INDUSTRY_VIEW_INDUSTRY_ANNOUNCED_CLOSURE :{YELLOW}The industry has announced imminent closure! -STR_INDUSTRY_VIEW_REQUIRES_N_CARGO :{BLACK}Requires: {YELLOW}{STRING}{RAW_STRING} -STR_INDUSTRY_VIEW_PRODUCES_N_CARGO :{BLACK}Produces: {YELLOW}{STRING}{RAW_STRING} -STR_INDUSTRY_VIEW_CARGO_LIST_EXTENSION :, {STRING}{RAW_STRING} +STR_INDUSTRY_VIEW_REQUIRES_N_CARGO :{BLACK}Requires: {YELLOW}{RAW_STRING} +STR_INDUSTRY_VIEW_PRODUCES_N_CARGO :{BLACK}Produces: {YELLOW}{RAW_STRING} +STR_INDUSTRY_VIEW_CARGO_LIST_EXTENSION :{STRING}{RAW_STRING} STR_INDUSTRY_VIEW_REQUIRES :{BLACK}Requires: STR_INDUSTRY_VIEW_ACCEPT_CARGO_SUFFIX :{YELLOW}{0:STRING}{BLACK}{3:RAW_STRING}