Changeset - r2993:391a358f5941
[Not reviewed]
master
0 1 0
peter1138 - 19 years ago 2006-02-07 18:55:06
peter1138@openttd.org
(svn r3570) - Explicitly update v->first in TrainConsistChanged() if necessary, as this is far faster than brute forcing it later.
1 file changed with 3 insertions and 0 deletions:
0 comments (0 inline, 0 general)
train_cmd.c
Show inline comments
 
@@ -90,12 +90,15 @@ void TrainConsistChanged(Vehicle* v)
 
	v->u.rail.cached_total_length = 0;
 

	
 
	for (u = v; u != NULL; u = u->next) {
 
		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;
 

	
 
		if (rvi_u->visual_effect != 0) {
 
			u->u.rail.cached_vis_effect = rvi_u->visual_effect;
 
		} else {
0 comments (0 inline, 0 general)