From c326ff37956552f883e6d6f4dc6e2fb9f61e40d0 Mon Sep 17 00:00:00 2001 From: tron Date: Sat, 3 Feb 2007 09:05:43 +0000 Subject: [PATCH] (svn r8550) -Fix Building a vehicle does not involve allocating orders, so do not check whether orders could be allocated --- src/aircraft_cmd.cpp | 3 +-- src/order.h | 4 ---- src/order_cmd.cpp | 2 +- src/roadveh_cmd.cpp | 3 +-- src/ship_cmd.cpp | 2 +- src/train_cmd.cpp | 2 +- 6 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp index ea5e255b88..7ab5a6185d 100644 --- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -230,8 +230,7 @@ int32 CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) /* Allocate 2 or 3 vehicle structs, depending on type * vl[0] = aircraft, vl[1] = shadow, [vl[2] = rotor] */ - if (!AllocateVehicles(vl, avi->subtype & AIR_CTOL ? 2 : 3) || - IsOrderPoolFull()) { + if (!AllocateVehicles(vl, avi->subtype & AIR_CTOL ? 2 : 3)) { return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME); } diff --git a/src/order.h b/src/order.h index ddc97481d8..7d14d6c15a 100644 --- a/src/order.h +++ b/src/order.h @@ -167,10 +167,6 @@ static inline bool HasOrderPoolFree(uint amount) return false; } -static inline bool IsOrderPoolFull(void) -{ - return !HasOrderPoolFree(1); -} /* Pack and unpack routines */ diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp index 8b6fb7e50b..7ee0a0901f 100644 --- a/src/order_cmd.cpp +++ b/src/order_cmd.cpp @@ -337,7 +337,7 @@ int32 CmdInsertOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) if (sel_ord > v->num_orders) return CMD_ERROR; - if (IsOrderPoolFull()) return_cmd_error(STR_8831_NO_MORE_SPACE_FOR_ORDERS); + if (!HasOrderPoolFree(1)) return_cmd_error(STR_8831_NO_MORE_SPACE_FOR_ORDERS); /* XXX - This limit is only here because the backuppedorders can't * handle any more then this.. */ diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp index 6be3e106da..b07a81887e 100644 --- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -128,8 +128,7 @@ int32 CmdBuildRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) if (!IsTileOwner(tile, _current_player)) return CMD_ERROR; v = AllocateVehicle(); - if (v == NULL || IsOrderPoolFull()) - return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME); + if (v == NULL) return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME); /* find the first free roadveh id */ unit_num = HASBIT(p2, 0) ? 0 : GetFreeUnitNumber(VEH_Road); diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp index 30ecac1a20..03c2efbb40 100644 --- a/src/ship_cmd.cpp +++ b/src/ship_cmd.cpp @@ -835,7 +835,7 @@ int32 CmdBuildShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) v = AllocateVehicle(); unit_num = HASBIT(p2, 0) ? 0 : GetFreeUnitNumber(VEH_Ship); - if (v == NULL || IsOrderPoolFull() || unit_num > _patches.max_ships) + if (v == NULL || unit_num > _patches.max_ships) return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME); if (flags & DC_EXEC) { diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 1b6c5c80e0..3eccd58ec9 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -776,7 +776,7 @@ int32 CmdBuildRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) memset(&vl, 0, sizeof(vl)); - if (!AllocateVehicles(vl, num_vehicles) || IsOrderPoolFull()) + if (!AllocateVehicles(vl, num_vehicles)) return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME); v = vl[0];