summaryrefslogtreecommitdiff
path: root/src/company_gui.cpp
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2010-08-06 19:56:14 +0000
committeralberth <alberth@openttd.org>2010-08-06 19:56:14 +0000
commite0e66b6ed0c1085bdaefc6ac951c043a51525975 (patch)
tree730e9811a41cae2818038c43b1bf1feb01f20234 /src/company_gui.cpp
parent90a35d2e5b3728a8cd7fe1717d6c940b525cca9e (diff)
downloadopenttd-e0e66b6ed0c1085bdaefc6ac951c043a51525975.tar.xz
(svn r20390) -Codechange: Move company vehicle counting to vehicle.cpp.
Diffstat (limited to 'src/company_gui.cpp')
-rw-r--r--src/company_gui.cpp17
1 files changed, 4 insertions, 13 deletions
diff --git a/src/company_gui.cpp b/src/company_gui.cpp
index dc8ecfc22..441572709 100644
--- a/src/company_gui.cpp
+++ b/src/company_gui.cpp
@@ -20,7 +20,7 @@
#include "network/network_gui.h"
#include "network/network_func.h"
#include "economy_func.h"
-#include "vehicle_base.h"
+#include "vehicle_func.h"
#include "newgrf.h"
#include "company_manager_face.h"
#include "strings_func.h"
@@ -1852,19 +1852,10 @@ struct CompanyWindow : Window
break;
case CW_WIDGET_DESC_VEHICLE_COUNTS: {
- uint amounts[] = { 0, 0, 0, 0 };
- int y = r.top;
-
- const Vehicle *v;
- FOR_ALL_VEHICLES(v) {
- if (v->owner == c->index) {
- if (v->IsPrimaryVehicle()) {
- assert((size_t)v->type < lengthof(amounts));
- amounts[v->type]++;
- }
- }
- }
+ uint amounts[4];
+ CountCompanyVehicles((CompanyID)this->window_number, amounts);
+ int y = r.top;
if (amounts[0] + amounts[1] + amounts[2] + amounts[3] == 0) {
DrawString(r.left, r.right, y, STR_COMPANY_VIEW_VEHICLES_NONE);
} else {