diff options
author | terkhen <terkhen@openttd.org> | 2011-01-29 17:30:25 +0000 |
---|---|---|
committer | terkhen <terkhen@openttd.org> | 2011-01-29 17:30:25 +0000 |
commit | 734994c9ba642f5c75b709d4b44e0c4b993a949a (patch) | |
tree | f7f6264f438d4707aaa7e4bfe4c2a223a0c4abba /src/autoreplace_cmd.cpp | |
parent | 50b0e1002621720c6b2cd4b8e20856b86da0b61d (diff) | |
download | openttd-734994c9ba642f5c75b709d4b44e0c4b993a949a.tar.xz |
(svn r21924) -Codechange: Unify some parts of the articulated vehicle code.
-Cleanup: Avoid conversions to Train and RoadVehicle that are no longer required.
Diffstat (limited to 'src/autoreplace_cmd.cpp')
-rw-r--r-- | src/autoreplace_cmd.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/autoreplace_cmd.cpp b/src/autoreplace_cmd.cpp index 72fa1ffc4..b2360e583 100644 --- a/src/autoreplace_cmd.cpp +++ b/src/autoreplace_cmd.cpp @@ -101,18 +101,18 @@ static void TransferCargo(Vehicle *old_veh, Vehicle *new_head, bool part_of_chai assert(!part_of_chain || new_head->IsPrimaryVehicle()); /* Loop through source parts */ for (Vehicle *src = old_veh; src != NULL; src = src->Next()) { - if (!part_of_chain && src->type == VEH_TRAIN && src != old_veh && src != Train::From(old_veh)->other_multiheaded_part && !Train::From(src)->IsArticulatedPart()) { + if (!part_of_chain && src->type == VEH_TRAIN && src != old_veh && src != Train::From(old_veh)->other_multiheaded_part && !src->IsArticulatedPart()) { /* Skip vehicles, which do not belong to old_veh */ - src = Train::From(src)->GetLastEnginePart(); + src = src->GetLastEnginePart(); continue; } if (src->cargo_type >= NUM_CARGO || src->cargo.Count() == 0) continue; /* Find free space in the new chain */ for (Vehicle *dest = new_head; dest != NULL && src->cargo.Count() > 0; dest = dest->Next()) { - if (!part_of_chain && dest->type == VEH_TRAIN && dest != new_head && dest != Train::From(new_head)->other_multiheaded_part && !Train::From(dest)->IsArticulatedPart()) { + if (!part_of_chain && dest->type == VEH_TRAIN && dest != new_head && dest != Train::From(new_head)->other_multiheaded_part && !dest->IsArticulatedPart()) { /* Skip vehicles, which do not belong to new_head */ - dest = Train::From(dest)->GetLastEnginePart(); + dest = dest->GetLastEnginePart(); continue; } if (dest->cargo_type != src->cargo_type) continue; @@ -218,7 +218,7 @@ static CargoID GetNewCargoTypeForReplace(Vehicle *v, EngineID engine_type, bool */ static EngineID GetNewEngineType(const Vehicle *v, const Company *c) { - assert(v->type != VEH_TRAIN || !Train::From(v)->IsArticulatedPart()); + assert(v->type != VEH_TRAIN || !v->IsArticulatedPart()); if (v->type == VEH_TRAIN && Train::From(v)->IsRearDualheaded()) { /* we build the rear ends of multiheaded trains with the front ones */ |