summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-12-12 21:04:08 +0000
committerrubidium <rubidium@openttd.org>2009-12-12 21:04:08 +0000
commitae92fd2865b25fbce4bfa6c3a5e00b4b7dd48930 (patch)
tree906941d9834f4b238c7b28d00c71b8243a7faadf
parent15fbf4af705d1d22035a112284f459553104408b (diff)
downloadopenttd-ae92fd2865b25fbce4bfa6c3a5e00b4b7dd48930.tar.xz
(svn r18468) -Codechange: make sure one never makes self-loops using Vehicle::SetNext
-rw-r--r--src/vehicle.cpp2
1 files changed, 2 insertions, 0 deletions
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()) {