mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-12 09:38:28 +00:00
(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:
parent
f6b917f609
commit
6abbf15a8e
@ -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:
|
||||
|
@ -515,6 +515,7 @@ Vehicle *GetFirstVehicleInChain(const Vehicle *v)
|
||||
Vehicle* u;
|
||||
|
||||
assert(v != NULL);
|
||||
assert(v->type == VEH_Train);
|
||||
|
||||
if (v->first != NULL) {
|
||||
if (IsFrontEngine(v->first) || IsFreeWagon(v->first)) return v->first;
|
||||
|
Loading…
Reference in New Issue
Block a user