summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2007-02-03 09:05:43 +0000
committertron <tron@openttd.org>2007-02-03 09:05:43 +0000
commitc326ff37956552f883e6d6f4dc6e2fb9f61e40d0 (patch)
tree26d91439e6a9b8f23752f33cabd1ef990dec8c60
parent981833751ae853f27e492dc0197f1239d7ed580c (diff)
downloadopenttd-c326ff37956552f883e6d6f4dc6e2fb9f61e40d0.tar.xz
(svn r8550) -Fix
Building a vehicle does not involve allocating orders, so do not check whether orders could be allocated
-rw-r--r--src/aircraft_cmd.cpp3
-rw-r--r--src/order.h4
-rw-r--r--src/order_cmd.cpp2
-rw-r--r--src/roadveh_cmd.cpp3
-rw-r--r--src/ship_cmd.cpp2
-rw-r--r--src/train_cmd.cpp2
6 files changed, 5 insertions, 11 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index ea5e255b8..7ab5a6185 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 ddc97481d..7d14d6c15 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 8b6fb7e50..7ee0a0901 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 6be3e106d..b07a81887 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 30ecac1a2..03c2efbb4 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 1b6c5c80e..3eccd58ec 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];