changeset 1925:6a436347b3a4 draft

(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)
author hackykid <hackykid@openttd.org>
date Tue, 07 Jun 2005 16:44:54 +0000
parents 40428fb47bc9
children ae98b5ce63ee
files train_cmd.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -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;
 
 	};