From 0cf9ecafa5a2a1faa1921979a0515fb2992455e7 Mon Sep 17 00:00:00 2001 From: pelya Date: Fri, 20 Mar 2020 00:15:51 +0200 Subject: [PATCH] Fixed bad merge --- src/ai/ai_config.cpp | 11 +++++++++++ src/script/script_config.hpp | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/ai/ai_config.cpp b/src/ai/ai_config.cpp index c3c9a5c205..2afa69d39e 100644 --- a/src/ai/ai_config.cpp +++ b/src/ai/ai_config.cpp @@ -125,3 +125,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); +} diff --git a/src/script/script_config.hpp b/src/script/script_config.hpp index adadcd35c9..31004caba7 100644 --- a/src/script/script_config.hpp +++ b/src/script/script_config.hpp @@ -137,7 +137,7 @@ public: /** * Randomize all settings the Script requested to be randomized. */ - void AddRandomDeviation(); + virtual void AddRandomDeviation(); /** * Is this config attached to an Script? In other words, is there a Script