From 36cb9f11c43f58a5a85655476e2c07c987f1d246 Mon Sep 17 00:00:00 2001 From: Dydzio Date: Sun, 17 Mar 2019 18:27:05 +0100 Subject: [PATCH] Hardcoded feature: no random week/month effects --- config/defaultMods.json | 3 ++- lib/CModHandler.cpp | 2 ++ lib/CModHandler.h | 10 ++++++++++ lib/serializer/CSerializer.h | 2 +- server/CGameHandler.cpp | 2 +- 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/config/defaultMods.json b/config/defaultMods.json index 70e6b7c12..aea24ff01 100644 --- a/config/defaultMods.json +++ b/config/defaultMods.json @@ -25,7 +25,8 @@ "MAX_HEROES_AVAILABLE_PER_PLAYER" : 16, "MAX_HEROES_ON_MAP_PER_PLAYER" : 8, "WINNING_HERO_WITH_NO_TROOPS_RETREATS": true, - "BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE": true + "BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE": true, + "NO_RANDOM_SPECIAL_WEEKS_AND_MONTHS": false }, "modules": { diff --git a/lib/CModHandler.cpp b/lib/CModHandler.cpp index c9501ee02..fbeb0c037 100644 --- a/lib/CModHandler.cpp +++ b/lib/CModHandler.cpp @@ -663,6 +663,8 @@ void CModHandler::loadConfigFromFile (std::string name) logMod->debug("\tWINNING_HERO_WITH_NO_TROOPS_RETREATS\t%d", static_cast(settings.WINNING_HERO_WITH_NO_TROOPS_RETREATS)); settings.BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE = hardcodedFeatures["BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE"].Bool(); logMod->debug("\tBLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE\t%d", static_cast(settings.BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE)); + settings.NO_RANDOM_SPECIAL_WEEKS_AND_MONTHS = hardcodedFeatures["NO_RANDOM_SPECIAL_WEEKS_AND_MONTHS"].Bool(); + logMod->debug("\tNO_RANDOM_SPECIAL_WEEKS_AND_MONTHS\t%d", static_cast(settings.NO_RANDOM_SPECIAL_WEEKS_AND_MONTHS)); const JsonNode & gameModules = settings.data["modules"]; modules.STACK_EXP = gameModules["STACK_EXPERIENCE"].Bool(); diff --git a/lib/CModHandler.h b/lib/CModHandler.h index 5cefecccf..520827485 100644 --- a/lib/CModHandler.h +++ b/lib/CModHandler.h @@ -284,6 +284,7 @@ public: int MAX_HEROES_ON_MAP_PER_PLAYER; bool WINNING_HERO_WITH_NO_TROOPS_RETREATS; bool BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE; + bool NO_RANDOM_SPECIAL_WEEKS_AND_MONTHS; template void serialize(Handler &h, const int version) { @@ -313,6 +314,15 @@ public: { BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE = true; } + + if(version >= 791) + { + h & NO_RANDOM_SPECIAL_WEEKS_AND_MONTHS; + } + else if(!h.saving) + { + NO_RANDOM_SPECIAL_WEEKS_AND_MONTHS = false; + } } } settings; diff --git a/lib/serializer/CSerializer.h b/lib/serializer/CSerializer.h index dc723b538..9ff22e957 100644 --- a/lib/serializer/CSerializer.h +++ b/lib/serializer/CSerializer.h @@ -12,7 +12,7 @@ #include "../ConstTransitivePtr.h" #include "../GameConstants.h" -const ui32 SERIALIZATION_VERSION = 790; +const ui32 SERIALIZATION_VERSION = 791; const ui32 MINIMAL_SERIALIZATION_VERSION = 753; const std::string SAVEGAME_MAGIC = "VCMISVG"; diff --git a/server/CGameHandler.cpp b/server/CGameHandler.cpp index 257c22bb9..8329ac97f 100644 --- a/server/CGameHandler.cpp +++ b/server/CGameHandler.cpp @@ -1641,7 +1641,7 @@ void CGameHandler::newTurn() n.specialWeek = NewTurn::DEITYOFFIRE; n.creatureid = CreatureID::IMP; } - else + else if(!VLC->modh->settings.NO_RANDOM_SPECIAL_WEEKS_AND_MONTHS) { int monthType = getRandomGenerator().nextInt(99); if (newMonth) //new month