From 37ec349dece0bbe06f366c0c39131ebe7b1a915d Mon Sep 17 00:00:00 2001 From: bjarni Date: Thu, 11 May 2006 12:42:24 +0000 Subject: (svn r4825) - Fix [clone FS#159]: Game crashes when cloning reaches train-limit. --- vehicle.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'vehicle.c') diff --git a/vehicle.c b/vehicle.c index a2a4e323a..9404a6db2 100644 --- a/vehicle.c +++ b/vehicle.c @@ -1490,6 +1490,7 @@ int32 CmdCloneVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) Vehicle *v_front, *v; Vehicle *w_front, *w, *w_rear; int cost, total_cost = 0; + uint32 build_argument = 1; if (!IsVehicleIndex(p1)) return CMD_ERROR; v = GetVehicle(p1); @@ -1532,7 +1533,7 @@ int32 CmdCloneVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) continue; } - cost = DoCommand(tile, v->engine_type, 1, flags, CMD_BUILD_VEH(v->type)); + cost = DoCommand(tile, v->engine_type, build_argument, flags, CMD_BUILD_VEH(v->type)); if (CmdFailed(cost)) return cost; @@ -1555,6 +1556,7 @@ int32 CmdCloneVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) DoCommand(0, (w_rear->index << 16) | w->index, 1, flags, CMD_MOVE_RAIL_VEHICLE); } else { // this is a front engine or not a train. It need orders + build_argument = 3; // set bit 1, so it will not assign numbers to engines in the rest of the train w_front = w; w->service_interval = v->service_interval; DoCommand(0, (v->index << 16) | w->index, p2 & 1 ? CO_SHARE : CO_COPY, flags, CMD_CLONE_ORDER); -- cgit v1.2.3-54-g00ecf