(svn r3570) - Explicitly update v->first in TrainConsistChanged() if necessary, as this is far faster than brute forcing it later.

replace/41b28d7194a279bdc17475d4fbe2ea6ec885a466
peter1138 19 years ago
parent 6c0aa3a110
commit fbd78c8185

@ -93,6 +93,9 @@ void TrainConsistChanged(Vehicle* v)
const RailVehicleInfo *rvi_u = RailVehInfo(u->engine_type);
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'
u->u.rail.first_engine = (v == u) ? INVALID_VEHICLE : first_engine;

Loading…
Cancel
Save