summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhackykid <hackykid@openttd.org>2005-06-07 16:44:54 +0000
committerhackykid <hackykid@openttd.org>2005-06-07 16:44:54 +0000
commitd0cdb45b6c634b4b7238f9b8b8cd9344cb7b1ac3 (patch)
tree83a3c13b0a45dc3d5035ac69a194f31df4ee17c6
parent8a0f4f32eae300a10e5f8b3a78981166f8ab11b2 (diff)
downloadopenttd-d0cdb45b6c634b4b7238f9b8b8cd9344cb7b1ac3.tar.xz
(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)
-rw-r--r--train_cmd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/train_cmd.c b/train_cmd.c
index 74dd5bf39..b12b49de6 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -119,7 +119,7 @@ void TrainConsistChanged(Vehicle *v) {
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;
};