(svn r3576) - Allow unused wagons have their ->first set. This fixes the faulty cache warning message, and noticably speeds up depot operations in large games.
authorpeter1138
Wed, 08 Feb 2006 08:18:29 +0000
changeset 2998 811ec359a2e3
parent 2997 5f38d62ed7aa
child 2999 f5351c475765
(svn r3576) - Allow unused wagons have their ->first set. This fixes the faulty cache warning message, and noticably speeds up depot operations in large games.
vehicle.c
--- a/vehicle.c	Tue Feb 07 19:34:22 2006 +0000
+++ b/vehicle.c	Wed Feb 08 08:18:29 2006 +0000
@@ -504,7 +504,7 @@
 	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!");
 	}
@@ -518,7 +518,7 @@
 	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;