1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

Merge pull request #556 from dydzio0614/NoRandomMonths

Hardcoded feature: no random week/month effects
This commit is contained in:
Alexander Shishkin 2019-03-21 06:24:02 +03:00 committed by GitHub
commit 61c8d78846
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 3 deletions

View File

@ -25,7 +25,8 @@
"MAX_HEROES_AVAILABLE_PER_PLAYER" : 16, "MAX_HEROES_AVAILABLE_PER_PLAYER" : 16,
"MAX_HEROES_ON_MAP_PER_PLAYER" : 8, "MAX_HEROES_ON_MAP_PER_PLAYER" : 8,
"WINNING_HERO_WITH_NO_TROOPS_RETREATS": true, "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": "modules":
{ {

View File

@ -663,6 +663,8 @@ void CModHandler::loadConfigFromFile (std::string name)
logMod->debug("\tWINNING_HERO_WITH_NO_TROOPS_RETREATS\t%d", static_cast<int>(settings.WINNING_HERO_WITH_NO_TROOPS_RETREATS)); logMod->debug("\tWINNING_HERO_WITH_NO_TROOPS_RETREATS\t%d", static_cast<int>(settings.WINNING_HERO_WITH_NO_TROOPS_RETREATS));
settings.BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE = hardcodedFeatures["BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE"].Bool(); settings.BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE = hardcodedFeatures["BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE"].Bool();
logMod->debug("\tBLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE\t%d", static_cast<int>(settings.BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE)); logMod->debug("\tBLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE\t%d", static_cast<int>(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<int>(settings.NO_RANDOM_SPECIAL_WEEKS_AND_MONTHS));
const JsonNode & gameModules = settings.data["modules"]; const JsonNode & gameModules = settings.data["modules"];
modules.STACK_EXP = gameModules["STACK_EXPERIENCE"].Bool(); modules.STACK_EXP = gameModules["STACK_EXPERIENCE"].Bool();

View File

@ -284,6 +284,7 @@ public:
int MAX_HEROES_ON_MAP_PER_PLAYER; int MAX_HEROES_ON_MAP_PER_PLAYER;
bool WINNING_HERO_WITH_NO_TROOPS_RETREATS; bool WINNING_HERO_WITH_NO_TROOPS_RETREATS;
bool BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE; bool BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE;
bool NO_RANDOM_SPECIAL_WEEKS_AND_MONTHS;
template <typename Handler> void serialize(Handler &h, const int version) template <typename Handler> void serialize(Handler &h, const int version)
{ {
@ -313,6 +314,15 @@ public:
{ {
BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE = true; 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; } settings;

View File

@ -12,7 +12,7 @@
#include "../ConstTransitivePtr.h" #include "../ConstTransitivePtr.h"
#include "../GameConstants.h" #include "../GameConstants.h"
const ui32 SERIALIZATION_VERSION = 790; const ui32 SERIALIZATION_VERSION = 791;
const ui32 MINIMAL_SERIALIZATION_VERSION = 753; const ui32 MINIMAL_SERIALIZATION_VERSION = 753;
const std::string SAVEGAME_MAGIC = "VCMISVG"; const std::string SAVEGAME_MAGIC = "VCMISVG";

View File

@ -1641,7 +1641,7 @@ void CGameHandler::newTurn()
n.specialWeek = NewTurn::DEITYOFFIRE; n.specialWeek = NewTurn::DEITYOFFIRE;
n.creatureid = CreatureID::IMP; n.creatureid = CreatureID::IMP;
} }
else else if(!VLC->modh->settings.NO_RANDOM_SPECIAL_WEEKS_AND_MONTHS)
{ {
int monthType = getRandomGenerator().nextInt(99); int monthType = getRandomGenerator().nextInt(99);
if (newMonth) //new month if (newMonth) //new month