(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:
@@ -9,11 +9,11 @@
|
||||
#include "ai_config.hpp"
|
||||
#include "ai_info.hpp"
|
||||
|
||||
void AIConfig::ChangeAI(const char *name)
|
||||
void AIConfig::ChangeAI(const char *name, int version)
|
||||
{
|
||||
free((void *)this->name);
|
||||
this->name = (name == NULL) ? NULL : strdup(name);
|
||||
this->info = (name == NULL) ? NULL : AI::GetCompanyInfo(this->name);
|
||||
this->info = (name == NULL) ? NULL : AI::FindInfo(this->name, version);
|
||||
this->version = (info == NULL) ? -1 : info->GetVersion();
|
||||
|
||||
for (SettingValueList::iterator it = this->settings.begin(); it != this->settings.end(); it++) {
|
||||
@@ -45,7 +45,7 @@ AIInfo *AIConfig::GetInfo()
|
||||
|
||||
bool AIConfig::ResetInfo()
|
||||
{
|
||||
this->info = AI::GetCompanyInfo(this->name);
|
||||
this->info = AI::FindInfo(this->name, this->version);
|
||||
return this->info != NULL;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user