summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ai/ai_instance.cpp11
-rw-r--r--src/ai/ai_instance.hpp20
-rw-r--r--src/script/api/script_execmode.hpp2
-rw-r--r--src/script/api/script_object.cpp8
-rw-r--r--src/script/api/script_object.hpp6
-rw-r--r--src/script/api/script_testmode.hpp2
-rw-r--r--src/script/script_storage.hpp (renamed from src/ai/ai_storage.hpp)22
7 files changed, 36 insertions, 35 deletions
diff --git a/src/ai/ai_instance.cpp b/src/ai/ai_instance.cpp
index e4cbf315f..729344fce 100644
--- a/src/ai/ai_instance.cpp
+++ b/src/ai/ai_instance.cpp
@@ -17,10 +17,11 @@
#include "../script/squirrel_class.hpp"
#include "ai_config.hpp"
-#include "ai_storage.hpp"
-#include "ai_instance.hpp"
#include "ai_gui.hpp"
+#include "../script/script_storage.hpp"
+#include "ai_instance.hpp"
+
/* Convert all AI related classes to Squirrel data.
* Note: this line is a marker in squirrel_export.sh. Do not change! */
#include "api/ai_accounting.hpp.sq"
@@ -82,7 +83,7 @@ static const int MAX_SL_OPS = 100000;
/** The maximum number of operations for initial start of an AI. */
static const int MAX_CONSTRUCTOR_OPS = 100000;
-AIStorage::~AIStorage()
+ScriptStorage::~ScriptStorage()
{
/* Free our pointers */
if (event_data != NULL) ScriptEventController::FreeEventPointer();
@@ -111,7 +112,7 @@ AIInstance::AIInstance() :
suspend(0),
callback(NULL)
{
- this->storage = new AIStorage();
+ this->storage = new ScriptStorage();
this->engine = new Squirrel("AI");
this->engine->SetPrintFunction(&PrintFunc);
}
@@ -428,7 +429,7 @@ void AIInstance::CollectGarbage() const
instance->engine->InsertResult(ScriptObject::GetNewGroupID());
}
-AIStorage *AIInstance::GetStorage()
+ScriptStorage *AIInstance::GetStorage()
{
return this->storage;
}
diff --git a/src/ai/ai_instance.hpp b/src/ai/ai_instance.hpp
index 4e6598342..3f120a385 100644
--- a/src/ai/ai_instance.hpp
+++ b/src/ai/ai_instance.hpp
@@ -111,7 +111,7 @@ public:
/**
* Get the storage of this AI.
*/
- class AIStorage *GetStorage();
+ class ScriptStorage *GetStorage();
/**
* Get the log pointer of this AI.
@@ -202,15 +202,15 @@ public:
private:
class ScriptController *controller; ///< The AI main class.
- class AIStorage *storage; ///< Some global information for each running AI.
- class Squirrel *engine; ///< A wrapper around the squirrel vm.
- SQObject *instance; ///< Squirrel-pointer to the AI main class.
-
- bool is_started; ///< Is the AIs constructor executed?
- bool is_dead; ///< True if the AI has been stopped.
- bool is_save_data_on_stack; ///< Is the save data still on the squirrel stack?
- int suspend; ///< The amount of ticks to suspend this AI before it's allowed to continue.
- AISuspendCallbackProc *callback; ///< Callback that should be called in the next tick the AI runs.
+ class ScriptStorage *storage; ///< Some global information for each running AI.
+ class Squirrel *engine; ///< A wrapper around the squirrel vm.
+ SQObject *instance; ///< Squirrel-pointer to the AI main class.
+
+ bool is_started; ///< Is the AIs constructor executed?
+ bool is_dead; ///< True if the AI has been stopped.
+ bool is_save_data_on_stack; ///< Is the save data still on the squirrel stack?
+ int suspend; ///< The amount of ticks to suspend this AI before it's allowed to continue.
+ AISuspendCallbackProc *callback; ///< Callback that should be called in the next tick the AI runs.
/**
* Register all API functions to the VM.
diff --git a/src/script/api/script_execmode.hpp b/src/script/api/script_execmode.hpp
index 8dfa00938..a3ce70d68 100644
--- a/src/script/api/script_execmode.hpp
+++ b/src/script/api/script_execmode.hpp
@@ -23,7 +23,7 @@
*/
class ScriptExecMode : public ScriptObject {
private:
- AIModeProc *last_mode; ///< The previous mode we were in.
+ ScriptModeProc *last_mode; ///< The previous mode we were in.
ScriptObject *last_instance; ///< The previous instace of the mode.
protected:
diff --git a/src/script/api/script_object.cpp b/src/script/api/script_object.cpp
index 2b6a3039b..0be85a745 100644
--- a/src/script/api/script_object.cpp
+++ b/src/script/api/script_object.cpp
@@ -15,7 +15,7 @@
#include "../../network/network.h"
#include "../../tunnelbridge.h"
-#include "../../ai/ai_storage.hpp"
+#include "../script_storage.hpp"
#include "../../ai/ai_instance.hpp"
#include "script_error.hpp"
@@ -23,7 +23,7 @@
* Get the storage associated with the current AIInstance.
* @return The storage.
*/
-static AIStorage *GetStorage()
+static ScriptStorage *GetStorage()
{
return ScriptObject::GetActiveInstance()->GetStorage();
}
@@ -60,13 +60,13 @@ ScriptObject::ActiveInstance::~ActiveInstance()
return GetStorage()->delay;
}
-/* static */ void ScriptObject::SetDoCommandMode(AIModeProc *proc, ScriptObject *instance)
+/* static */ void ScriptObject::SetDoCommandMode(ScriptModeProc *proc, ScriptObject *instance)
{
GetStorage()->mode = proc;
GetStorage()->mode_instance = instance;
}
-/* static */ AIModeProc *ScriptObject::GetDoCommandMode()
+/* static */ ScriptModeProc *ScriptObject::GetDoCommandMode()
{
return GetStorage()->mode;
}
diff --git a/src/script/api/script_object.hpp b/src/script/api/script_object.hpp
index b4b55c740..b38757cc9 100644
--- a/src/script/api/script_object.hpp
+++ b/src/script/api/script_object.hpp
@@ -26,7 +26,7 @@ typedef void (AISuspendCallbackProc)(class AIInstance *instance);
/**
* The callback function for Mode-classes.
*/
-typedef bool (AIModeProc)();
+typedef bool (ScriptModeProc)();
/**
* Uper-parent object of all API classes. You should never use this class in
@@ -122,12 +122,12 @@ protected:
/**
* Set the current mode of your AI to this proc.
*/
- static void SetDoCommandMode(AIModeProc *proc, ScriptObject *instance);
+ static void SetDoCommandMode(ScriptModeProc *proc, ScriptObject *instance);
/**
* Get the current mode your AI is currently under.
*/
- static AIModeProc *GetDoCommandMode();
+ static ScriptModeProc *GetDoCommandMode();
/**
* Get the instance of the current mode your AI is currently under.
diff --git a/src/script/api/script_testmode.hpp b/src/script/api/script_testmode.hpp
index 6954146a9..a1b9e6bbf 100644
--- a/src/script/api/script_testmode.hpp
+++ b/src/script/api/script_testmode.hpp
@@ -25,7 +25,7 @@
*/
class ScriptTestMode : public ScriptObject {
private:
- AIModeProc *last_mode; ///< The previous mode we were in.
+ ScriptModeProc *last_mode; ///< The previous mode we were in.
ScriptObject *last_instance; ///< The previous instace of the mode.
protected:
diff --git a/src/ai/ai_storage.hpp b/src/script/script_storage.hpp
index 8e832dfb9..bf369acfb 100644
--- a/src/ai/ai_storage.hpp
+++ b/src/script/script_storage.hpp
@@ -7,10 +7,10 @@
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
-/** @file ai_storage.hpp Defines AIStorage and includes all files required for it. */
+/** @file script_storage.hpp Defines ScriptStorage and includes all files required for it. */
-#ifndef AI_STORAGE_HPP
-#define AI_STORAGE_HPP
+#ifndef SCRIPT_STORAGE_HPP
+#define SCRIPT_STORAGE_HPP
#include "../signs_func.h"
#include "../vehicle_func.h"
@@ -23,21 +23,21 @@
/**
* The callback function for Mode-classes.
*/
-typedef bool (AIModeProc)();
+typedef bool (ScriptModeProc)();
/**
- * The storage for each AI. It keeps track of important information.
+ * The storage for each script. It keeps track of important information.
*/
-class AIStorage {
+class ScriptStorage {
friend class ScriptObject;
private:
- AIModeProc *mode; ///< The current build mode we are int.
+ ScriptModeProc *mode; ///< The current build mode we are int.
class ScriptObject *mode_instance; ///< The instance belonging to the current build mode.
uint delay; ///< The ticks of delay each DoCommand has.
bool allow_do_command; ///< Is the usage of DoCommands restricted?
- CommandCost costs; ///< The costs the AI is tracking.
+ CommandCost costs; ///< The costs the script is tracking.
Money last_cost; ///< The last cost of the command.
uint last_error; ///< The last error of the command.
bool last_command_res; ///< The last result of the command.
@@ -56,7 +56,7 @@ private:
void *log_data; ///< Pointer to the log data storage.
public:
- AIStorage() :
+ ScriptStorage() :
mode (NULL),
mode_instance (NULL),
delay (1),
@@ -76,7 +76,7 @@ public:
log_data (NULL)
{ }
- ~AIStorage();
+ ~ScriptStorage();
};
-#endif /* AI_STORAGE_HPP */
+#endif /* SCRIPT_STORAGE_HPP */