author | truebrain |
Wed, 26 Mar 2008 15:17:40 +0000 | |
branch | noai |
changeset 9823 | 0b7f816cf46f |
parent 9816 | 35e866676c00 |
child 9829 | 80fbe02a4184 |
permissions | -rw-r--r-- |
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 |
/** |
9592
c5c09cfde63a
(svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff
changeset
|
22 |
* 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
|
23 |
* 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
|
24 |
* @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
|
25 |
* @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
|
26 |
*/ |
c5c09cfde63a
(svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff
changeset
|
27 |
void FixRectangleSpan(TileIndex &t1, TileIndex &t2); |
c5c09cfde63a
(svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff
changeset
|
28 |
|
c5c09cfde63a
(svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff
changeset
|
29 |
public: |
c5c09cfde63a
(svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff
changeset
|
30 |
/** |
c5c09cfde63a
(svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff
changeset
|
31 |
* 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
|
32 |
* @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
|
33 |
* @param tile_to the other corner of the tiles to add. |
9801
03a3eebd7fb7
(svn r12307) [NoAI] -Codechange: as followup on r12303 (trunk), use ::IsValidTile to check if a tile is inside the map, instead of all our custom ways
truebrain
parents:
9778
diff
changeset
|
34 |
* @pre AIMap::IsValidTile(tile_from). |
03a3eebd7fb7
(svn r12307) [NoAI] -Codechange: as followup on r12303 (trunk), use ::IsValidTile to check if a tile is inside the map, instead of all our custom ways
truebrain
parents:
9778
diff
changeset
|
35 |
* @pre AIMap::IsValidTile(tile_to). |
9592
c5c09cfde63a
(svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff
changeset
|
36 |
*/ |
c5c09cfde63a
(svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff
changeset
|
37 |
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
|
38 |
|
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 |
* 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
|
41 |
* @param tile the tile to add. |
9801
03a3eebd7fb7
(svn r12307) [NoAI] -Codechange: as followup on r12303 (trunk), use ::IsValidTile to check if a tile is inside the map, instead of all our custom ways
truebrain
parents:
9778
diff
changeset
|
42 |
* @pre AIMap::IsValidTile(tile). |
9592
c5c09cfde63a
(svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff
changeset
|
43 |
*/ |
c5c09cfde63a
(svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff
changeset
|
44 |
void AddTile(TileIndex tile); |
c5c09cfde63a
(svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff
changeset
|
45 |
|
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 |
* 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
|
48 |
* @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
|
49 |
* @param tile_to the other corner of the files to remove. |
9801
03a3eebd7fb7
(svn r12307) [NoAI] -Codechange: as followup on r12303 (trunk), use ::IsValidTile to check if a tile is inside the map, instead of all our custom ways
truebrain
parents:
9778
diff
changeset
|
50 |
* @pre AIMap::IsValidTile(tile_from). |
03a3eebd7fb7
(svn r12307) [NoAI] -Codechange: as followup on r12303 (trunk), use ::IsValidTile to check if a tile is inside the map, instead of all our custom ways
truebrain
parents:
9778
diff
changeset
|
51 |
* @pre AIMap::IsValidTile(tile_to). |
9592
c5c09cfde63a
(svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff
changeset
|
52 |
*/ |
c5c09cfde63a
(svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff
changeset
|
53 |
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
|
54 |
|
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 |
* Remove a tile from the list. |
c5c09cfde63a
(svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff
changeset
|
57 |
* @param tile the tile to remove. |
9801
03a3eebd7fb7
(svn r12307) [NoAI] -Codechange: as followup on r12303 (trunk), use ::IsValidTile to check if a tile is inside the map, instead of all our custom ways
truebrain
parents:
9778
diff
changeset
|
58 |
* @pre AIMap::IsValidTile(tile). |
9592
c5c09cfde63a
(svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff
changeset
|
59 |
*/ |
c5c09cfde63a
(svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff
changeset
|
60 |
void RemoveTile(TileIndex tile); |
c5c09cfde63a
(svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff
changeset
|
61 |
}; |
c5c09cfde63a
(svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff
changeset
|
62 |
|
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
|
63 |
/** |
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
|
64 |
* 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
|
65 |
* @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
|
66 |
* @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
|
67 |
*/ |
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
|
68 |
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
|
69 |
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
|
70 |
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
|
71 |
|
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 |
/** |
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
|
73 |
* @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
|
74 |
* @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
|
75 |
*/ |
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
|
76 |
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
|
77 |
}; |
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 |
/** |
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
|
80 |
* 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
|
81 |
* 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
|
82 |
* @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
|
83 |
*/ |
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
|
84 |
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
|
85 |
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
|
86 |
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
|
87 |
|
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 |
/** |
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
|
89 |
* @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
|
90 |
* @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
|
91 |
*/ |
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
|
92 |
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
|
93 |
}; |
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 |
|
9592
c5c09cfde63a
(svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff
changeset
|
95 |
#endif /* AI_TILELIST_HPP */ |