File diff r9487:ae7979d51839 → r9488:2873382f8f4a
src/roadveh_cmd.cpp
Show inline comments
 
@@ -191,13 +191,13 @@ CommandCost CmdBuildRoadVeh(TileIndex ti
 

	
 
	if (HasTileRoadType(tile, ROADTYPE_TRAM) != HasBit(EngInfo(p1)->misc_flags, EF_ROAD_TRAM)) return_cmd_error(STR_DEPOT_WRONG_DEPOT_TYPE);
 

	
 
	uint num_vehicles = 1 + CountArticulatedParts(p1, false);
 

	
 
	/* Allow for the front and the articulated parts, plus one to "terminate" the list. */
 
	Vehicle **vl = (Vehicle**)alloca(sizeof(*vl) * (num_vehicles + 1));
 
	Vehicle **vl = AllocaM(Vehicle*, num_vehicles + 1);
 
	memset(vl, 0, sizeof(*vl) * (num_vehicles + 1));
 

	
 
	if (!Vehicle::AllocateList(vl, num_vehicles)) {
 
		return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
 
	}