* Check if a vehicle is counted in num_engines in each company struct * @return true if the vehicle is counted in num_engines */
| 683 | * @return true if the vehicle is counted in num_engines |
| 684 | */ |
| 685 | bool Vehicle::IsEngineCountable() const |
| 686 | { |
| 687 | switch (this->type) { |
| 688 | case VEH_AIRCRAFT: return Aircraft::From(this)->IsNormalAircraft(); // don't count plane shadows and helicopter rotors |
| 689 | case VEH_TRAIN: |
| 690 | return !this->IsArticulatedPart() && // tenders and other articulated parts |
| 691 | !Train::From(this)->IsRearDualheaded(); // rear parts of multiheaded engines |
| 692 | case VEH_ROAD: return RoadVehicle::From(this)->IsFrontEngine(); |
| 693 | case VEH_SHIP: return true; |
| 694 | default: return false; // Only count company buildable vehicles |
| 695 | } |
| 696 | } |
| 697 | |
| 698 | /** |
| 699 | * Check whether Vehicle::engine_type has any meaning. |
no test coverage detected