forked from mirror/OpenTTD
(svn r18468) -Codechange: make sure one never makes self-loops using Vehicle::SetNext
This commit is contained in:
@@ -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()) {
|
||||||
|
Reference in New Issue
Block a user