6 #define AI_OBJECT_HPP |
6 #define AI_OBJECT_HPP |
7 |
7 |
8 #include "../../stdafx.h" |
8 #include "../../stdafx.h" |
9 #include "../../functions.h" |
9 #include "../../functions.h" |
10 |
10 |
|
11 typedef bool (AIModeProc)(TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint procc); |
|
12 |
11 /** |
13 /** |
12 * Uper-parent object of all API classes. You should never use this class in |
14 * Uper-parent object of all API classes. You should never use this class in |
13 * your AI, as it doesn't publish any public functions. It is used |
15 * your AI, as it doesn't publish any public functions. It is used |
14 * internally to have a common place to handle general things, like internal |
16 * internally to have a common place to handle general things, like internal |
15 * command processing, and command-validation checks. |
17 * command processing, and command-validation checks. |
16 */ |
18 */ |
17 class AIObject { |
19 class AIObject { |
|
20 private: |
|
21 struct AIDoCommandStruct { |
|
22 AIModeProc *mode; |
|
23 uint delay; |
|
24 }; |
|
25 |
|
26 /** |
|
27 * The current mode of the AI players. |
|
28 */ |
|
29 static AIDoCommandStruct *GetDoCommandStruct(PlayerID player); |
|
30 |
18 protected: |
31 protected: |
19 /** |
32 /** |
20 * Executes a raw DoCommand for the AI. |
33 * Executes a raw DoCommand for the AI. |
21 */ |
34 */ |
22 int32 DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint procc); |
35 int32 DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint procc); |
28 |
41 |
29 /** |
42 /** |
30 * Checks if the result of a DoCommand went okay. |
43 * Checks if the result of a DoCommand went okay. |
31 */ |
44 */ |
32 bool CmdSucceeded(int32 res); |
45 bool CmdSucceeded(int32 res); |
|
46 |
|
47 /** |
|
48 * Set the current mode of your AI to this proc. |
|
49 */ |
|
50 void SetDoCommandMode(AIModeProc *proc); |
|
51 |
|
52 /** |
|
53 * Get the current mode your AI is currently under. |
|
54 */ |
|
55 AIModeProc *GetDoCommandMode(); |
|
56 |
|
57 /** |
|
58 * Set the delay of the DoCommand. |
|
59 */ |
|
60 void SetDoCommandDelay(uint ticks); |
|
61 |
|
62 /** |
|
63 * Get the delay of the DoCommand. |
|
64 */ |
|
65 uint GetDoCommandDelay(); |
33 }; |
66 }; |
34 |
67 |
35 #endif /* AI_OBJECT_HPP */ |
68 #endif /* AI_OBJECT_HPP */ |