mirror of https://github.com/OpenTTD/OpenTTD
(svn r10026) -Fix: unlinking a rail vehicle didn't clear the first pointer
After r9973, this could cause some asserts as some vehicles could end up with first pointers to chains they didn't belong torelease/0.6
parent
532391db12
commit
e129438139
|
@ -839,6 +839,7 @@ static Vehicle *UnlinkWagon(Vehicle *v, Vehicle *first)
|
||||||
Vehicle *u;
|
Vehicle *u;
|
||||||
for (u = first; GetNextVehicle(u) != v; u = GetNextVehicle(u)) {}
|
for (u = first; GetNextVehicle(u) != v; u = GetNextVehicle(u)) {}
|
||||||
GetLastEnginePart(u)->next = GetNextVehicle(v);
|
GetLastEnginePart(u)->next = GetNextVehicle(v);
|
||||||
|
v->first = NULL; // we shouldn't point to the old first, since the vehicle isn't in that chain anymore
|
||||||
return first;
|
return first;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue