From 011257dc8804175dd7d1e839e97e796c0a88aee6 Mon Sep 17 00:00:00 2001 From: Samu Date: Thu, 31 Jan 2019 14:35:13 +0000 Subject: Change: Allow AI companies to start immediately. Allow multiple AIs to possibly start in the same tick. start_date = 0 becomes a special case, where random deviation does not occur. If start_date was not already 0, then a minimum value of 1 must apply. --- src/ai/ai_config.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/ai/ai_config.cpp') diff --git a/src/ai/ai_config.cpp b/src/ai/ai_config.cpp index f920d3101..20e913c2e 100644 --- a/src/ai/ai_config.cpp +++ b/src/ai/ai_config.cpp @@ -118,3 +118,14 @@ void AIConfig::SetSetting(const char *name, int value) ScriptConfig::SetSetting(name, value); } + +void AIConfig::AddRandomDeviation() +{ + int start_date = this->GetSetting("start_date"); + + ScriptConfig::AddRandomDeviation(); + + /* start_date = 0 is a special case, where random deviation does not occur. + * If start_date was not already 0, then a minimum value of 1 must apply. */ + this->SetSetting("start_date", start_date != 0 ? max(1, this->GetSetting("start_date")) : 0); +} -- cgit v1.2.3-54-g00ecf