src/ai/api/ai_tilelist.hpp
author truebrain
Wed, 27 Feb 2008 21:07:31 +0000
branchnoai
changeset 9792 e1222f4674c2
parent 9778 38560cd27070
child 9801 03a3eebd7fb7
permissions -rw-r--r--
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
9592
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
     1
/* $Id$ */
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
     2
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
     3
/** @file ai_tilelist.hpp a simple tilelist which you can manipulate */
9778
38560cd27070 (svn r12273) [NoAI] -Documentation: big change of many list-related comments. It is now more readable, more explaining, and all unneeded things (API-wise) are removed
truebrain
parents: 9772
diff changeset
     4
/** @defgroup AITileList AITileList - Valuators and lists working on/with AITileList */
9592
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
     5
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
     6
#ifndef AI_TILELIST_HPP
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
     7
#define AI_TILELIST_HPP
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
     8
9593
012f29f59906 (svn r9626) [NoAI] -Change: renamed AIList to AIAbstractList and hide 'AddItem' and 'RemoveItem'
truelight
parents: 9592
diff changeset
     9
#include "ai_abstractlist.hpp"
9757
5cdc14959fb6 (svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents: 9751
diff changeset
    10
#include "../../industry.h"
9592
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    11
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    12
/**
9778
38560cd27070 (svn r12273) [NoAI] -Documentation: big change of many list-related comments. It is now more readable, more explaining, and all unneeded things (API-wise) are removed
truebrain
parents: 9772
diff changeset
    13
 * Creates an empty list, in which you can add tiles.
38560cd27070 (svn r12273) [NoAI] -Documentation: big change of many list-related comments. It is now more readable, more explaining, and all unneeded things (API-wise) are removed
truebrain
parents: 9772
diff changeset
    14
 * @ingroup AITileList
9592
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    15
 */
9593
012f29f59906 (svn r9626) [NoAI] -Change: renamed AIList to AIAbstractList and hide 'AddItem' and 'RemoveItem'
truelight
parents: 9592
diff changeset
    16
class AITileList : public AIAbstractList {
9592
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    17
public:
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    18
	static const char *GetClassName() { return "AITileList"; }
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    19
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    20
private:
9772
c1035f0ac732 (svn r12265) [NoAI] -Add: added a general protection that doesn't allow people using valuators on lists that aren't ment for those valuators
truebrain
parents: 9757
diff changeset
    21
	const char *GetListName() const { return "AITileList"; }
c1035f0ac732 (svn r12265) [NoAI] -Add: added a general protection that doesn't allow people using valuators on lists that aren't ment for those valuators
truebrain
parents: 9757
diff changeset
    22
c1035f0ac732 (svn r12265) [NoAI] -Add: added a general protection that doesn't allow people using valuators on lists that aren't ment for those valuators
truebrain
parents: 9757
diff changeset
    23
private:
c1035f0ac732 (svn r12265) [NoAI] -Add: added a general protection that doesn't allow people using valuators on lists that aren't ment for those valuators
truebrain
parents: 9757
diff changeset
    24
	/**
9592
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    25
	 * Make sure t1.x is smaller than t2.x and t1.y is smaller than t2.y.
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    26
	 * They are swapped to ensure they are after calling this function.
9778
38560cd27070 (svn r12273) [NoAI] -Documentation: big change of many list-related comments. It is now more readable, more explaining, and all unneeded things (API-wise) are removed
truebrain
parents: 9772
diff changeset
    27
	 * @param t1 one of the corners of the rectangle.
38560cd27070 (svn r12273) [NoAI] -Documentation: big change of many list-related comments. It is now more readable, more explaining, and all unneeded things (API-wise) are removed
truebrain
parents: 9772
diff changeset
    28
	 * @param t2 the other corner of the rectangle.
9592
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    29
	 */
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    30
	void FixRectangleSpan(TileIndex &t1, TileIndex &t2);
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    31
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    32
public:
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    33
	/**
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    34
	 * Adds the rectangle between tile_from and tile_to to the to-be-evaluated tiles.
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    35
	 * @param tile_from one corner of the tiles to add.
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    36
	 * @param tile_to the other corner of the tiles to add.
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    37
	 * @pre tile_from is below AIMap::GetMapSize().
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    38
	 * @pre tile_to is below AIMap::GetMapSize().
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    39
	 */
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    40
	void AddRectangle(TileIndex tile_from, TileIndex tile_to);
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    41
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    42
	/**
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    43
	 * Add a tile to the to-be-evaluated tiles.
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    44
	 * @param tile the tile to add.
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    45
	 * @pre tile is below AIMap::GetMapSize().
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    46
	 */
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    47
	void AddTile(TileIndex tile);
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    48
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    49
	/**
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    50
	 * Remove the tiles inside the rectangle between tile_from and tile_to form the list.
9600
59cc173953ae (svn r9634) [NoAI] -Fix: typo in doxygen comment
truelight
parents: 9596
diff changeset
    51
	 * @param tile_from one corner of the tiles to remove.
9592
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    52
	 * @param tile_to the other corner of the files to remove.
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    53
	 * @pre tile_from is below AIMap::GetMapSize().
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    54
	 * @pre tile_to is below AIMap::GetMapSize().
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    55
	 */
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    56
	void RemoveRectangle(TileIndex tile_from, TileIndex tile_to);
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    57
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    58
	/**
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    59
	 * Remove a tile from the list.
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    60
	 * @param tile the tile to remove.
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    61
	 * @pre tile is below AIMap::GetMapSize().
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    62
	 */
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    63
	void RemoveTile(TileIndex tile);
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    64
};
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    65
9757
5cdc14959fb6 (svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents: 9751
diff changeset
    66
/**
9778
38560cd27070 (svn r12273) [NoAI] -Documentation: big change of many list-related comments. It is now more readable, more explaining, and all unneeded things (API-wise) are removed
truebrain
parents: 9772
diff changeset
    67
 * Creates a list of tiles that will accept cargo for the given industry.
38560cd27070 (svn r12273) [NoAI] -Documentation: big change of many list-related comments. It is now more readable, more explaining, and all unneeded things (API-wise) are removed
truebrain
parents: 9772
diff changeset
    68
 * @note If a simular industry is close, it might happen that this industry receives the cargo.
38560cd27070 (svn r12273) [NoAI] -Documentation: big change of many list-related comments. It is now more readable, more explaining, and all unneeded things (API-wise) are removed
truebrain
parents: 9772
diff changeset
    69
 * @ingroup AITileList
9757
5cdc14959fb6 (svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents: 9751
diff changeset
    70
 */
5cdc14959fb6 (svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents: 9751
diff changeset
    71
class AITileList_IndustryAccepting : public AITileList {
5cdc14959fb6 (svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents: 9751
diff changeset
    72
public:
5cdc14959fb6 (svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents: 9751
diff changeset
    73
	static const char *GetClassName() { return "AITileList_IndustryAccepting"; }
5cdc14959fb6 (svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents: 9751
diff changeset
    74
5cdc14959fb6 (svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents: 9751
diff changeset
    75
	/**
9778
38560cd27070 (svn r12273) [NoAI] -Documentation: big change of many list-related comments. It is now more readable, more explaining, and all unneeded things (API-wise) are removed
truebrain
parents: 9772
diff changeset
    76
	 * @param industry_id The industry to create the AITileList around.
38560cd27070 (svn r12273) [NoAI] -Documentation: big change of many list-related comments. It is now more readable, more explaining, and all unneeded things (API-wise) are removed
truebrain
parents: 9772
diff changeset
    77
	 * @param radius The radius of the station you will be using.
9757
5cdc14959fb6 (svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents: 9751
diff changeset
    78
	 */
5cdc14959fb6 (svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents: 9751
diff changeset
    79
	AITileList_IndustryAccepting(IndustryID industry_id, uint radius);
5cdc14959fb6 (svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents: 9751
diff changeset
    80
};
5cdc14959fb6 (svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents: 9751
diff changeset
    81
5cdc14959fb6 (svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents: 9751
diff changeset
    82
/**
9778
38560cd27070 (svn r12273) [NoAI] -Documentation: big change of many list-related comments. It is now more readable, more explaining, and all unneeded things (API-wise) are removed
truebrain
parents: 9772
diff changeset
    83
 * Creates a list of tiles which the industry checks to see if a station is
38560cd27070 (svn r12273) [NoAI] -Documentation: big change of many list-related comments. It is now more readable, more explaining, and all unneeded things (API-wise) are removed
truebrain
parents: 9772
diff changeset
    84
 *  there to receive cargo produced by this industry.
38560cd27070 (svn r12273) [NoAI] -Documentation: big change of many list-related comments. It is now more readable, more explaining, and all unneeded things (API-wise) are removed
truebrain
parents: 9772
diff changeset
    85
 * @ingroup AITileList
9757
5cdc14959fb6 (svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents: 9751
diff changeset
    86
 */
5cdc14959fb6 (svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents: 9751
diff changeset
    87
class AITileList_IndustryProducing : public AITileList {
5cdc14959fb6 (svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents: 9751
diff changeset
    88
public:
5cdc14959fb6 (svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents: 9751
diff changeset
    89
	static const char *GetClassName() { return "AITileList_IndustryProducing"; }
5cdc14959fb6 (svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents: 9751
diff changeset
    90
5cdc14959fb6 (svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents: 9751
diff changeset
    91
	/**
9778
38560cd27070 (svn r12273) [NoAI] -Documentation: big change of many list-related comments. It is now more readable, more explaining, and all unneeded things (API-wise) are removed
truebrain
parents: 9772
diff changeset
    92
	 * @param industry_id The industry to create the AITileList around.
38560cd27070 (svn r12273) [NoAI] -Documentation: big change of many list-related comments. It is now more readable, more explaining, and all unneeded things (API-wise) are removed
truebrain
parents: 9772
diff changeset
    93
	 * @param radius The radius of the station you will be using.
9757
5cdc14959fb6 (svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents: 9751
diff changeset
    94
	 */
5cdc14959fb6 (svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents: 9751
diff changeset
    95
	AITileList_IndustryProducing(IndustryID industry_id, uint radius);
5cdc14959fb6 (svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents: 9751
diff changeset
    96
};
5cdc14959fb6 (svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
truebrain
parents: 9751
diff changeset
    97
9592
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    98
#endif /* AI_TILELIST_HPP */