diff options
author | rubidium <rubidium@openttd.org> | 2009-06-06 11:47:21 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-06-06 11:47:21 +0000 |
commit | ec3ef70adb40d9ff371082a7360652d58e425284 (patch) | |
tree | 232721f0f75e9a1b9075d8d3721d7e775b0307fc /src/ai/api/ai_tile.hpp | |
parent | 0b8ceb3007c018954203519b3768c45b3fa21920 (diff) | |
download | openttd-ec3ef70adb40d9ff371082a7360652d58e425284.tar.xz |
(svn r16524) -Fix [FS#2963]: missing guards in the NoAI API making it possible to hit an assert in OpenTTD.
Diffstat (limited to 'src/ai/api/ai_tile.hpp')
-rw-r--r-- | src/ai/api/ai_tile.hpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/ai/api/ai_tile.hpp b/src/ai/api/ai_tile.hpp index 1083c8aa1..965a829f6 100644 --- a/src/ai/api/ai_tile.hpp +++ b/src/ai/api/ai_tile.hpp @@ -303,9 +303,12 @@ public: * @param height The height of the station. * @param radius The radius of the station. * @pre AIMap::IsValidTile(tile). + * @pre width > 0. + * @pre height > 0. + * @pre radius > 0. * @return Value below 8 means no acceptance; the more the better. */ - static int32 GetCargoAcceptance(TileIndex tile, CargoID cargo_type, uint width, uint height, uint radius); + static int32 GetCargoAcceptance(TileIndex tile, CargoID cargo_type, int width, int height, int radius); /** * Checks how many tiles in the radius produces this cargo. @@ -317,10 +320,13 @@ public: * @param height The height of the station. * @param radius The radius of the station. * @pre AIMap::IsValidTile(tile). + * @pre width > 0. + * @pre height > 0. + * @pre radius > 0. * @return The tiles that produce this cargo within radius of the tile. * @note Town(houses) are not included in the value. */ - static int32 GetCargoProduction(TileIndex tile, CargoID cargo_type, uint width, uint height, uint radius); + static int32 GetCargoProduction(TileIndex tile, CargoID cargo_type, int width, int height, int radius); /** * Get the manhattan distance from the tile to the tile. |