diff options
author | rubidium <rubidium@openttd.org> | 2009-12-11 19:28:28 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-12-11 19:28:28 +0000 |
commit | 53d6d4a094ef7ff2d7b3fa471b6f5b0312a781e6 (patch) | |
tree | 6a31d30529b906843f55e14422c1f3658c95abef /src | |
parent | b8a7efc4506c3b820b0e74c943f49e06480073d7 (diff) | |
download | openttd-53d6d4a094ef7ff2d7b3fa471b6f5b0312a781e6.tar.xz |
(svn r18463) -Codechange: some simplifications for finding the end of a vehicle
Diffstat (limited to 'src')
-rw-r--r-- | src/train_cmd.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 2ca604e5b..5ca176547 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -1402,9 +1402,7 @@ CommandCost CmdMoveRailVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, u if (move_chain) { /* unlink ALL wagons */ if (src != src_head) { - Train *v = src_head; - while (v->GetNextVehicle() != src) v = v->GetNextVehicle(); - v->GetLastEnginePart()->SetNext(NULL); + src->Previous()->SetNext(NULL); } else { InvalidateWindowData(WC_VEHICLE_DEPOT, src_head->tile); // We removed a line src_head = NULL; @@ -1463,8 +1461,8 @@ CommandCost CmdMoveRailVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, u { Train *v; - for (v = src; v->GetNextVehicle() != NULL; v = v->GetNextVehicle()) {} - v->GetLastEnginePart()->SetNext(dst->Next()); + for (v = src; v->Next() != NULL; v = v->Next()) {} + v->SetNext(dst->Next()); } dst->SetNext(src); } |