(svn r18468) -Codechange: make sure one never makes self-loops using Vehicle::SetNext

This commit is contained in:
rubidium 2009-12-12 21:04:08 +00:00
parent 15fbf4af70
commit ae92fd2865
1 changed files with 2 additions and 0 deletions

View File

@ -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()) {