(svn r11045) -Codechange: added a function to tell if a vehicle is the rear part of a dualheaded train engine

This commit is contained in:
bjarni
2007-09-05 10:15:23 +00:00
parent 9e5376fefe
commit 7cd2aeb1c9
4 changed files with 18 additions and 8 deletions

View File

@@ -500,7 +500,7 @@ bool IsEngineCountable(const Vehicle *v)
case VEH_AIRCRAFT: return IsNormalAircraft(v); // don't count plane shadows and helicopter rotors
case VEH_TRAIN:
return !IsArticulatedPart(v) && // tenders and other articulated parts
(!IsMultiheaded(v) || IsTrainEngine(v)); // rear parts of multiheaded engines
!IsRearDualheaded(v); // rear parts of multiheaded engines
case VEH_ROAD: return IsRoadVehFront(v);
case VEH_SHIP: return true;
default: return false; // Only count player buildable vehicles
@@ -1733,7 +1733,7 @@ CommandCost CmdCloneVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
v = v_front;
do {
if (v->type == VEH_TRAIN && IsMultiheaded(v) && !IsTrainEngine(v)) {
if (v->type == VEH_TRAIN && IsRearDualheaded(v)) {
/* we build the rear ends of multiheaded trains with the front ones */
continue;
}