From 28eed7047c43f8ae6a89fd90ec8f2275800088e6 Mon Sep 17 00:00:00 2001 From: Dydzio Date: Thu, 2 Feb 2023 22:50:08 +0100 Subject: [PATCH] Hardcoded feature to allow default towns always have 2nd dwelling --- config/defaultMods.json | 3 ++- lib/CGameState.cpp | 2 +- lib/CModHandler.cpp | 2 ++ lib/CModHandler.h | 2 ++ 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/config/defaultMods.json b/config/defaultMods.json index bcdc0cb53..12a7bad71 100644 --- a/config/defaultMods.json +++ b/config/defaultMods.json @@ -34,7 +34,8 @@ "ATTACK_POINTS_DMG_MULTIPLIER_CAP": 4.0, //limit of damage increase that can be achieved by overpowering attack points "DEFENSE_POINT_DMG_MULTIPLIER": 0.025, //every 1 defense point damage influence in battle when defense points > attack points during creature attack "DEFENSE_POINTS_DMG_MULTIPLIER_CAP": 0.7, //limit of damage reduction that can be achieved by overpowering defense points - "NEW_HERO_ALWAYS_3_CREATURE_STACKS": false + "NEW_HERO_ALWAYS_3_CREATURE_STACKS": false, + "DEFAULT_TOWN_ALWAYS_2_DWELLINGS": false }, "modules": { diff --git a/lib/CGameState.cpp b/lib/CGameState.cpp index f3b181161..18832a5fd 100644 --- a/lib/CGameState.cpp +++ b/lib/CGameState.cpp @@ -1723,7 +1723,7 @@ void CGameState::initTowns() vti->builtBuildings.insert(BuildingID::TAVERN); vti->builtBuildings.insert(BuildingID::DWELL_FIRST); - if(getRandomGenerator().nextInt(1) == 1) + if((getRandomGenerator().nextInt(1) == 1) || VLC->modh->settings.DEFAULT_TOWN_ALWAYS_2_DWELLINGS) { vti->builtBuildings.insert(BuildingID::DWELL_LVL_2); } diff --git a/lib/CModHandler.cpp b/lib/CModHandler.cpp index 447eaaaea..d111be52c 100644 --- a/lib/CModHandler.cpp +++ b/lib/CModHandler.cpp @@ -768,6 +768,8 @@ void CModHandler::loadConfigFromFile (std::string name) logMod->debug("\tDEFENSE_POINTS_DMG_MULTIPLIER_CAP\t%f", settings.DEFENSE_POINTS_DMG_MULTIPLIER_CAP); settings.NEW_HERO_ALWAYS_3_CREATURE_STACKS = hardcodedFeatures["NEW_HERO_ALWAYS_3_CREATURE_STACKS"].Bool(); logMod->debug("\tNEW_HERO_ALWAYS_3_CREATURE_STACKS\t%f", settings.NEW_HERO_ALWAYS_3_CREATURE_STACKS); + settings.DEFAULT_TOWN_ALWAYS_2_DWELLINGS = hardcodedFeatures["DEFAULT_TOWN_ALWAYS_2_DWELLINGS"].Bool(); + logMod->debug("\tDEFAULT_TOWN_ALWAYS_2_DWELLINGS\t%f", settings.DEFAULT_TOWN_ALWAYS_2_DWELLINGS); const JsonNode & gameModules = settings.data["modules"]; modules.STACK_EXP = gameModules["STACK_EXPERIENCE"].Bool(); diff --git a/lib/CModHandler.h b/lib/CModHandler.h index 2fb779e4b..f6829c0cb 100644 --- a/lib/CModHandler.h +++ b/lib/CModHandler.h @@ -364,6 +364,7 @@ public: double DEFENSE_POINT_DMG_MULTIPLIER; double DEFENSE_POINTS_DMG_MULTIPLIER_CAP; bool NEW_HERO_ALWAYS_3_CREATURE_STACKS; + bool DEFAULT_TOWN_ALWAYS_2_DWELLINGS; template void serialize(Handler &h, const int version) { @@ -384,6 +385,7 @@ public: h & DEFENSE_POINT_DMG_MULTIPLIER; h & DEFENSE_POINTS_DMG_MULTIPLIER_CAP; h & NEW_HERO_ALWAYS_3_CREATURE_STACKS; + h & DEFAULT_TOWN_ALWAYS_2_DWELLINGS; } } settings;