1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-09-03 03:49:12 +00:00

Change: Display cargo lists in sorted cargo order. (#11383)

This commit is contained in:
2023-10-20 17:32:17 +01:00
committed by GitHub
parent 088db62dba
commit bb6fa9bf3b
5 changed files with 30 additions and 27 deletions

View File

@@ -306,19 +306,20 @@ public:
line << GetString(STR_LAND_AREA_INFORMATION_CARGO_ACCEPTED);
bool found = false;
for (CargoID i = 0; i < NUM_CARGO; ++i) {
if (acceptance[i] > 0) {
for (const CargoSpec *cs : _sorted_cargo_specs) {
CargoID cid = cs->Index();
if (acceptance[cid] > 0) {
/* Add a comma between each item. */
if (found) line << ", ";
found = true;
/* If the accepted value is less than 8, show it in 1/8:ths */
if (acceptance[i] < 8) {
SetDParam(0, acceptance[i]);
SetDParam(1, CargoSpec::Get(i)->name);
if (acceptance[cid] < 8) {
SetDParam(0, acceptance[cid]);
SetDParam(1, cs->name);
line << GetString(STR_LAND_AREA_INFORMATION_CARGO_EIGHTS);
} else {
line << GetString(CargoSpec::Get(i)->name);
line << GetString(cs->name);
}
}
}