diff src/roadveh_cmd.cpp @ 7593:200598005e58 draft

(svn r11120) -Codechange: remove the arbitrary limit of 10 articulated parts for a vehicle.
author rubidium <rubidium@openttd.org>
date Sun, 16 Sep 2007 20:48:00 +0000 (2007-09-16)
parents b8e1d03b1e83
children bb5f187ff5a7
line wrap: on
line diff
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -181,9 +181,9 @@
 
 	uint num_vehicles = 1 + CountArticulatedParts(p1);
 
-	/* Allow for the front and up to 10 articulated parts. */
-	Vehicle *vl[11];
-	memset(&vl, 0, sizeof(vl));
+	/* Allow for the front and the articulated parts. */
+	Vehicle **vl = (Vehicle**)alloca(sizeof(*vl) * num_vehicles);
+	memset(vl, 0, sizeof(*vl) * num_vehicles);
 
 	if (!Vehicle::AllocateList(vl, num_vehicles)) {
 		return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);