mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-01 20:03:26 +00:00
(svn r18468) -Codechange: make sure one never makes self-loops using Vehicle::SetNext
This commit is contained in:
parent
15fbf4af70
commit
ae92fd2865
@ -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()) {
|
||||
|
Loading…
Reference in New Issue
Block a user