Fix f34c45c36d: Incorrect colour in cargo list in fund industry window.

This commit is contained in:
Peter Nelson
2025-12-25 22:30:25 +00:00
committed by dP
parent 937e3dcd0a
commit b54cc9c9e7
2 changed files with 8 additions and 17 deletions

View File

@@ -404,27 +404,18 @@ class BuildIndustryWindow : public Window {
assert(cargolist.size() == cargo_suffix.size()); assert(cargolist.size() == cargo_suffix.size());
std::string cargostring; std::string cargostring;
size_t numcargo = 0; std::string_view list_separator = GetListSeparator();
size_t firstcargo = 0;
for (size_t j = 0; j < cargolist.size(); j++) { for (size_t j = 0; j < cargolist.size(); j++) {
if (!IsValidCargoType(cargolist[j])) continue; if (!IsValidCargoType(cargolist[j])) continue;
numcargo++;
if (numcargo == 1) { if (!cargostring.empty()) cargostring += list_separator;
firstcargo = j;
continue;
}
auto params = MakeParameters(CargoSpec::Get(cargolist[j])->name, cargo_suffix[j].text); auto params = MakeParameters(CargoSpec::Get(cargolist[j])->name, cargo_suffix[j].text);
AppendStringWithArgsInPlace(cargostring, STR_INDUSTRY_VIEW_CARGO_LIST_EXTENSION, params); AppendStringWithArgsInPlace(cargostring, STR_INDUSTRY_VIEW_CARGO_LIST_EXTENSION, params);
} }
if (numcargo > 0) { if (cargostring.empty()) AppendStringInPlace(cargostring, STR_JUST_NOTHING);
cargostring = GetString(prefixstr, CargoSpec::Get(cargolist[firstcargo])->name, cargo_suffix[firstcargo].text) + cargostring; return GetString(prefixstr, cargostring);
} else {
cargostring = GetString(prefixstr, STR_JUST_NOTHING, ""sv);
}
return cargostring;
} }
public: public:

View File

@@ -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_PRODUCTION_LEVEL :{BLACK}Production level: {YELLOW}{COMMA}%
STR_INDUSTRY_VIEW_INDUSTRY_ANNOUNCED_CLOSURE :{YELLOW}The industry has announced imminent closure! 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_REQUIRES_N_CARGO :{BLACK}Requires: {YELLOW}{RAW_STRING}
STR_INDUSTRY_VIEW_PRODUCES_N_CARGO :{BLACK}Produces: {YELLOW}{STRING}{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_CARGO_LIST_EXTENSION :{STRING}{RAW_STRING}
STR_INDUSTRY_VIEW_REQUIRES :{BLACK}Requires: STR_INDUSTRY_VIEW_REQUIRES :{BLACK}Requires:
STR_INDUSTRY_VIEW_ACCEPT_CARGO_SUFFIX :{YELLOW}{0:STRING}{BLACK}{3:RAW_STRING} STR_INDUSTRY_VIEW_ACCEPT_CARGO_SUFFIX :{YELLOW}{0:STRING}{BLACK}{3:RAW_STRING}