summaryrefslogtreecommitdiff
path: root/src/script/script_info.cpp
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2009-04-19 15:14:23 +0000
committeryexo <yexo@openttd.org>2009-04-19 15:14:23 +0000
commita91ff2d5e8b0a65da160b93f2aa293d3c54c2ae3 (patch)
tree9b72fe67cc6fc9267cfb13a40999747e5552175c /src/script/script_info.cpp
parentef909252265088d0a3d0949f37d34ddb853a18c7 (diff)
downloadopenttd-a91ff2d5e8b0a65da160b93f2aa293d3c54c2ae3.tar.xz
(svn r16093) -Feature [FS#2808]: Add GetURL() as possible function to info.nut. If AIs implement it, that url is shown when the AI crashes and also in the AI selection window.
Diffstat (limited to 'src/script/script_info.cpp')
-rw-r--r--src/script/script_info.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/script/script_info.cpp b/src/script/script_info.cpp
index 12df08ce5..eaf757553 100644
--- a/src/script/script_info.cpp
+++ b/src/script/script_info.cpp
@@ -19,6 +19,7 @@ ScriptFileInfo::~ScriptFileInfo()
free((void *)this->description);
free((void *)this->date);
free((void *)this->instance_name);
+ free((void *)this->url);
free(this->main_script);
free(this->SQ_instance);
}
@@ -68,5 +69,10 @@ bool ScriptFileInfo::CheckMethod(const char *name) const
if (!info->engine->CallIntegerMethod(*info->SQ_instance, "GetVersion", &info->version)) return SQ_ERROR;
if (!info->engine->CallStringMethodStrdup(*info->SQ_instance, "CreateInstance", &info->instance_name)) return SQ_ERROR;
+ /* The GetURL function is optional. */
+ if (info->engine->MethodExists(*info->SQ_instance, "GetURL")) {
+ if (!info->engine->CallStringMethodStrdup(*info->SQ_instance, "GetURL", &info->url)) return SQ_ERROR;
+ }
+
return 0;
}