changeset 13936:d316a293322c draft

(svn r18468) -Codechange: make sure one never makes self-loops using Vehicle::SetNext
author rubidium <rubidium@openttd.org>
date Sat, 12 Dec 2009 21:04:08 +0000
parents 28a3a7a5c7f9
children 876df839c647
files src/vehicle.cpp
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -1616,6 +1616,8 @@
 
 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()) {