summaryrefslogtreecommitdiff
path: root/src/newgrf_engine.cpp
diff options
context:
space:
mode:
authorcelestar <celestar@openttd.org>2007-02-15 10:21:00 +0000
committercelestar <celestar@openttd.org>2007-02-15 10:21:00 +0000
commit6abbf15a8ef1f380ad820d40d69fb7c8f52e0f58 (patch)
tree423906991b04b130fcc9ac5160de6504dc5e5e2c /src/newgrf_engine.cpp
parentf6b917f609d63230531d2086761242884c4f60e5 (diff)
downloadopenttd-6abbf15a8ef1f380ad820d40d69fb7c8f52e0f58.tar.xz
(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.
Diffstat (limited to 'src/newgrf_engine.cpp')
-rw-r--r--src/newgrf_engine.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp
index d052d16bb..3bf9a93a4 100644
--- a/src/newgrf_engine.cpp
+++ b/src/newgrf_engine.cpp
@@ -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: