summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2007-03-16 21:42:11 +0000
committerpeter1138 <peter1138@openttd.org>2007-03-16 21:42:11 +0000
commit92486ac980175b06fc22f2456d78737ead6eabfa (patch)
treefddced66609663a69bcb3b1acd8f7957b1089ca0
parent1014c82180c9a94d33a8adb014a4ae9ec905a043 (diff)
downloadopenttd-92486ac980175b06fc22f2456d78737ead6eabfa.tar.xz
(svn r9259) -Codechange: NUM_CARGO isn't a valid cargo type...
-rw-r--r--src/aircraft_cmd.cpp2
-rw-r--r--src/roadveh_cmd.cpp2
-rw-r--r--src/ship_cmd.cpp2
-rw-r--r--src/train_cmd.cpp2
4 files changed, 4 insertions, 4 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index e4d5b44ab..a022ba47b 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -606,7 +606,7 @@ int32 CmdRefitAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
/* Check cargo */
CargoID new_cid = GB(p2, 0, 8);
- if (new_cid > NUM_CARGO || !CanRefitTo(v->engine_type, new_cid)) return CMD_ERROR;
+ if (new_cid >= NUM_CARGO || !CanRefitTo(v->engine_type, new_cid)) return CMD_ERROR;
SET_EXPENSES_TYPE(EXPENSES_AIRCRAFT_RUN);
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index af50dc9b9..e8afbece1 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -1857,7 +1857,7 @@ int32 CmdRefitRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (v->type != VEH_ROAD || !CheckOwnership(v->owner)) return CMD_ERROR;
if (!IsRoadVehInDepotStopped(v)) return_cmd_error(STR_9013_MUST_BE_STOPPED_INSIDE);
- if (new_cid > NUM_CARGO || !CanRefitTo(v->engine_type, new_cid)) return CMD_ERROR;
+ if (new_cid >= NUM_CARGO || !CanRefitTo(v->engine_type, new_cid)) return CMD_ERROR;
SET_EXPENSES_TYPE(EXPENSES_ROADVEH_RUN);
diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp
index 6aa488138..5ee9582fa 100644
--- a/src/ship_cmd.cpp
+++ b/src/ship_cmd.cpp
@@ -1098,7 +1098,7 @@ int32 CmdRefitShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
/* Check cargo */
if (!ShipVehInfo(v->engine_type)->refittable) return CMD_ERROR;
- if (new_cid > NUM_CARGO || !CanRefitTo(v->engine_type, new_cid)) return CMD_ERROR;
+ if (new_cid >= NUM_CARGO || !CanRefitTo(v->engine_type, new_cid)) return CMD_ERROR;
SET_EXPENSES_TYPE(EXPENSES_SHIP_RUN);
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index baef70d2c..7f47d7f7c 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -1744,7 +1744,7 @@ int32 CmdRefitRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (CheckTrainStoppedInDepot(v) < 0) return_cmd_error(STR_TRAIN_MUST_BE_STOPPED);
/* Check cargo */
- if (new_cid > NUM_CARGO) return CMD_ERROR;
+ if (new_cid >= NUM_CARGO) return CMD_ERROR;
SET_EXPENSES_TYPE(EXPENSES_TRAIN_RUN);