(svn r22980) -Add: GroupStatistics for DEFAULT_GROUP.

This commit is contained in:
frosch
2011-10-03 17:22:56 +00:00
parent fafa06e821
commit 5be8f73204
6 changed files with 46 additions and 28 deletions

View File

@@ -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;