summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2014-09-18 19:50:41 +0000
committeralberth <alberth@openttd.org>2014-09-18 19:50:41 +0000
commit4ff3ab1357a8d169379fe41e77ae8ae59a539047 (patch)
tree8c365f3f4769ae07bb47ab614d78bbf929ef6ad7
parentdfbcd8869df0627dc5ff2ee83aed00bc323e740b (diff)
downloadopenttd-4ff3ab1357a8d169379fe41e77ae8ae59a539047.tar.xz
(svn r26848) -Codechange: Unduplicate summing of cargo capacities in GetTotalCapacityOfArticulatedParts.
-rw-r--r--src/engine_gui.cpp8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/engine_gui.cpp b/src/engine_gui.cpp
index 3ac261d15..0e5324868 100644
--- a/src/engine_gui.cpp
+++ b/src/engine_gui.cpp
@@ -142,14 +142,8 @@ void ShowEnginePreviewWindow(EngineID engine)
*/
uint GetTotalCapacityOfArticulatedParts(EngineID engine)
{
- uint total = 0;
-
CargoArray cap = GetCapacityOfArticulatedParts(engine);
- for (CargoID c = 0; c < NUM_CARGO; c++) {
- total += cap[c];
- }
-
- return total;
+ return cap.GetSum<uint>();
}
static StringID GetTrainEngineInfoString(const Engine *e)