diff options
author | terkhen <terkhen@openttd.org> | 2010-04-16 18:49:24 +0000 |
---|---|---|
committer | terkhen <terkhen@openttd.org> | 2010-04-16 18:49:24 +0000 |
commit | d1c3234918fce4aae945eded5ecf0ed527bb000b (patch) | |
tree | 30671389bca0f3ace22c85e05bc436245e9136d7 | |
parent | 949a6dd58001c7d7a1809c7d6c2622f8121e65d8 (diff) | |
download | openttd-d1c3234918fce4aae945eded5ecf0ed527bb000b.tar.xz |
(svn r19642) -Add: Sort cargos alphabetically at the "Reffitable to" label in the
build vehicle window.
-rw-r--r-- | src/vehicle_gui.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 067c5a688..ebb0ff47d 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -572,15 +572,16 @@ uint ShowRefitOptionsList(int left, int right, int y, EngineID engine) bool first = true; /* Add each cargo type to the list */ - for (CargoID cid = 0; cid < NUM_CARGO; cid++) { - if (!HasBit(cmask, cid)) continue; + const CargoSpec *cs; + FOR_ALL_SORTED_CARGOSPECS(cs) { + if (!HasBit(cmask, cs->Index())) continue; if (b >= lastof(string) - (2 + 2 * 4)) break; // ", " and two calls to Utf8Encode() if (!first) b = strecpy(b, ", ", lastof(string)); first = false; - b = InlineString(b, CargoSpec::Get(cid)->name); + b = InlineString(b, cs->name); } } |