author | rubidium |
Thu, 03 Apr 2008 23:01:54 +0000 | |
branch | noai |
changeset 9865 | f241472f09dc |
parent 9838 | 0839682a601b |
child 10090 | d6a6cac2fb25 |
permissions | -rw-r--r-- |
9511 | 1 |
/* $Id$ */ |
2 |
||
9829
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9801
diff
changeset
|
3 |
/** @file ai_sign.hpp Everything to query and build signs. */ |
9511 | 4 |
|
5 |
#ifndef AI_SIGN_HPP |
|
6 |
#define AI_SIGN_HPP |
|
7 |
||
8 |
#include "ai_object.hpp" |
|
9 |
||
10 |
/** |
|
9513
258f78c74b0c
(svn r9410) [NoAI] -Fix: some copy-paste mistakes...
rubidium
parents:
9511
diff
changeset
|
11 |
* Class that handles all sign related functions. |
9511 | 12 |
*/ |
13 |
class AISign : public AIObject { |
|
14 |
public: |
|
9529
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9526
diff
changeset
|
15 |
static const char *GetClassName() { return "AISign"; } |
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9526
diff
changeset
|
16 |
|
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9526
diff
changeset
|
17 |
/** |
9511 | 18 |
* Gets the maximum sign index; there are no valid signs with a higher index. |
9838
0839682a601b
(svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents:
9829
diff
changeset
|
19 |
* @return The maximum sign index. |
0839682a601b
(svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents:
9829
diff
changeset
|
20 |
* @post Return value is always non-negative. |
9511 | 21 |
*/ |
9737
ee408edf3851
(svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents:
9596
diff
changeset
|
22 |
static SignID GetMaxSignID(); |
9511 | 23 |
|
24 |
/** |
|
9513
258f78c74b0c
(svn r9410) [NoAI] -Fix: some copy-paste mistakes...
rubidium
parents:
9511
diff
changeset
|
25 |
* Gets the number of signs. This is different than GetMaxSignID() |
9511 | 26 |
* because of the way OpenTTD works internally. |
9838
0839682a601b
(svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents:
9829
diff
changeset
|
27 |
* @return The number of signs. |
0839682a601b
(svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents:
9829
diff
changeset
|
28 |
* @post Return value is always non-negative. |
9511 | 29 |
*/ |
9737
ee408edf3851
(svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents:
9596
diff
changeset
|
30 |
static int32 GetSignCount(); |
9511 | 31 |
|
32 |
/** |
|
33 |
* Checks whether the given sign index is valid. |
|
9838
0839682a601b
(svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents:
9829
diff
changeset
|
34 |
* @param sign_id The index to check. |
0839682a601b
(svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents:
9829
diff
changeset
|
35 |
* @return True if and only if the sign is valid. |
9511 | 36 |
*/ |
37 |
static bool IsValidSign(SignID sign_id); |
|
38 |
||
39 |
/** |
|
40 |
* Get the text on the sign. |
|
9838
0839682a601b
(svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents:
9829
diff
changeset
|
41 |
* @param sign_id The sign to get the text of. |
0839682a601b
(svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents:
9829
diff
changeset
|
42 |
* @pre IsValidSign(sign_id). |
0839682a601b
(svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents:
9829
diff
changeset
|
43 |
* @return The text on the sign. |
9511 | 44 |
*/ |
9737
ee408edf3851
(svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents:
9596
diff
changeset
|
45 |
static char *GetText(SignID sign_id); |
9511 | 46 |
|
47 |
/** |
|
48 |
* Gets the location of the sign. |
|
9838
0839682a601b
(svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents:
9829
diff
changeset
|
49 |
* @param sign_id The sign to get the location of. |
0839682a601b
(svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents:
9829
diff
changeset
|
50 |
* @pre IsValidSign(sign_id). |
0839682a601b
(svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents:
9829
diff
changeset
|
51 |
* @return The location of the sign. |
9511 | 52 |
*/ |
9737
ee408edf3851
(svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents:
9596
diff
changeset
|
53 |
static TileIndex GetLocation(SignID sign_id); |
9511 | 54 |
|
55 |
/** |
|
56 |
* Builds a sign on the map. |
|
9838
0839682a601b
(svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents:
9829
diff
changeset
|
57 |
* @param location The place to build the sign. |
0839682a601b
(svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents:
9829
diff
changeset
|
58 |
* @param text The text to place on the sign. |
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:
9737
diff
changeset
|
59 |
* @pre AIMap::IsValidTile(location). |
9838
0839682a601b
(svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents:
9829
diff
changeset
|
60 |
* @return The SignID of the build sign (use IsValidSign() to check for validity). |
9562
2f4087d63527
(svn r9500) [NoAI] -Add: document behavoir in test-mode
truelight
parents:
9541
diff
changeset
|
61 |
* In test-mode it returns 0 if successful, or any other value to indicate |
2f4087d63527
(svn r9500) [NoAI] -Add: document behavoir in test-mode
truelight
parents:
9541
diff
changeset
|
62 |
* failure. |
9511 | 63 |
*/ |
9737
ee408edf3851
(svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents:
9596
diff
changeset
|
64 |
static SignID BuildSign(TileIndex location, const char *text); |
9829
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9801
diff
changeset
|
65 |
|
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9801
diff
changeset
|
66 |
/** |
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9801
diff
changeset
|
67 |
* Removes a sign from the map. |
9838
0839682a601b
(svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents:
9829
diff
changeset
|
68 |
* @param sign_id The sign to remove. |
0839682a601b
(svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents:
9829
diff
changeset
|
69 |
* @pre IsValidSign(sign_id). |
0839682a601b
(svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents:
9829
diff
changeset
|
70 |
* @return True if and only if the sign has been removed. |
9829
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9801
diff
changeset
|
71 |
*/ |
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9801
diff
changeset
|
72 |
static bool RemoveSign(SignID sign_id); |
9511 | 73 |
}; |
74 |
||
75 |
#endif /* AI_SIGN_HPP */ |