comparison 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
parents b8e1d03b1e83
children bb5f187ff5a7
comparison
equal deleted inserted replaced
7592:eb177cee0aa4 7593:200598005e58
179 179
180 if (HASBIT(GetRoadTypes(tile), ROADTYPE_TRAM) != HASBIT(EngInfo(p1)->misc_flags, EF_ROAD_TRAM)) return_cmd_error(STR_DEPOT_WRONG_DEPOT_TYPE); 180 if (HASBIT(GetRoadTypes(tile), ROADTYPE_TRAM) != HASBIT(EngInfo(p1)->misc_flags, EF_ROAD_TRAM)) return_cmd_error(STR_DEPOT_WRONG_DEPOT_TYPE);
181 181
182 uint num_vehicles = 1 + CountArticulatedParts(p1); 182 uint num_vehicles = 1 + CountArticulatedParts(p1);
183 183
184 /* Allow for the front and up to 10 articulated parts. */ 184 /* Allow for the front and the articulated parts. */
185 Vehicle *vl[11]; 185 Vehicle **vl = (Vehicle**)alloca(sizeof(*vl) * num_vehicles);
186 memset(&vl, 0, sizeof(vl)); 186 memset(vl, 0, sizeof(*vl) * num_vehicles);
187 187
188 if (!Vehicle::AllocateList(vl, num_vehicles)) { 188 if (!Vehicle::AllocateList(vl, num_vehicles)) {
189 return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME); 189 return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
190 } 190 }
191 191