(svn r15063) -Fix [NoAI]: starting companies now listen correctly to 'start_date' set to the AI slot (Yexo)

-Add [NoAI]: add a 'deviation' value for all settings, giving a slight deviation of the value of a setting (Yexo)
This commit is contained in:
truebrain
2009-01-13 16:53:03 +00:00
parent 638411c087
commit 39cec4c65f
7 changed files with 88 additions and 32 deletions

View File

@@ -229,20 +229,9 @@ void CcAI(bool success, TileIndex tile, uint32 p1, uint32 p2)
/* static */ int AI::GetStartNextTime()
{
/* Find the first company which doesn't exist yet */
for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) {
if (IsValidCompanyID(c)) continue;
AIConfig *config = AIConfig::GetConfig(c);
if (config->HasAI()) return config->GetSetting("start_date");
/* No AI configured, so fall back to some defaults */
switch (_settings_game.difficulty.diff_level) {
case 0: return AI::START_NEXT_EASY;
case 1: return AI::START_NEXT_MEDIUM;
case 2: return AI::START_NEXT_HARD;
case 3: return AI::START_NEXT_MEDIUM;
default: NOT_REACHED();
}
if (!IsValidCompanyID(c)) return AIConfig::GetConfig(c)->GetSetting("start_date");
}
/* Currently no AI can be started, check again in a year. */