summaryrefslogtreecommitdiff
path: root/src/saveload
diff options
context:
space:
mode:
authortruebrain <truebrain@openttd.org>2011-11-29 23:26:35 +0000
committertruebrain <truebrain@openttd.org>2011-11-29 23:26:35 +0000
commit34d7f01cccfbb4dcd09f0b68ded513f495fa69ed (patch)
treef7d152f88f52d5c883538a5218138fa3a256dc1e /src/saveload
parentc38c16773ca0bc5c928486b18318eb5b147f8ff0 (diff)
downloadopenttd-34d7f01cccfbb4dcd09f0b68ded513f495fa69ed.tar.xz
(svn r23364) -Codechange: refactor AIConfig, moving it mostly to Scriptconfig
Diffstat (limited to 'src/saveload')
-rw-r--r--src/saveload/ai_sl.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/saveload/ai_sl.cpp b/src/saveload/ai_sl.cpp
index c3a95f89b..cfb90c34c 100644
--- a/src/saveload/ai_sl.cpp
+++ b/src/saveload/ai_sl.cpp
@@ -39,7 +39,7 @@ static void SaveReal_AIPL(int *index_ptr)
CompanyID index = (CompanyID)*index_ptr;
AIConfig *config = AIConfig::GetConfig(index);
- if (config->HasAI()) {
+ if (config->HasScript()) {
ttd_strlcpy(_ai_saveload_name, config->GetName(), lengthof(_ai_saveload_name));
_ai_saveload_version = config->GetVersion();
} else {
@@ -48,7 +48,7 @@ static void SaveReal_AIPL(int *index_ptr)
_ai_saveload_version = -1;
}
- _ai_saveload_is_random = config->IsRandomAI();
+ _ai_saveload_is_random = config->IsRandom();
_ai_saveload_settings[0] = '\0';
config->SettingsToString(_ai_saveload_settings, lengthof(_ai_saveload_settings));
@@ -61,7 +61,7 @@ static void Load_AIPL()
{
/* Free all current data */
for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) {
- AIConfig::GetConfig(c, AIConfig::AISS_FORCE_GAME)->ChangeAI(NULL);
+ AIConfig::GetConfig(c, AIConfig::SSS_FORCE_GAME)->Change(NULL);
}
CompanyID index;
@@ -76,17 +76,17 @@ static void Load_AIPL()
continue;
}
- AIConfig *config = AIConfig::GetConfig(index, AIConfig::AISS_FORCE_GAME);
+ AIConfig *config = AIConfig::GetConfig(index, AIConfig::SSS_FORCE_GAME);
if (StrEmpty(_ai_saveload_name)) {
/* A random AI. */
- config->ChangeAI(NULL, -1, false, true);
+ config->Change(NULL, -1, false, true);
} else {
- config->ChangeAI(_ai_saveload_name, _ai_saveload_version, false, _ai_saveload_is_random);
- if (!config->HasAI()) {
+ config->Change(_ai_saveload_name, _ai_saveload_version, false, _ai_saveload_is_random);
+ if (!config->HasScript()) {
/* No version of the AI available that can load the data. Try to load the
* latest version of the AI instead. */
- config->ChangeAI(_ai_saveload_name, -1, false, _ai_saveload_is_random);
- if (!config->HasAI()) {
+ config->Change(_ai_saveload_name, -1, false, _ai_saveload_is_random);
+ if (!config->HasScript()) {
if (strcmp(_ai_saveload_name, "%_dummy") != 0) {
DEBUG(ai, 0, "The savegame has an AI by the name '%s', version %d which is no longer available.", _ai_saveload_name, _ai_saveload_version);
DEBUG(ai, 0, "A random other AI will be loaded in its place.");