diff options
author | peter1138 <peter1138@openttd.org> | 2006-02-07 18:55:06 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2006-02-07 18:55:06 +0000 |
commit | f491fa733b07b6016ac634e35579fb67b6eaad07 (patch) | |
tree | 40a19f7eb5b2864e899f5993919e2e50325c370c | |
parent | db01f5b852166aa837b8145b47e78f54ed8395fa (diff) | |
download | openttd-f491fa733b07b6016ac634e35579fb67b6eaad07.tar.xz |
(svn r3570) - Explicitly update v->first in TrainConsistChanged() if necessary, as this is far faster than brute forcing it later.
-rw-r--r-- | train_cmd.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/train_cmd.c b/train_cmd.c index 045b7d478..309ddc128 100644 --- a/train_cmd.c +++ b/train_cmd.c @@ -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; |