mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-29 17:39:09 +00:00
(svn r5599) GetPrevVehicleInChain() may never fail to find a valid vehicle. Reflect this in the code
This commit is contained in:
@@ -486,11 +486,9 @@ Vehicle *GetPrevVehicleInChain(const Vehicle *v)
|
|||||||
// Check to see if this is the first
|
// Check to see if this is the first
|
||||||
if (v == u) return NULL;
|
if (v == u) return NULL;
|
||||||
|
|
||||||
do {
|
for (; u->next != v; u = u->next) assert(u->next != NULL);
|
||||||
if (u->next == v) return u;
|
|
||||||
} while ( ( u = u->next) != NULL);
|
|
||||||
|
|
||||||
return NULL;
|
return u;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Finds the first vehicle in a chain.
|
/** Finds the first vehicle in a chain.
|
||||||
|
Reference in New Issue
Block a user