summaryrefslogtreecommitdiff
path: root/src/ai/ai_info.cpp
diff options
context:
space:
mode:
authortruebrain <truebrain@openttd.org>2009-01-15 18:15:12 +0000
committertruebrain <truebrain@openttd.org>2009-01-15 18:15:12 +0000
commitef62688522218c50bed25bd8383e82365d91cdb0 (patch)
treefe14c05c0a3bd9c3c4546610ab53a830dc6bab9b /src/ai/ai_info.cpp
parenta039ec0d21008668b79509d097b9a6f59ea64977 (diff)
downloadopenttd-ef62688522218c50bed25bd8383e82365d91cdb0.tar.xz
(svn r15095) -Add [NoAI]: allow AI Libraries to be in .tar files (subdir required, as with AIs
-Add [NoAI]: allow multiple versions of the same AI co-exist -Change [NoAI]: updated the whole method of AI (Library) finding and loading; it is now much more clear and transparent -Change [NoAI]: the name of the AI is now the name used by CreateInstance() -Change [NoAI]: make the AI finder a bit more clever, mostly related to version finding
Diffstat (limited to 'src/ai/ai_info.cpp')
-rw-r--r--src/ai/ai_info.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/ai/ai_info.cpp b/src/ai/ai_info.cpp
index 3f275630f..f0a2d5b27 100644
--- a/src/ai/ai_info.cpp
+++ b/src/ai/ai_info.cpp
@@ -25,11 +25,15 @@ AIFileInfo::~AIFileInfo()
free((void *)this->description);
free((void *)this->date);
free((void *)this->instance_name);
- free(this->script_name);
- free(this->dir_name);
+ free(this->main_script);
free(this->SQ_instance);
}
+AILibrary::~AILibrary()
+{
+ free((void *)this->category);
+}
+
const char *AIFileInfo::GetAuthor()
{
if (this->author == NULL) this->author = this->engine->CallStringMethodStrdup(*this->SQ_instance, "GetAuthor");
@@ -98,14 +102,9 @@ bool AIFileInfo::CanLoadFromVersion(int version)
return sq_objtobool(&ret) != 0;
}
-const char *AIFileInfo::GetDirName()
-{
- return this->dir_name;
-}
-
-const char *AIFileInfo::GetScriptName()
+const char *AIFileInfo::GetMainScript()
{
- return this->script_name;
+ return this->main_script;
}
void AIFileInfo::CheckMethods(SQInteger *res, const char *name)
@@ -145,8 +144,7 @@ void AIFileInfo::CheckMethods(SQInteger *res, const char *name)
/* Abort if one method was missing */
if (res != 0) return res;
- info->script_name = strdup(info->base->GetCurrentScript());
- info->dir_name = strdup(info->base->GetCurrentDirName());
+ info->main_script = strdup(info->base->GetMainScript());
return 0;
}