diff options
author | truebrain <truebrain@openttd.org> | 2009-01-15 14:37:44 +0000 |
---|---|---|
committer | truebrain <truebrain@openttd.org> | 2009-01-15 14:37:44 +0000 |
commit | d62a85f2ce2dd7f366b8d3a6610ee70046ee928a (patch) | |
tree | 43e5c2a5d42119477518b73b0e303f4b881c8a17 /src/ai/ai_info.cpp | |
parent | 606ef3c1795b9fefe0e31d0f79a0a336dc3aa1db (diff) | |
download | openttd-d62a85f2ce2dd7f366b8d3a6610ee70046ee928a.tar.xz |
(svn r15090) -Add [NoAI] [API CHANGE]: info.nut/library.nut now requires a function GetShortName(), which should return a 4 (four) character string, unique throughout the world. This id is simular to a GRFid.
Diffstat (limited to 'src/ai/ai_info.cpp')
-rw-r--r-- | src/ai/ai_info.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/ai/ai_info.cpp b/src/ai/ai_info.cpp index b2c653826..a9bf22eae 100644 --- a/src/ai/ai_info.cpp +++ b/src/ai/ai_info.cpp @@ -42,6 +42,12 @@ const char *AIFileInfo::GetName() return this->name; } +const char *AIFileInfo::GetShortName() +{ + if (this->short_name == NULL) this->short_name = this->engine->CallStringMethodStrdup(*this->SQ_instance, "GetShortName"); + return this->short_name; +} + const char *AIFileInfo::GetDescription() { if (this->description == NULL) this->description = this->engine->CallStringMethodStrdup(*this->SQ_instance, "GetDescription"); @@ -106,7 +112,7 @@ void AIFileInfo::CheckMethods(SQInteger *res, const char *name) { if (!this->engine->MethodExists(*this->SQ_instance, name)) { char error[1024]; - snprintf(error, sizeof(error), "your AIFileInfo doesn't have the method '%s'", name); + snprintf(error, sizeof(error), "your info.nut/library.nut doesn't have the method '%s'", name); this->engine->ThrowError(error); *res = SQ_ERROR; } @@ -127,6 +133,7 @@ void AIFileInfo::CheckMethods(SQInteger *res, const char *name) /* Check if all needed fields are there */ info->CheckMethods(&res, "GetAuthor"); info->CheckMethods(&res, "GetName"); + info->CheckMethods(&res, "GetShortName"); info->CheckMethods(&res, "GetDescription"); info->CheckMethods(&res, "GetVersion"); info->CheckMethods(&res, "GetDate"); |