Mercurial > hg > openttd
changeset 13931:65f5cb4ea3d1 draft
(svn r18463) -Codechange: some simplifications for finding the end of a vehicle
author | rubidium <rubidium@openttd.org> |
---|---|
date | Fri, 11 Dec 2009 19:28:28 +0000 |
parents | decc3774c2c4 |
children | a503c6f8fa5e |
files | src/train_cmd.cpp |
diffstat | 1 files changed, 3 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -1402,9 +1402,7 @@ 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 @@ { 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); }