src/roadveh_cmd.cpp
changeset 7593 9b4265a05063
parent 7551 7e76a6be5873
child 7595 9d645518f001
--- a/src/roadveh_cmd.cpp	Sun Sep 16 18:10:52 2007 +0000
+++ b/src/roadveh_cmd.cpp	Sun Sep 16 20:48:00 2007 +0000
@@ -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);