summaryrefslogtreecommitdiff
path: root/src/ai/ai_instance.hpp
diff options
context:
space:
mode:
authortruebrain <truebrain@openttd.org>2011-11-13 20:43:48 +0000
committertruebrain <truebrain@openttd.org>2011-11-13 20:43:48 +0000
commitb7a655bf4cafc68e14cade593e8b1aca7f04f7dd (patch)
tree1880bbb64896193511e72c23c9387af2bb19acae /src/ai/ai_instance.hpp
parent407514a590dc06c8b80c5304b5e9227c8c844f91 (diff)
downloadopenttd-b7a655bf4cafc68e14cade593e8b1aca7f04f7dd.tar.xz
(svn r23209) -Codechange: track the current active script instance directly, instead of assuming the current company points you to the right one.
Diffstat (limited to 'src/ai/ai_instance.hpp')
-rw-r--r--src/ai/ai_instance.hpp32
1 files changed, 29 insertions, 3 deletions
diff --git a/src/ai/ai_instance.hpp b/src/ai/ai_instance.hpp
index 65884dc71..b0b32b3b5 100644
--- a/src/ai/ai_instance.hpp
+++ b/src/ai/ai_instance.hpp
@@ -81,12 +81,17 @@ public:
/**
* Create a new AI.
- * @param info The AI to create the instance of.
*/
- AIInstance(class AIInfo *info);
+ AIInstance();
~AIInstance();
/**
+ * Initialize the AI and prepare it for its first run.
+ * @param info The AI to create the instance of.
+ */
+ void Initialize(class AIInfo *info);
+
+ /**
* An AI in multiplayer waits for the server to handle his DoCommand.
* It keeps waiting for this until this function is called.
*/
@@ -105,7 +110,12 @@ public:
/**
* Get the storage of this AI.
*/
- static class AIStorage *GetStorage();
+ class AIStorage *GetStorage();
+
+ /**
+ * Get the log pointer of this AI.
+ */
+ void *GetLogPointer();
/**
* Return a true/false reply for a DoCommand.
@@ -173,6 +183,22 @@ public:
* @return The number of operations to execute.
*/
SQInteger GetOpsTillSuspend();
+
+ /**
+ * DoCommand callback function for all commands executed by AIs.
+ * @param result The result of the command.
+ * @param tile The tile on which the command was executed.
+ * @param p1 p1 as given to DoCommandPInternal.
+ * @param p2 p2 as given to DoCommandPInternal.
+ */
+ void DoCommandCallback(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2);
+
+ /**
+ * Insert an event for this AI.
+ * @param event The event to insert.
+ */
+ void InsertEvent(class AIEvent *event);
+
private:
class AIController *controller; ///< The AI main class.
class AIStorage *storage; ///< Some global information for each running AI.