(svn r13654) [NoAI] -Change [API CHANGE]: moved AISetting::SetCommandDelay to AIController::SetCommandDelay, as it was silly to have it in a seperate class, while it was part of the controller.
--- a/projects/openttd_vs80.vcproj Mon Jun 30 10:46:20 2008 +0000
+++ b/projects/openttd_vs80.vcproj Mon Jun 30 12:15:10 2008 +0000
@@ -2416,10 +2416,6 @@
>
</File>
<File
- RelativePath=".\..\src\ai\api\ai_settings.hpp"
- >
- </File>
- <File
RelativePath=".\..\src\ai\api\ai_sign.hpp"
>
</File>
@@ -2604,10 +2600,6 @@
>
</File>
<File
- RelativePath=".\..\src\ai\api\ai_settings.cpp"
- >
- </File>
- <File
RelativePath=".\..\src\ai\api\ai_sign.cpp"
>
</File>
--- a/projects/openttd_vs90.vcproj Mon Jun 30 10:46:20 2008 +0000
+++ b/projects/openttd_vs90.vcproj Mon Jun 30 12:15:10 2008 +0000
@@ -2413,10 +2413,6 @@
>
</File>
<File
- RelativePath=".\..\src\ai\api\ai_settings.hpp"
- >
- </File>
- <File
RelativePath=".\..\src\ai\api\ai_sign.hpp"
>
</File>
@@ -2601,10 +2597,6 @@
>
</File>
<File
- RelativePath=".\..\src\ai\api\ai_settings.cpp"
- >
- </File>
- <File
RelativePath=".\..\src\ai\api\ai_sign.cpp"
>
</File>
--- a/source.list Mon Jun 30 10:46:20 2008 +0000
+++ b/source.list Mon Jun 30 12:15:10 2008 +0000
@@ -552,7 +552,6 @@
ai/api/ai_object.hpp
ai/api/ai_order.hpp
ai/api/ai_road.hpp
-ai/api/ai_settings.hpp
ai/api/ai_sign.hpp
ai/api/ai_station.hpp
ai/api/ai_stationlist.hpp
@@ -600,7 +599,6 @@
ai/api/ai_object.cpp
ai/api/ai_order.cpp
ai/api/ai_road.cpp
-ai/api/ai_settings.cpp
ai/api/ai_sign.cpp
ai/api/ai_station.cpp
ai/api/ai_stationlist.cpp
--- a/src/ai/api/ai_controller.cpp Mon Jun 30 10:46:20 2008 +0000
+++ b/src/ai/api/ai_controller.cpp Mon Jun 30 12:15:10 2008 +0000
@@ -49,7 +49,6 @@
#include "ai_marine.hpp.sq"
#include "ai_order.hpp.sq"
#include "ai_road.hpp.sq"
-#include "ai_settings.hpp.sq"
#include "ai_sign.hpp.sq"
#include "ai_station.hpp.sq"
#include "ai_stationlist.hpp.sq"
@@ -65,6 +64,12 @@
#include "ai_vehicle.hpp.sq"
#include "ai_vehiclelist.hpp.sq"
+/* static */ void AIController::SetCommandDelay(int ticks)
+{
+ if (ticks <= 0) return;
+ AIObject::SetDoCommandDelay(ticks);
+}
+
/* static */ void AIController::Sleep(int ticks)
{
if (ticks <= 0) {
@@ -135,7 +140,6 @@
SQAIMarine_Register(this->engine);
SQAIOrder_Register(this->engine);
SQAIRoad_Register(this->engine);
- SQAISettings_Register(this->engine);
SQAISign_Register(this->engine);
SQAIStation_Register(this->engine);
SQAIStationList_Register(this->engine);
@@ -200,6 +204,7 @@
if (this->engine->MethodExists(*this->SQ_instance, "constructor")) {
this->engine->CallMethod(*this->SQ_instance, "constructor");
}
+
/* When that is done, start the Start() function */
this->engine->CallMethod(*this->SQ_instance, "Start");
}
--- a/src/ai/api/ai_controller.hpp Mon Jun 30 10:46:20 2008 +0000
+++ b/src/ai/api/ai_controller.hpp Mon Jun 30 12:15:10 2008 +0000
@@ -55,6 +55,18 @@
uint GetTick();
/**
+ * Change the minimum amount of time the AI should be put in suspend mode
+ * when you execute a command. Normally in SP this is 1, and in MP it is
+ * what ever delay the server has been programmed to delay commands
+ * (normally between 1 and 5). To give a more 'real' effect to your AI,
+ * you can control that number here.
+ * @param ticks The minimum amount of ticks to wait.
+ * @pre Ticks should be positive. Too big values will influence performance of the AI.
+ * @note If the number is lower then the MP setting, the MP setting wins.
+ */
+ static void SetCommandDelay(int ticks);
+
+ /**
* Sleep for X ticks. The code continues after this line when the X AI ticks
* are passed. Mind that an AI tick is different from in-game ticks and
* differ per AI speed.
--- a/src/ai/api/ai_controller.hpp.sq Mon Jun 30 10:46:20 2008 +0000
+++ b/src/ai/api/ai_controller.hpp.sq Mon Jun 30 12:15:10 2008 +0000
@@ -3,8 +3,9 @@
void SQAIController_Register(Squirrel *engine) {
DefSQClass <AIController> SQAIController("AIController");
SQAIController.PreRegister(engine);
- SQAIController.DefSQMethod(engine, &AIController::GetTick, "GetTick", 1, "x");
- SQAIController.DefSQStaticMethod(engine, &AIController::Sleep, "Sleep", 2, "xi");
- SQAIController.DefSQStaticMethod(engine, &AIController::Print, "Print", 3, "xbs");
+ SQAIController.DefSQMethod(engine, &AIController::GetTick, "GetTick", 1, "x");
+ SQAIController.DefSQStaticMethod(engine, &AIController::SetCommandDelay, "SetCommandDelay", 2, "xi");
+ SQAIController.DefSQStaticMethod(engine, &AIController::Sleep, "Sleep", 2, "xi");
+ SQAIController.DefSQStaticMethod(engine, &AIController::Print, "Print", 3, "xbs");
SQAIController.PostRegister(engine);
}
--- a/src/ai/api/ai_settings.cpp Mon Jun 30 10:46:20 2008 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-/* $Id$ */
-
-/** @file ai_settings.cpp Implementation of AISettings. */
-
-#include "ai_settings.hpp"
-
-/* static */ void AISettings::SetCommandDelay(uint ticks)
-{
- if (ticks == 0) return;
- AIObject::SetDoCommandDelay(ticks);
-}
--- a/src/ai/api/ai_settings.hpp Mon Jun 30 10:46:20 2008 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/* $Id$ */
-
-/** @file ai_settings.hpp Everything to change AI settings. */
-
-#ifndef AI_SETTINGS_HPP
-#define AI_SETTINGS_HPP
-
-#include "ai_object.hpp"
-
-/**
- * Class that handles all AI settings related functions.
- */
-class AISettings : public AIObject {
-public:
- static const char *GetClassName() { return "AISettings"; }
-
- /**
- * Change the minimum amount of time the AI should be put in suspend mode
- * when you execute a command. Normally in SP this is 1, and in MP it is
- * what ever delay the server has been programmed to delay commands
- * (normally between 1 and 5). To give a more 'real' effect to your AI,
- * you can control that number here.
- * @param ticks The minimum amount of ticks to wait.
- * @pre Ticks should be positive. Too big values will influence performance of the AI.
- * @note If the number is lower then the MP setting, the MP setting wins.
- */
- static void SetCommandDelay(uint ticks);
-};
-
-#endif /* AI_SETTINGS_HPP */
--- a/src/ai/api/ai_settings.hpp.sq Mon Jun 30 10:46:20 2008 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-/* $Id$ */
-/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */
-
-#include "ai_settings.hpp"
-
-namespace SQConvert {
- /* Allow AISettings to be used as Squirrel parameter */
- template <> AISettings *GetParam(ForceType<AISettings *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AISettings *)instance; }
- template <> AISettings &GetParam(ForceType<AISettings &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AISettings *)instance; }
- template <> const AISettings *GetParam(ForceType<const AISettings *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AISettings *)instance; }
- template <> const AISettings &GetParam(ForceType<const AISettings &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AISettings *)instance; }
- template <> int Return<AISettings *>(HSQUIRRELVM vm, AISettings *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AISettings", res, NULL, DefSQDestructorCallback<AISettings>); return 1; }
-}; // namespace SQConvert
-
-void SQAISettings_Register(Squirrel *engine) {
- DefSQClass <AISettings> SQAISettings("AISettings");
- SQAISettings.PreRegister(engine);
- SQAISettings.AddConstructor<void (AISettings::*)(), 1>(engine, "x");
-
- SQAISettings.DefSQStaticMethod(engine, &AISettings::GetClassName, "GetClassName", 1, "x");
- SQAISettings.DefSQStaticMethod(engine, &AISettings::SetCommandDelay, "SetCommandDelay", 2, "xi");
-
- SQAISettings.PostRegister(engine);
-}