diff options
author | yexo <yexo@openttd.org> | 2009-02-13 01:24:30 +0000 |
---|---|---|
committer | yexo <yexo@openttd.org> | 2009-02-13 01:24:30 +0000 |
commit | 8eecd774ffb983b75e3be2001e82be117a8b019b (patch) | |
tree | 6d02a4a3e0d1ddab73a6b5bb135d8e5f381237e9 /src/ai | |
parent | 526edf35a595b674bc2bb82f9cdb230cdf684dac (diff) | |
download | openttd-8eecd774ffb983b75e3be2001e82be117a8b019b.tar.xz |
(svn r15463) -Change [API CHANGE]: Replace AIInfo::CanLoadFromVersion(version) with AIInfo::MinVersionToLoad() which should return a single integer, the minimum version the AI is able to load data from.
Diffstat (limited to 'src/ai')
-rw-r--r-- | src/ai/ai_info.cpp | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/src/ai/ai_info.cpp b/src/ai/ai_info.cpp index 0c45c0cce..fd58f8b45 100644 --- a/src/ai/ai_info.cpp +++ b/src/ai/ai_info.cpp @@ -95,23 +95,9 @@ const char *AIFileInfo::GetInstanceName() bool AIFileInfo::CanLoadFromVersion(int version) { if (version == -1) return true; - if (!this->engine->MethodExists(*this->SQ_instance, "CanLoadFromVersion")) return (version == this->GetVersion()); + if (!this->engine->MethodExists(*this->SQ_instance, "MinVersionToLoad")) return (version == this->GetVersion()); - HSQUIRRELVM vm = this->engine->GetVM(); - int top = sq_gettop(vm); - - sq_pushobject(vm, *this->SQ_instance); - sq_pushstring(vm, OTTD2FS("CanLoadFromVersion"), -1); - sq_get(vm, -2); - sq_pushobject(vm, *this->SQ_instance); - sq_pushinteger(vm, version); - sq_call(vm, 2, SQTrue, SQFalse); - - HSQOBJECT ret; - sq_getstackobj(vm, -1, &ret); - - sq_settop(vm, top); - return sq_objtobool(&ret) != 0; + return version >= this->engine->CallIntegerMethod(*this->SQ_instance, "MinVersionToLoad") && version <= this->GetVersion(); } const char *AIFileInfo::GetMainScript() |