mirror of https://github.com/OpenTTD/OpenTTD
(svn r15462) -Change [NoAI]: Make AIController::GetTick() and AIController::GetSetting() static functions.
-Fix (r15460): ai_controller.hpp.sq was forgotten.release/0.7
parent
806807e16b
commit
4c7106dad7
|
@ -56,12 +56,12 @@ AIController::~AIController()
|
||||||
this->loaded_library.clear();
|
this->loaded_library.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint AIController::GetTick()
|
/* static */ uint AIController::GetTick()
|
||||||
{
|
{
|
||||||
return this->ticks;
|
return ::GetCompany(_current_company)->ai_instance->GetController()->ticks;
|
||||||
}
|
}
|
||||||
|
|
||||||
int AIController::GetSetting(const char *name)
|
/* static */ int AIController::GetSetting(const char *name)
|
||||||
{
|
{
|
||||||
return AIConfig::GetConfig(_current_company)->GetSetting(name);
|
return AIConfig::GetConfig(_current_company)->GetSetting(name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,14 +41,14 @@ public:
|
||||||
* Find at which tick your AI currently is.
|
* Find at which tick your AI currently is.
|
||||||
* @return returns the current tick.
|
* @return returns the current tick.
|
||||||
*/
|
*/
|
||||||
uint GetTick();
|
static uint GetTick();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the value of one of your settings you set via info.nut.
|
* Get the value of one of your settings you set via info.nut.
|
||||||
* @param name The name of the setting.
|
* @param name The name of the setting.
|
||||||
* @return the value for the setting, or -1 if the setting is not known.
|
* @return the value for the setting, or -1 if the setting is not known.
|
||||||
*/
|
*/
|
||||||
int GetSetting(const char *name);
|
static int GetSetting(const char *name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the minimum amount of time the AI should be put in suspend mode
|
* Change the minimum amount of time the AI should be put in suspend mode
|
||||||
|
|
|
@ -5,10 +5,10 @@
|
||||||
void SQAIController_Register(Squirrel *engine) {
|
void SQAIController_Register(Squirrel *engine) {
|
||||||
DefSQClass <AIController> SQAIController("AIController");
|
DefSQClass <AIController> SQAIController("AIController");
|
||||||
SQAIController.PreRegister(engine);
|
SQAIController.PreRegister(engine);
|
||||||
SQAIController.DefSQMethod(engine, &AIController::GetTick, "GetTick", 1, "x");
|
SQAIController.DefSQStaticMethod(engine, &AIController::GetTick, "GetTick", 1, "?");
|
||||||
SQAIController.DefSQStaticMethod(engine, &AIController::SetCommandDelay, "SetCommandDelay", 2, "xi");
|
SQAIController.DefSQStaticMethod(engine, &AIController::SetCommandDelay, "SetCommandDelay", 2, "?i");
|
||||||
SQAIController.DefSQStaticMethod(engine, &AIController::Sleep, "Sleep", 2, "xi");
|
SQAIController.DefSQStaticMethod(engine, &AIController::Sleep, "Sleep", 2, "?i");
|
||||||
SQAIController.DefSQStaticMethod(engine, &AIController::GetSetting, "GetSetting", 2, "xs");
|
SQAIController.DefSQStaticMethod(engine, &AIController::GetSetting, "GetSetting", 2, "?s");
|
||||||
SQAIController.DefSQStaticMethod(engine, &AIController::Print, "Print", 3, "xbs");
|
SQAIController.DefSQStaticMethod(engine, &AIController::Print, "Print", 3, "?bs");
|
||||||
SQAIController.PostRegister(engine);
|
SQAIController.PostRegister(engine);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue