summaryrefslogtreecommitdiff
path: root/depot.h
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-04-22 05:41:09 +0000
committertron <tron@openttd.org>2005-04-22 05:41:09 +0000
commit6ceeedfd3c32228a54cce9c65ca7994d14e6c909 (patch)
treee61fcdfaeec4a6e98da15bb107eb3513d0fa1fa8 /depot.h
parent591217da4ab80c43c48aed93689296597dbfe138 (diff)
downloadopenttd-6ceeedfd3c32228a54cce9c65ca7994d14e6c909.tar.xz
(svn r2222) Check the parameters of Cmd{Insert,Delete,Modify,Skip}Order() and CmdRestoreOrderIndex():
- Check if the vehicle exists - Check if the vehicle belongs to the correct player - Check if the new order is valid (type, destination, flags) (CmdInsertOrder)
Diffstat (limited to 'depot.h')
-rw-r--r--depot.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/depot.h b/depot.h
index 7f0d6acac..ddd88bf74 100644
--- a/depot.h
+++ b/depot.h
@@ -28,6 +28,11 @@ static inline uint16 GetDepotPoolSize(void)
return _depot_pool.total_items;
}
+static inline bool IsDepotIndex(uint index)
+{
+ return index < GetDepotPoolSize();
+}
+
#define FOR_ALL_DEPOTS_FROM(d, start) for (d = GetDepot(start); d != NULL; d = (d->index + 1 < GetDepotPoolSize()) ? GetDepot(d->index + 1) : NULL)
#define FOR_ALL_DEPOTS(d) FOR_ALL_DEPOTS_FROM(d, 0)
@@ -44,7 +49,7 @@ VARDEF TileIndex _last_built_ship_depot_tile;
/**
* Check if a depot really exists.
*/
-static inline bool IsValidDepot(Depot* depot)
+static inline bool IsValidDepot(const Depot* depot)
{
return depot->xy != 0; /* XXX: Replace by INVALID_TILE someday */
}