mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	Add option to toggle monthly artifact change in black market (#341)
* Add black market art change as hardcodedFeature
This commit is contained in:
		| @@ -24,8 +24,8 @@ | ||||
| 		"NEGATIVE_LUCK" : false, | ||||
| 		"MAX_HEROES_AVAILABLE_PER_PLAYER" : 16, | ||||
| 		"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 | ||||
| 	}, | ||||
| 	"modules": | ||||
| 	{ | ||||
|   | ||||
| @@ -640,6 +640,8 @@ void CModHandler::loadConfigFromFile (std::string name) | ||||
| 	logGlobal->debugStream() << "\tALL_CREATURES_GET_DOUBLE_MONTHS\t" << settings.ALL_CREATURES_GET_DOUBLE_MONTHS; | ||||
| 	settings.WINNING_HERO_WITH_NO_TROOPS_RETREATS = hardcodedFeatures["WINNING_HERO_WITH_NO_TROOPS_RETREATS"].Bool(); | ||||
| 	logGlobal->debugStream() << "\tWINNING_HERO_WITH_NO_TROOPS_RETREATS\t" << settings.WINNING_HERO_WITH_NO_TROOPS_RETREATS; | ||||
| 	settings.BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE = hardcodedFeatures["BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE"].Bool(); | ||||
| 	logGlobal->debugStream() << "\tBLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE\t" << settings.BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE; | ||||
| 	const JsonNode & gameModules = settings.data["modules"]; | ||||
| 	modules.STACK_EXP = gameModules["STACK_EXPERIENCE"].Bool(); | ||||
|   logGlobal->debugStream() << "\tSTACK_EXP\t" << modules.STACK_EXP; | ||||
|   | ||||
| @@ -267,6 +267,7 @@ public: | ||||
| 		int MAX_HEROES_AVAILABLE_PER_PLAYER; | ||||
| 		int MAX_HEROES_ON_MAP_PER_PLAYER; | ||||
| 		bool WINNING_HERO_WITH_NO_TROOPS_RETREATS; | ||||
| 		bool BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE; | ||||
|  | ||||
| 		template <typename Handler> void serialize(Handler &h, const int version) | ||||
| 		{ | ||||
| @@ -281,6 +282,15 @@ public: | ||||
| 			{ | ||||
| 				WINNING_HERO_WITH_NO_TROOPS_RETREATS = true; | ||||
| 			} | ||||
|  | ||||
| 			if(version >= 776) | ||||
| 			{ | ||||
| 				h & BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE; | ||||
| 			} | ||||
| 			else if(!h.saving) | ||||
| 			{ | ||||
| 				BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE = true; | ||||
| 			} | ||||
| 		} | ||||
| 	} settings; | ||||
|  | ||||
|   | ||||
| @@ -17,6 +17,7 @@ | ||||
| #include "../CCreatureHandler.h" | ||||
| #include "../CGameState.h" | ||||
| #include "CGTownInstance.h" | ||||
| #include "../CModHandler.h" | ||||
|  | ||||
| ///helpers | ||||
| static void openWindow(const OpenWindow::EWindow type, const int id1, const int id2 = -1) | ||||
| @@ -283,6 +284,9 @@ std::vector<int> CGBlackMarket::availableItemsIds(EMarketMode::EMarketMode mode) | ||||
|  | ||||
| void CGBlackMarket::newTurn(CRandomGenerator & rand) const | ||||
| { | ||||
| 	if(!VLC->modh->settings.BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE) //check if feature changing OH3 behavior is enabled | ||||
| 		return; | ||||
|  | ||||
| 	if(cb->getDate(Date::DAY_OF_MONTH) != 1) //new month | ||||
| 		return; | ||||
|  | ||||
|   | ||||
| @@ -12,7 +12,7 @@ | ||||
| #include "../ConstTransitivePtr.h" | ||||
| #include "../GameConstants.h" | ||||
|  | ||||
| const ui32 SERIALIZATION_VERSION = 775; | ||||
| const ui32 SERIALIZATION_VERSION = 776; | ||||
| const ui32 MINIMAL_SERIALIZATION_VERSION = 753; | ||||
| const std::string SAVEGAME_MAGIC = "VCMISVG"; | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user