From ae92fd2865b25fbce4bfa6c3a5e00b4b7dd48930 Mon Sep 17 00:00:00 2001 From: rubidium Date: Sat, 12 Dec 2009 21:04:08 +0000 Subject: (svn r18468) -Codechange: make sure one never makes self-loops using Vehicle::SetNext --- src/vehicle.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 1a94c9f82..08b2aa749 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -1616,6 +1616,8 @@ CommandCost Vehicle::SendToDepot(DoCommandFlag flags, DepotCommand command) void Vehicle::SetNext(Vehicle *next) { + assert(this != next); + if (this->next != NULL) { /* We had an old next vehicle. Update the first and previous pointers */ for (Vehicle *v = this->next; v != NULL; v = v->Next()) { -- cgit v1.2.3-70-g09d2