summaryrefslogtreecommitdiff
path: root/src/ai/ai_scanner.cpp
diff options
context:
space:
mode:
authortruebrain <truebrain@openttd.org>2009-01-15 14:37:44 +0000
committertruebrain <truebrain@openttd.org>2009-01-15 14:37:44 +0000
commitd62a85f2ce2dd7f366b8d3a6610ee70046ee928a (patch)
tree43e5c2a5d42119477518b73b0e303f4b881c8a17 /src/ai/ai_scanner.cpp
parent606ef3c1795b9fefe0e31d0f79a0a336dc3aa1db (diff)
downloadopenttd-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_scanner.cpp')
-rw-r--r--src/ai/ai_scanner.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/ai/ai_scanner.cpp b/src/ai/ai_scanner.cpp
index 2a389fa9d..46a89511b 100644
--- a/src/ai/ai_scanner.cpp
+++ b/src/ai/ai_scanner.cpp
@@ -308,6 +308,13 @@ void AIScanner::RegisterAI(AIInfo *info)
{
const char *ai_name = info->GetDirName();
+ /* Check if GetShortName follows the rules */
+ if (strlen(info->GetShortName()) != 4) {
+ DEBUG(ai, 0, "The AI '%s' returned a string from GetShortName() which is not four characaters. Unable to load the AI.", info->GetDirName());
+ delete info;
+ return;
+ }
+
/* Check if we register twice; than the first always wins */
if (this->info_list.find(ai_name) != this->info_list.end()) {
/* In case they are not the same dir, give a warning */