From a5047b7566ffdc430e6753a76d1381959275f259 Mon Sep 17 00:00:00 2001 From: Bernard Teo Date: Fri, 11 Jan 2019 16:55:32 +0800 Subject: Cleanup: Use range-based for-loop in group_gui.cpp --- src/group_gui.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/group_gui.cpp') 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); -- cgit v1.2.3-54-g00ecf