diff options
author | frosch <frosch@openttd.org> | 2009-06-27 21:06:58 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2009-06-27 21:06:58 +0000 |
commit | a288e4d82ff85819aa49061d66ee7e0cfd87e802 (patch) | |
tree | dcb119ed56cd690290a226e44feaf430ff4f14de /src/ai | |
parent | 9b070b5405d11c74d89a747e912e627e39850f7c (diff) | |
download | openttd-a288e4d82ff85819aa49061d66ee7e0cfd87e802.tar.xz |
(svn r16678) -Codechange: Turn CargoArray into a class, so one does not have to deal with sizeof() wrt. typedef-ed arrays.
Diffstat (limited to 'src/ai')
-rw-r--r-- | src/ai/api/ai_tile.cpp | 6 | ||||
-rw-r--r-- | src/ai/api/ai_tilelist.cpp | 6 |
2 files changed, 4 insertions, 8 deletions
diff --git a/src/ai/api/ai_tile.cpp b/src/ai/api/ai_tile.cpp index c7f67f603..ea13fe456 100644 --- a/src/ai/api/ai_tile.cpp +++ b/src/ai/api/ai_tile.cpp @@ -179,8 +179,7 @@ { if (!::IsValidTile(tile) || width <= 0 || height <= 0 || radius <= 0) return -1; - CargoArray acceptance; - ::GetAcceptanceAroundTiles(acceptance, 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]; } @@ -188,8 +187,7 @@ { if (!::IsValidTile(tile) || width <= 0 || height <= 0 || radius <= 0) return -1; - CargoArray produced; - ::GetProductionAroundTiles(produced, 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]; } diff --git a/src/ai/api/ai_tilelist.cpp b/src/ai/api/ai_tilelist.cpp index 38b99ef9a..587460a75 100644 --- a/src/ai/api/ai_tilelist.cpp +++ b/src/ai/api/ai_tilelist.cpp @@ -92,8 +92,7 @@ AITileList_IndustryAccepting::AITileList_IndustryAccepting(IndustryID industry_i /* Only add the tile if it accepts the cargo (sometimes just 1 tile of an * industry triggers the acceptance). */ - CargoArray acceptance; - ::GetAcceptanceAroundTiles(acceptance, cur_tile, 1, 1, radius); + CargoArray acceptance = ::GetAcceptanceAroundTiles(cur_tile, 1, 1, radius); { bool cargo_accepts = false; for (byte j = 0; j < lengthof(i->accepts_cargo); j++) { @@ -130,8 +129,7 @@ AITileList_IndustryProducing::AITileList_IndustryProducing(IndustryID industry_i /* Only add the tile if it produces the cargo (a bug in OpenTTD makes this * inconsitance). */ - CargoArray produced; - ::GetProductionAroundTiles(produced, cur_tile, 1, 1, radius); + CargoArray produced = ::GetProductionAroundTiles(cur_tile, 1, 1, radius); { bool cargo_produces = false; for (byte j = 0; j < lengthof(i->produced_cargo); j++) { |