diff options
author | truebrain <truebrain@openttd.org> | 2011-11-29 23:21:33 +0000 |
---|---|---|
committer | truebrain <truebrain@openttd.org> | 2011-11-29 23:21:33 +0000 |
commit | 3da8b5097a4643d531182173df36ca4d3b45a4e2 (patch) | |
tree | f310e6fd8a61909b60111f6b2e906e0ab6ff8231 /src/script/api/script_object.hpp | |
parent | 75c4bd280a720592ec4df26efbedd9df5baa2d8f (diff) | |
download | openttd-3da8b5097a4643d531182173df36ca4d3b45a4e2.tar.xz |
(svn r23360) -Codechange: move AIInstance to ScriptInstance, making it reusable by other script API instances
Diffstat (limited to 'src/script/api/script_object.hpp')
-rw-r--r-- | src/script/api/script_object.hpp | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/script/api/script_object.hpp b/src/script/api/script_object.hpp index b38757cc9..6e6e96d8b 100644 --- a/src/script/api/script_object.hpp +++ b/src/script/api/script_object.hpp @@ -17,11 +17,7 @@ #include "../../rail_type.h" #include "script_types.hpp" - -/** - * The callback function when an AI suspends. - */ -typedef void (AISuspendCallbackProc)(class AIInstance *instance); +#include "../script_suspend.hpp" /** * The callback function for Mode-classes. @@ -30,12 +26,12 @@ typedef bool (ScriptModeProc)(); /** * Uper-parent object of all API classes. You should never use this class in - * your AI, as it doesn't publish any public functions. It is used + * your script, as it doesn't publish any public functions. It is used * internally to have a common place to handle general things, like internal * command processing, and command-validation checks. */ class ScriptObject : public SimpleCountedObject { -friend class AIInstance; +friend class ScriptInstance; #ifndef DOXYGEN_AI_DOCS protected: /** @@ -47,12 +43,12 @@ protected: class ActiveInstance { friend class ScriptObject; public: - ActiveInstance(AIInstance *instance); + ActiveInstance(ScriptInstance *instance); ~ActiveInstance(); private: - AIInstance *last_active; ///< The active instance before we go instantiated. + ScriptInstance *last_active; ///< The active instance before we go instantiated. - static AIInstance *active; ///< The global current active instance. + static ScriptInstance *active; ///< The global current active instance. }; public: @@ -66,13 +62,13 @@ public: * Get the currently active instance. * @return The instance. */ - static class AIInstance *GetActiveInstance(); + static class ScriptInstance *GetActiveInstance(); protected: /** * Executes a raw DoCommand for the AI. */ - static bool DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint cmd, const char *text = NULL, AISuspendCallbackProc *callback = NULL); + static bool DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint cmd, const char *text = NULL, Script_SuspendCallbackProc *callback = NULL); /** * Sets the DoCommand costs counter to a value. |