summaryrefslogtreecommitdiff
path: root/src/vehicle.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-07-13 16:35:22 +0000
committersmatz <smatz@openttd.org>2009-07-13 16:35:22 +0000
commit868c21cbcc3b04e4e6649417ff94763a82c7d8b5 (patch)
tree5b5c1b451eff9b600077da230411e02dd09ec514 /src/vehicle.cpp
parentbb9fee178da65f6b606e6853821f15a26c1ab3eb (diff)
downloadopenttd-868c21cbcc3b04e4e6649417ff94763a82c7d8b5.tar.xz
(svn r16813) -Codechange: make IsEngineCountable() member of Vehicle
Diffstat (limited to 'src/vehicle.cpp')
-rw-r--r--src/vehicle.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index bed1d0fcc..df1059391 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -473,17 +473,16 @@ uint CountVehiclesInChain(const Vehicle *v)
}
/** Check if a vehicle is counted in num_engines in each company struct
- * @param *v Vehicle to test
* @return true if the vehicle is counted in num_engines
*/
-bool IsEngineCountable(const Vehicle *v)
+bool Vehicle::IsEngineCountable() const
{
- switch (v->type) {
- case VEH_AIRCRAFT: return IsNormalAircraft(v); // don't count plane shadows and helicopter rotors
+ switch (this->type) {
+ case VEH_AIRCRAFT: return IsNormalAircraft(this); // don't count plane shadows and helicopter rotors
case VEH_TRAIN:
- return !Train::From(v)->IsArticulatedPart() && // tenders and other articulated parts
- !Train::From(v)->IsRearDualheaded(); // rear parts of multiheaded engines
- case VEH_ROAD: return RoadVehicle::From(v)->IsRoadVehFront();
+ return !Train::From(this)->IsArticulatedPart() && // tenders and other articulated parts
+ !Train::From(this)->IsRearDualheaded(); // rear parts of multiheaded engines
+ case VEH_ROAD: return RoadVehicle::From(this)->IsRoadVehFront();
case VEH_SHIP: return true;
default: return false; // Only count company buildable vehicles
}
@@ -501,7 +500,7 @@ void Vehicle::PreDestructor()
delete this->cargo_payment;
}
- if (IsEngineCountable(this)) {
+ if (this->IsEngineCountable()) {
Company::Get(this->owner)->num_engines[this->engine_type]--;
if (this->owner == _local_company) InvalidateAutoreplaceWindow(this->engine_type, this->group_id);