(svn r8744) -Fix(r654/2105): Call GetFirstVehicleInChain only for trains, and assert the vehicle type in that function. Not a critical error, but it does increase game performance by up to 10% when playing a large game (many vehicles) with aircraft/road vehicle newgrfs loaded.

This commit is contained in:
celestar
2007-02-15 10:21:00 +00:00
parent e62036f5e9
commit d9f034bd87
2 changed files with 2 additions and 1 deletions

View File

@@ -1010,7 +1010,7 @@ static void DoTriggerVehicle(Vehicle *v, VehicleTrigger trigger, byte base_rando
* i.e.), so we give them all the NEW_CARGO triggered
* vehicle's portion of random bits. */
assert(first);
DoTriggerVehicle(GetFirstVehicleInChain(v), VEHICLE_TRIGGER_ANY_NEW_CARGO, new_random_bits, false);
DoTriggerVehicle((v->type == VEH_Train) ? GetFirstVehicleInChain(v) : v, VEHICLE_TRIGGER_ANY_NEW_CARGO, new_random_bits, false);
break;
case VEHICLE_TRIGGER_DEPOT: