mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-30 01:49:10 +00:00
(svn r3570) - Explicitly update v->first in TrainConsistChanged() if necessary, as this is far faster than brute forcing it later.
This commit is contained in:
@@ -93,6 +93,9 @@ void TrainConsistChanged(Vehicle* v)
|
|||||||
const RailVehicleInfo *rvi_u = RailVehInfo(u->engine_type);
|
const RailVehicleInfo *rvi_u = RailVehInfo(u->engine_type);
|
||||||
uint16 veh_len;
|
uint16 veh_len;
|
||||||
|
|
||||||
|
// Update the v->first cache. This is faster than having to brute force it later.
|
||||||
|
if (u->first == NULL) u->first = v;
|
||||||
|
|
||||||
// update the 'first engine'
|
// update the 'first engine'
|
||||||
u->u.rail.first_engine = (v == u) ? INVALID_VEHICLE : first_engine;
|
u->u.rail.first_engine = (v == u) ? INVALID_VEHICLE : first_engine;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user