summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2005-11-06 12:39:30 +0000
committerpeter1138 <peter1138@openttd.org>2005-11-06 12:39:30 +0000
commitb88564b6be0f95d5c8e5cea4ef0134eacdda0c5f (patch)
tree9558d6140ab6207937c8d700e772ae41c36dbd25
parent3610c0474b5e9c56ea1925748afa034296f8e966 (diff)
downloadopenttd-b88564b6be0f95d5c8e5cea4ef0134eacdda0c5f.tar.xz
(svn r3146) Avoid use of variable size declared arrays when allocating articulated rail vehicles.
-rw-r--r--train_cmd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/train_cmd.c b/train_cmd.c
index bf4141ca2..04dee12b2 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -515,7 +515,7 @@ static int32 CmdBuildRailWagon(EngineID engine, TileIndex tile, uint32 flags)
num_vehicles = 1 + CountArticulatedParts(rvi, engine);
if (!(flags & DC_QUERY_COST)) {
- Vehicle *vl[num_vehicles];
+ Vehicle *vl[11]; // Allow for wagon and upto 10 artic parts.
if (!AllocateVehicles(vl, num_vehicles))
return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
@@ -701,7 +701,7 @@ int32 CmdBuildRailVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2)
num_vehicles += CountArticulatedParts(rvi, p1);
if (!(flags & DC_QUERY_COST)) {
- Vehicle *vl[num_vehicles];
+ Vehicle *vl[12]; // Allow for upto 10 artic parts and dual-heads
if (!AllocateVehicles(vl, num_vehicles) || IsOrderPoolFull())
return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);