1
0
Fork 0

(svn r4094) - Allow unused wagons have their ->first set. This fixes the faulty

cache warning message, and noticably speeds up depot operations in large 
games. Backport of r3576 from trunk
release/0.4
peter1138 2006-03-24 22:36:54 +00:00
parent 45a4c69842
commit e72232dc4c
1 changed files with 2 additions and 2 deletions

View File

@ -505,7 +505,7 @@ Vehicle *GetFirstVehicleInChain(const Vehicle *v)
assert(v != NULL);
if (v->first != NULL) {
if (IsFrontEngine(v->first)) return v->first;
if (IsFrontEngine(v->first) || IsFreeWagon(v->first)) return v->first;
DEBUG(misc, 0) ("v->first cache faulty. We shouldn't be here, rebuilding cache!");
}
@ -519,7 +519,7 @@ Vehicle *GetFirstVehicleInChain(const Vehicle *v)
while ((u = GetPrevVehicleInChain_bruteforce(v)) != NULL) v = u;
/* Set the first pointer of all vehicles in that chain to the first wagon */
if (IsFrontEngine(v))
if (IsFrontEngine(v) || IsFreeWagon(v))
for (u = (Vehicle *)v; u != NULL; u = u->next) u->first = (Vehicle *)v;
return (Vehicle*)v;