mirror of https://github.com/OpenTTD/OpenTTD
Cleanup: Use range-based for-loop in group_gui.cpp
parent
61fb1cac54
commit
a5047b7566
|
@ -565,11 +565,9 @@ public:
|
||||||
case WID_GL_INFO: {
|
case WID_GL_INFO: {
|
||||||
Money this_year = 0;
|
Money this_year = 0;
|
||||||
Money last_year = 0;
|
Money last_year = 0;
|
||||||
uint32 occupancy = 0;
|
uint64 occupancy = 0;
|
||||||
size_t vehicle_count = this->vehicles.size();
|
|
||||||
|
|
||||||
for (uint i = 0; i < vehicle_count; i++) {
|
for (const Vehicle * const v : this->vehicles) {
|
||||||
const Vehicle *v = this->vehicles[i];
|
|
||||||
assert(v->owner == this->owner);
|
assert(v->owner == this->owner);
|
||||||
|
|
||||||
this_year += v->GetDisplayProfitThisYear();
|
this_year += v->GetDisplayProfitThisYear();
|
||||||
|
@ -592,6 +590,7 @@ public:
|
||||||
|
|
||||||
y += FONT_HEIGHT_NORMAL;
|
y += FONT_HEIGHT_NORMAL;
|
||||||
DrawString(left, right, y, STR_GROUP_OCCUPANCY, TC_BLACK);
|
DrawString(left, right, y, STR_GROUP_OCCUPANCY, TC_BLACK);
|
||||||
|
const size_t vehicle_count = this->vehicles.size();
|
||||||
if (vehicle_count > 0) {
|
if (vehicle_count > 0) {
|
||||||
SetDParam(0, occupancy / vehicle_count);
|
SetDParam(0, occupancy / vehicle_count);
|
||||||
DrawString(left, right, y, STR_GROUP_OCCUPANCY_VALUE, TC_BLACK, SA_RIGHT);
|
DrawString(left, right, y, STR_GROUP_OCCUPANCY_VALUE, TC_BLACK, SA_RIGHT);
|
||||||
|
|
Loading…
Reference in New Issue