Changeset - r1925:db76bbf7e2c7
[Not reviewed]
master
0 1 0
hackykid - 19 years ago 2005-06-07 16:44:54
hackykid@openttd.org
(svn r2431) - Fix: [newgrf] clamp() instead of assert() on the result of the vehicle length calculation, as it can depend on external input. (thanks tron)
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
train_cmd.c
Show inline comments
 
@@ -116,13 +116,13 @@ void TrainConsistChanged(Vehicle *v) {
 
		// check the vehicle length (callback)
 
		veh_len = CALLBACK_FAILED;
 
		if (HASBIT(rvi_u->callbackmask, CBM_VEH_LENGTH))
 
			veh_len = GetCallBackResult(CBID_VEH_LENGTH,  u->engine_type, u);
 
		if (veh_len == CALLBACK_FAILED)
 
			veh_len = rvi_u->shorten_factor;
 
		assert(veh_len < 8);
 
		veh_len = clamp(veh_len, 0, 7);
 
		u->u.rail.cached_veh_length = 8 - veh_len;
 

	
 
	};
 

	
 
	// store consist weight/max speed in cache
 
	v->u.rail.cached_max_speed = max_speed;
0 comments (0 inline, 0 general)