summaryrefslogtreecommitdiff
path: root/src/economy.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-10-03 17:22:56 +0000
committerfrosch <frosch@openttd.org>2011-10-03 17:22:56 +0000
commit5be8f732049daa97fd212ed9b91354d3b146d99d (patch)
tree95b0fbac40c2002c8fcc2225506b4ab4ef48ed55 /src/economy.cpp
parentfafa06e821d27eaa6345d8a043a4a21b7c6e6381 (diff)
downloadopenttd-5be8f732049daa97fd212ed9b91354d3b146d99d.tar.xz
(svn r22980) -Add: GroupStatistics for DEFAULT_GROUP.
Diffstat (limited to 'src/economy.cpp')
-rw-r--r--src/economy.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/economy.cpp b/src/economy.cpp
index 970359786..fa626cf94 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -400,10 +400,20 @@ void ChangeOwnershipOfCompanyItems(Owner old_owner, Owner new_owner)
if (new_owner == INVALID_OWNER) {
if (v->Previous() == NULL) delete v;
} else {
+ if (v->IsEngineCountable()) GroupStatistics::CountEngine(v, -1);
+ if (v->IsPrimaryVehicle()) GroupStatistics::CountVehicle(v, -1);
+
v->owner = new_owner;
v->colourmap = PAL_NONE;
- if (v->IsEngineCountable()) Company::Get(new_owner)->num_engines[v->engine_type]++;
- if (v->IsPrimaryVehicle()) v->unitnumber = unitidgen[v->type].NextID();
+
+ if (v->IsEngineCountable()) {
+ Company::Get(new_owner)->num_engines[v->engine_type]++;
+ GroupStatistics::CountEngine(v, 1);
+ }
+ if (v->IsPrimaryVehicle()) {
+ GroupStatistics::CountVehicle(v, 1);
+ v->unitnumber = unitidgen[v->type].NextID();
+ }
/* Invalidate the vehicle's cargo payment "owner cache". */
if (v->cargo_payment != NULL) v->cargo_payment->owner = NULL;