comparison src/economy.cpp @ 18155:a7b36ae3de21 draft

(svn r22980) -Add: GroupStatistics for DEFAULT_GROUP.
author frosch <frosch@openttd.org>
date Mon, 03 Oct 2011 17:22:56 +0000
parents 1cac4486290e
children c1d6dd2fc6f6
comparison
equal deleted inserted replaced
18154:ebcb3f30bd4a 18155:a7b36ae3de21
398 FOR_ALL_VEHICLES(v) { 398 FOR_ALL_VEHICLES(v) {
399 if (v->owner == old_owner && IsCompanyBuildableVehicleType(v->type)) { 399 if (v->owner == old_owner && IsCompanyBuildableVehicleType(v->type)) {
400 if (new_owner == INVALID_OWNER) { 400 if (new_owner == INVALID_OWNER) {
401 if (v->Previous() == NULL) delete v; 401 if (v->Previous() == NULL) delete v;
402 } else { 402 } else {
403 if (v->IsEngineCountable()) GroupStatistics::CountEngine(v, -1);
404 if (v->IsPrimaryVehicle()) GroupStatistics::CountVehicle(v, -1);
405
403 v->owner = new_owner; 406 v->owner = new_owner;
404 v->colourmap = PAL_NONE; 407 v->colourmap = PAL_NONE;
405 if (v->IsEngineCountable()) Company::Get(new_owner)->num_engines[v->engine_type]++; 408
406 if (v->IsPrimaryVehicle()) v->unitnumber = unitidgen[v->type].NextID(); 409 if (v->IsEngineCountable()) {
410 Company::Get(new_owner)->num_engines[v->engine_type]++;
411 GroupStatistics::CountEngine(v, 1);
412 }
413 if (v->IsPrimaryVehicle()) {
414 GroupStatistics::CountVehicle(v, 1);
415 v->unitnumber = unitidgen[v->type].NextID();
416 }
407 417
408 /* Invalidate the vehicle's cargo payment "owner cache". */ 418 /* Invalidate the vehicle's cargo payment "owner cache". */
409 if (v->cargo_payment != NULL) v->cargo_payment->owner = NULL; 419 if (v->cargo_payment != NULL) v->cargo_payment->owner = NULL;
410 } 420 }
411 } 421 }