(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)
authorhackykid
Tue, 07 Jun 2005 16:44:54 +0000
changeset 1925 e4bbd7fc2353
parent 1924 949120daca87
child 1926 68d60188a22f
(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)
train_cmd.c
--- a/train_cmd.c	Tue Jun 07 16:11:19 2005 +0000
+++ b/train_cmd.c	Tue Jun 07 16:44:54 2005 +0000
@@ -119,7 +119,7 @@
 			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;
 
 	};