mirror of https://github.com/OpenTTD/OpenTTD
(svn r18468) -Codechange: make sure one never makes self-loops using Vehicle::SetNext
parent
15fbf4af70
commit
ae92fd2865
|
@ -1616,6 +1616,8 @@ CommandCost Vehicle::SendToDepot(DoCommandFlag flags, DepotCommand command)
|
||||||
|
|
||||||
void Vehicle::SetNext(Vehicle *next)
|
void Vehicle::SetNext(Vehicle *next)
|
||||||
{
|
{
|
||||||
|
assert(this != next);
|
||||||
|
|
||||||
if (this->next != NULL) {
|
if (this->next != NULL) {
|
||||||
/* We had an old next vehicle. Update the first and previous pointers */
|
/* We had an old next vehicle. Update the first and previous pointers */
|
||||||
for (Vehicle *v = this->next; v != NULL; v = v->Next()) {
|
for (Vehicle *v = this->next; v != NULL; v = v->Next()) {
|
||||||
|
|
Loading…
Reference in New Issue