summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--projects/openttd_vs100.vcxproj2
-rw-r--r--projects/openttd_vs100.vcxproj.filters6
-rw-r--r--projects/openttd_vs80.vcproj8
-rw-r--r--projects/openttd_vs90.vcproj8
-rw-r--r--source.list2
-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
12 files changed, 49 insertions, 48 deletions
diff --git a/projects/openttd_vs100.vcxproj b/projects/openttd_vs100.vcxproj
index a43a2ea97..bb88f7d78 100644
--- a/projects/openttd_vs100.vcxproj
+++ b/projects/openttd_vs100.vcxproj
@@ -792,6 +792,7 @@
<ClInclude Include="..\src\script\script_info.hpp" />
<ClCompile Include="..\src\script\script_scanner.cpp" />
<ClInclude Include="..\src\script\script_scanner.hpp" />
+ <ClInclude Include="..\src\script\script_storage.hpp" />
<ClCompile Include="..\src\script\squirrel.cpp" />
<ClInclude Include="..\src\script\squirrel.hpp" />
<ClInclude Include="..\src\script\squirrel_class.hpp" />
@@ -851,7 +852,6 @@
<ClInclude Include="..\src\ai\ai_instance.hpp" />
<ClCompile Include="..\src\ai\ai_scanner.cpp" />
<ClInclude Include="..\src\ai\ai_scanner.hpp" />
- <ClInclude Include="..\src\ai\ai_storage.hpp" />
<ClInclude Include="..\src\ai\api\ai_changelog.hpp" />
<ClInclude Include="..\src\ai\api\ai_info_docs.hpp" />
<ClInclude Include="..\src\script\api\script_accounting.hpp" />
diff --git a/projects/openttd_vs100.vcxproj.filters b/projects/openttd_vs100.vcxproj.filters
index 442e692cb..dedbcc439 100644
--- a/projects/openttd_vs100.vcxproj.filters
+++ b/projects/openttd_vs100.vcxproj.filters
@@ -1599,6 +1599,9 @@
<ClInclude Include="..\src\script\script_scanner.hpp">
<Filter>Script</Filter>
</ClInclude>
+ <ClInclude Include="..\src\script\script_storage.hpp">
+ <Filter>Script</Filter>
+ </ClInclude>
<ClCompile Include="..\src\script\squirrel.cpp">
<Filter>Script</Filter>
</ClCompile>
@@ -1776,9 +1779,6 @@
<ClInclude Include="..\src\ai\ai_scanner.hpp">
<Filter>AI Core</Filter>
</ClInclude>
- <ClInclude Include="..\src\ai\ai_storage.hpp">
- <Filter>AI Core</Filter>
- </ClInclude>
<ClInclude Include="..\src\ai\api\ai_changelog.hpp">
<Filter>AI API</Filter>
</ClInclude>
diff --git a/projects/openttd_vs80.vcproj b/projects/openttd_vs80.vcproj
index 58cb86ed7..d9f62e525 100644
--- a/projects/openttd_vs80.vcproj
+++ b/projects/openttd_vs80.vcproj
@@ -2475,6 +2475,10 @@
>
</File>
<File
+ RelativePath=".\..\src\script\script_storage.hpp"
+ >
+ </File>
+ <File
RelativePath=".\..\src\script\squirrel.cpp"
>
</File>
@@ -2722,10 +2726,6 @@
RelativePath=".\..\src\ai\ai_scanner.hpp"
>
</File>
- <File
- RelativePath=".\..\src\ai\ai_storage.hpp"
- >
- </File>
</Filter>
<Filter
Name="AI API"
diff --git a/projects/openttd_vs90.vcproj b/projects/openttd_vs90.vcproj
index d1224d101..6b3a58598 100644
--- a/projects/openttd_vs90.vcproj
+++ b/projects/openttd_vs90.vcproj
@@ -2472,6 +2472,10 @@
>
</File>
<File
+ RelativePath=".\..\src\script\script_storage.hpp"
+ >
+ </File>
+ <File
RelativePath=".\..\src\script\squirrel.cpp"
>
</File>
@@ -2719,10 +2723,6 @@
RelativePath=".\..\src\ai\ai_scanner.hpp"
>
</File>
- <File
- RelativePath=".\..\src\ai\ai_storage.hpp"
- >
- </File>
</Filter>
<Filter
Name="AI API"
diff --git a/source.list b/source.list
index 6e08a0dfa..61bbf52e7 100644
--- a/source.list
+++ b/source.list
@@ -557,6 +557,7 @@ script/script_info.cpp
script/script_info.hpp
script/script_scanner.cpp
script/script_scanner.hpp
+script/script_storage.hpp
script/squirrel.cpp
script/squirrel.hpp
script/squirrel_class.hpp
@@ -622,7 +623,6 @@ ai/ai_instance.cpp
ai/ai_instance.hpp
ai/ai_scanner.cpp
ai/ai_scanner.hpp
-ai/ai_storage.hpp
# AI API
ai/api/ai_changelog.hpp
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 */