~ubuntu-branches/debian/squeeze/openttd/squeeze

« back to all changes in this revision

Viewing changes to src/ai/api/ai_tile.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Matthijs Kooijman, Matthijs Kooijman
  • Date: 2009-10-01 22:52:59 UTC
  • mfrom: (1.1.8 upstream) (2.1.6 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091001225259-5kpkp4sthbszpyif
[ Matthijs Kooijman ]
* New upstream release
* Use printf instead of echo -en in openttd-wrapper to make it POSIX
  compatible (Closes: #547758).
* Remove three patches that are now included in upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: ai_tile.cpp 16531 2009-06-07 15:26:33Z rubidium $ */
 
1
/* $Id: ai_tile.cpp 17417 2009-09-04 20:40:15Z rubidium $ */
2
2
 
3
3
/** @file ai_tile.cpp Implementation of AITile. */
4
4
 
87
87
 
88
88
/* static */ bool AITile::HasTreeOnTile(TileIndex tile)
89
89
{
 
90
        if (!::IsValidTile(tile)) return false;
 
91
 
90
92
        return ::IsTileType(tile, MP_TREES);
91
93
}
92
94
 
93
95
/* static */ bool AITile::IsFarmTile(TileIndex tile)
94
96
{
 
97
        if (!::IsValidTile(tile)) return false;
 
98
 
95
99
        return (::IsTileType(tile, MP_CLEAR) && ::IsClearGround(tile, CLEAR_FIELDS));
96
100
}
97
101
 
98
102
/* static */ bool AITile::IsRockTile(TileIndex tile)
99
103
{
 
104
        if (!::IsValidTile(tile)) return false;
 
105
 
100
106
        return (::IsTileType(tile, MP_CLEAR) && ::IsClearGround(tile, CLEAR_ROCKS));
101
107
}
102
108
 
103
109
/* static */ bool AITile::IsRoughTile(TileIndex tile)
104
110
{
 
111
        if (!::IsValidTile(tile)) return false;
 
112
 
105
113
        return (::IsTileType(tile, MP_CLEAR) && ::IsClearGround(tile, CLEAR_ROUGH));
106
114
}
107
115
 
108
116
/* static */ bool AITile::IsSnowTile(TileIndex tile)
109
117
{
 
118
        if (!::IsValidTile(tile)) return false;
 
119
 
110
120
        return (::IsTileType(tile, MP_CLEAR) && ::IsClearGround(tile, CLEAR_SNOW));
111
121
}
112
122
 
113
123
/* static */ bool AITile::IsDesertTile(TileIndex tile)
114
124
{
 
125
        if (!::IsValidTile(tile)) return false;
 
126
 
115
127
        return (::IsTileType(tile, MP_CLEAR) && ::IsClearGround(tile, CLEAR_DESERT));
116
128
}
117
129
 
177
189
 
178
190
/* static */ int32 AITile::GetCargoAcceptance(TileIndex tile, CargoID cargo_type, int width, int height, int radius)
179
191
{
180
 
        if (!::IsValidTile(tile) || width <= 0 || height <= 0 || radius <= 0) return -1;
 
192
        if (!::IsValidTile(tile) || width <= 0 || height <= 0 || radius < 0) return -1;
181
193
 
182
194
        AcceptedCargo accepts;
183
195
        ::GetAcceptanceAroundTiles(accepts, tile, width, height, _settings_game.station.modified_catchment ? radius : (int)CA_UNMODIFIED);
186
198
 
187
199
/* static */ int32 AITile::GetCargoProduction(TileIndex tile, CargoID cargo_type, int width, int height, int radius)
188
200
{
189
 
        if (!::IsValidTile(tile) || width <= 0 || height <= 0 || radius <= 0) return -1;
 
201
        if (!::IsValidTile(tile) || width <= 0 || height <= 0 || radius < 0) return -1;
190
202
 
191
203
        AcceptedCargo produced;
192
204
        ::GetProductionAroundTiles(produced, tile, width, height, _settings_game.station.modified_catchment ? radius : (int)CA_UNMODIFIED);