summaryrefslogtreecommitdiff
path: root/src/group_gui.cpp
diff options
context:
space:
mode:
authorBernard Teo <bernard.14916@gmail.com>2019-01-11 16:55:32 +0800
committerPatric Stout <github@truebrain.nl>2020-12-21 23:15:53 +0100
commita5047b7566ffdc430e6753a76d1381959275f259 (patch)
treee82c44b0d4fd645ec94aa0ab3fc14a1b32cbb3e0 /src/group_gui.cpp
parent61fb1cac546716fed45e1250be3ed26bffb312ef (diff)
downloadopenttd-a5047b7566ffdc430e6753a76d1381959275f259.tar.xz
Cleanup: Use range-based for-loop in group_gui.cpp
Diffstat (limited to 'src/group_gui.cpp')
-rw-r--r--src/group_gui.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/group_gui.cpp b/src/group_gui.cpp
index c5d9ac599..f1b1d4ef8 100644
--- a/src/group_gui.cpp
+++ b/src/group_gui.cpp
@@ -565,11 +565,9 @@ public:
case WID_GL_INFO: {
Money this_year = 0;
Money last_year = 0;
- uint32 occupancy = 0;
- size_t vehicle_count = this->vehicles.size();
+ uint64 occupancy = 0;
- for (uint i = 0; i < vehicle_count; i++) {
- const Vehicle *v = this->vehicles[i];
+ for (const Vehicle * const v : this->vehicles) {
assert(v->owner == this->owner);
this_year += v->GetDisplayProfitThisYear();
@@ -592,6 +590,7 @@ public:
y += FONT_HEIGHT_NORMAL;
DrawString(left, right, y, STR_GROUP_OCCUPANCY, TC_BLACK);
+ const size_t vehicle_count = this->vehicles.size();
if (vehicle_count > 0) {
SetDParam(0, occupancy / vehicle_count);
DrawString(left, right, y, STR_GROUP_OCCUPANCY_VALUE, TC_BLACK, SA_RIGHT);