mirror of https://github.com/OpenTTD/OpenTTD
(svn r16253) -Add [NoAI]: AIController::GetVersion, this returns the newgrf-version of OpenTTD
parent
9b4a32deb4
commit
a00b22b1cd
|
@ -5,6 +5,7 @@
|
||||||
#include "../../stdafx.h"
|
#include "../../stdafx.h"
|
||||||
#include "../../string_func.h"
|
#include "../../string_func.h"
|
||||||
#include "../../company_base.h"
|
#include "../../company_base.h"
|
||||||
|
#include "../../rev.h"
|
||||||
#include "table/strings.h"
|
#include "table/strings.h"
|
||||||
|
|
||||||
#include "../ai.hpp"
|
#include "../ai.hpp"
|
||||||
|
@ -66,6 +67,11 @@ AIController::~AIController()
|
||||||
return AIConfig::GetConfig(_current_company)->GetSetting(name);
|
return AIConfig::GetConfig(_current_company)->GetSetting(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* static */ uint AIController::GetVersion()
|
||||||
|
{
|
||||||
|
return _openttd_newgrf_version;
|
||||||
|
}
|
||||||
|
|
||||||
bool AIController::LoadedLibrary(const char *library_name, int *next_number, char *fake_class_name, int fake_class_name_len)
|
bool AIController::LoadedLibrary(const char *library_name, int *next_number, char *fake_class_name, int fake_class_name_len)
|
||||||
{
|
{
|
||||||
LoadedLibraryList::iterator iter = this->loaded_library.find(library_name);
|
LoadedLibraryList::iterator iter = this->loaded_library.find(library_name);
|
||||||
|
|
|
@ -50,6 +50,18 @@ public:
|
||||||
*/
|
*/
|
||||||
static int GetSetting(const char *name);
|
static int GetSetting(const char *name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the OpenTTD version of this executable. The version is formatted
|
||||||
|
* with the bits having the following meaning:
|
||||||
|
* 28-31 major version
|
||||||
|
* 24-27 minor version
|
||||||
|
* 20-23 build
|
||||||
|
* 19 1 if it is a release, 0 if it is not.
|
||||||
|
* 0-18 revision number; 0 when the revision is unknown.
|
||||||
|
* @return The version in newgrf format.
|
||||||
|
*/
|
||||||
|
static uint GetVersion();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
* when you execute a command. Normally in SP this is 1, and in MP it is
|
* when you execute a command. Normally in SP this is 1, and in MP it is
|
||||||
|
|
|
@ -9,6 +9,7 @@ void SQAIController_Register(Squirrel *engine) {
|
||||||
SQAIController.DefSQStaticMethod(engine, &AIController::SetCommandDelay, "SetCommandDelay", 2, ".i");
|
SQAIController.DefSQStaticMethod(engine, &AIController::SetCommandDelay, "SetCommandDelay", 2, ".i");
|
||||||
SQAIController.DefSQStaticMethod(engine, &AIController::Sleep, "Sleep", 2, ".i");
|
SQAIController.DefSQStaticMethod(engine, &AIController::Sleep, "Sleep", 2, ".i");
|
||||||
SQAIController.DefSQStaticMethod(engine, &AIController::GetSetting, "GetSetting", 2, ".s");
|
SQAIController.DefSQStaticMethod(engine, &AIController::GetSetting, "GetSetting", 2, ".s");
|
||||||
|
SQAIController.DefSQStaticMethod(engine, &AIController::GetVersion, "GetVersion", 1, ".");
|
||||||
SQAIController.DefSQStaticMethod(engine, &AIController::Print, "Print", 3, ".bs");
|
SQAIController.DefSQStaticMethod(engine, &AIController::Print, "Print", 3, ".bs");
|
||||||
SQAIController.PostRegister(engine);
|
SQAIController.PostRegister(engine);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue