1 /* 2 * This file is part of OpenTTD. 3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. 4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>. 6 */ 7 8 /** @file script_tilelist.hpp List tiles. */ 9 10 #ifndef SCRIPT_TILELIST_HPP 11 #define SCRIPT_TILELIST_HPP 12 13 #include "script_station.hpp" 14 #include "script_list.hpp" 15 16 /** 17 * Creates an empty list, in which you can add tiles. 18 * @api ai game 19 * @ingroup ScriptList 20 */ 21 class ScriptTileList : public ScriptList { 22 public: 23 /** 24 * Adds the rectangle between tile_from and tile_to to the to-be-evaluated tiles. 25 * @param tile_from One corner of the tiles to add. 26 * @param tile_to The other corner of the tiles to add. 27 * @pre ScriptMap::IsValidTile(tile_from). 28 * @pre ScriptMap::IsValidTile(tile_to). 29 */ 30 void AddRectangle(TileIndex tile_from, TileIndex tile_to); 31 32 /** 33 * Add a tile to the to-be-evaluated tiles. 34 * @param tile The tile to add. 35 * @pre ScriptMap::IsValidTile(tile). 36 */ 37 void AddTile(TileIndex tile); 38 39 /** 40 * Remove the tiles inside the rectangle between tile_from and tile_to form the list. 41 * @param tile_from One corner of the tiles to remove. 42 * @param tile_to The other corner of the files to remove. 43 * @pre ScriptMap::IsValidTile(tile_from). 44 * @pre ScriptMap::IsValidTile(tile_to). 45 */ 46 void RemoveRectangle(TileIndex tile_from, TileIndex tile_to); 47 48 /** 49 * Remove a tile from the list. 50 * @param tile The tile to remove. 51 * @pre ScriptMap::IsValidTile(tile). 52 */ 53 void RemoveTile(TileIndex tile); 54 }; 55 56 /** 57 * Creates a list of tiles that will accept cargo for the given industry. 58 * @note If a simular industry is close, it might happen that this industry receives the cargo. 59 * @api ai game 60 * @ingroup ScriptList 61 */ 62 class ScriptTileList_IndustryAccepting : public ScriptTileList { 63 public: 64 /** 65 * @param industry_id The industry to create the ScriptTileList around. 66 * @param radius The coverage radius of the station type you will be using. 67 * @pre ScriptIndustry::IsValidIndustry(industry_id). 68 * @pre radius > 0. 69 * @note A station part built on any of the returned tiles will give you coverage. 70 */ 71 ScriptTileList_IndustryAccepting(IndustryID industry_id, int radius); 72 }; 73 74 /** 75 * Creates a list of tiles which the industry checks to see if a station is 76 * there to receive cargo produced by this industry. 77 * @api ai game 78 * @ingroup ScriptList 79 */ 80 class ScriptTileList_IndustryProducing : public ScriptTileList { 81 public: 82 /** 83 * @param industry_id The industry to create the ScriptTileList around. 84 * @param radius The coverage radius of the station type you will be using. 85 * @pre ScriptIndustry::IsValidIndustry(industry_id). 86 * @pre radius > 0. 87 * @note A station part built on any of the returned tiles will give you acceptance. 88 */ 89 ScriptTileList_IndustryProducing(IndustryID industry_id, int radius); 90 }; 91 92 /** 93 * Creates a list of tiles which have the requested StationType of the 94 * StationID. 95 * @api ai game 96 * @ingroup ScriptList 97 */ 98 class ScriptTileList_StationType : public ScriptTileList { 99 public: 100 /** 101 * @param station_id The station to create the ScriptTileList for. 102 * @param station_type The StationType to create the ScriptList for. 103 */ 104 ScriptTileList_StationType(StationID station_id, ScriptStation::StationType station_type); 105 }; 106 107 #endif /* SCRIPT_TILELIST_HPP */ 108