From 6ceeedfd3c32228a54cce9c65ca7994d14e6c909 Mon Sep 17 00:00:00 2001 From: tron Date: Fri, 22 Apr 2005 05:41:09 +0000 Subject: (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) --- station.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'station.h') diff --git a/station.h b/station.h index 2ac2e5403..d771ac2f4 100644 --- a/station.h +++ b/station.h @@ -146,6 +146,11 @@ static inline uint16 GetStationPoolSize(void) return _station_pool.total_items; } +static inline bool IsStationIndex(uint index) +{ + return index < GetStationPoolSize(); +} + #define FOR_ALL_STATIONS_FROM(st, start) for (st = GetStation(start); st != NULL; st = (st->index + 1 < GetStationPoolSize()) ? GetStation(st->index + 1) : NULL) #define FOR_ALL_STATIONS(st) FOR_ALL_STATIONS_FROM(st, 0) @@ -292,7 +297,7 @@ static inline bool IsRoadStationTile(uint tile) { /** * Check if a station really exists. */ -static inline bool IsValidStation(Station* station) +static inline bool IsValidStation(const Station* station) { return station->xy != 0; /* XXX: Replace by INVALID_TILE someday */ } -- cgit v1.2.3-54-g00ecf