1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-21 21:49:10 +00:00

(svn r16767) -Fix [NoAI] (r16524): AITile::GetCargoProduction/Acceptance didn't accept a radius of 0 anymore

This commit is contained in:
yexo
2009-07-08 17:42:58 +00:00
parent 9ae07bba85
commit 369d4ce179
2 changed files with 4 additions and 4 deletions

@@ -177,7 +177,7 @@
/* static */ int32 AITile::GetCargoAcceptance(TileIndex tile, CargoID cargo_type, int width, int height, int radius) /* static */ int32 AITile::GetCargoAcceptance(TileIndex tile, CargoID cargo_type, int width, int height, int radius)
{ {
if (!::IsValidTile(tile) || width <= 0 || height <= 0 || radius <= 0) return -1; if (!::IsValidTile(tile) || width <= 0 || height <= 0 || radius < 0) return -1;
CargoArray acceptance = ::GetAcceptanceAroundTiles(tile, width, height, _settings_game.station.modified_catchment ? radius : (int)CA_UNMODIFIED); CargoArray acceptance = ::GetAcceptanceAroundTiles(tile, width, height, _settings_game.station.modified_catchment ? radius : (int)CA_UNMODIFIED);
return acceptance[cargo_type]; return acceptance[cargo_type];
@@ -185,7 +185,7 @@
/* static */ int32 AITile::GetCargoProduction(TileIndex tile, CargoID cargo_type, int width, int height, int radius) /* static */ int32 AITile::GetCargoProduction(TileIndex tile, CargoID cargo_type, int width, int height, int radius)
{ {
if (!::IsValidTile(tile) || width <= 0 || height <= 0 || radius <= 0) return -1; if (!::IsValidTile(tile) || width <= 0 || height <= 0 || radius < 0) return -1;
CargoArray produced = ::GetProductionAroundTiles(tile, width, height, _settings_game.station.modified_catchment ? radius : (int)CA_UNMODIFIED); CargoArray produced = ::GetProductionAroundTiles(tile, width, height, _settings_game.station.modified_catchment ? radius : (int)CA_UNMODIFIED);
return produced[cargo_type]; return produced[cargo_type];

@@ -305,7 +305,7 @@ public:
* @pre AIMap::IsValidTile(tile). * @pre AIMap::IsValidTile(tile).
* @pre width > 0. * @pre width > 0.
* @pre height > 0. * @pre height > 0.
* @pre radius > 0. * @pre radius >= 0.
* @return Value below 8 means no acceptance; the more the better. * @return Value below 8 means no acceptance; the more the better.
*/ */
static int32 GetCargoAcceptance(TileIndex tile, CargoID cargo_type, int width, int height, int radius); static int32 GetCargoAcceptance(TileIndex tile, CargoID cargo_type, int width, int height, int radius);
@@ -322,7 +322,7 @@ public:
* @pre AIMap::IsValidTile(tile). * @pre AIMap::IsValidTile(tile).
* @pre width > 0. * @pre width > 0.
* @pre height > 0. * @pre height > 0.
* @pre radius > 0. * @pre radius >= 0.
* @return The tiles that produce this cargo within radius of the tile. * @return The tiles that produce this cargo within radius of the tile.
* @note Town(houses) are not included in the value. * @note Town(houses) are not included in the value.
*/ */