(svn r15045) -Add [NoAI API CHANGE]: in info.nut you can now have (optional) a CanLoadFromVersion(version), which should return true/false, to indicate if you can load a savegame made with your AI of version 'version'

-Add [NoAI API CHANGE]: in main.nut the Load() function now should be Load(version, data), where 'version' is the version of your AI which made the savegame
-Codechange [NoAI]: various of function renames to make things more sane
-Add [NoAI]: push the 'version' of the AI through various of layers
-Codechange [NoAI]: various of code cleanups
-Add [NoAI]: store the version of the AI in the savegame too
This commit is contained in:
truebrain
2009-01-13 01:46:46 +00:00
parent 27c0a4c801
commit 5573d9a459
13 changed files with 84 additions and 73 deletions

View File

@@ -211,7 +211,7 @@ void CcAI(bool success, TileIndex tile, uint32 p1, uint32 p2)
}
}
/* static */ void AI::Load(CompanyID company)
/* static */ void AI::Load(CompanyID company, int version)
{
if (!_networking || _network_server) {
assert(IsValidCompanyID(company));
@@ -219,7 +219,7 @@ void CcAI(bool success, TileIndex tile, uint32 p1, uint32 p2)
CompanyID old_company = _current_company;
_current_company = company;
GetCompany(company)->ai_instance->Load();
GetCompany(company)->ai_instance->Load(version);
_current_company = old_company;
} else {
/* Read, but ignore, the load data */
@@ -237,9 +237,9 @@ void CcAI(bool success, TileIndex tile, uint32 p1, uint32 p2)
return AI::ai_scanner->GetAIInfoList();
}
/* static */ AIInfo *AI::GetCompanyInfo(const char *name)
/* static */ AIInfo *AI::FindInfo(const char *name, int version)
{
return AI::ai_scanner->FindAI(name);
return AI::ai_scanner->FindInfo(name, version);
}
/* static */ bool AI::ImportLibrary(const char *library, const char *class_name, int version, HSQUIRRELVM vm)