(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.

This commit is contained in:
truebrain
2009-01-15 14:37:44 +00:00
parent 97a835f95f
commit e84138af22
12 changed files with 31 additions and 2 deletions

View File

@@ -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 */