mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	- reordered files in cmake so files with long compile times will be
compiled first. - changed format of modSettings.json, VCMI should properly update file on the first run. - implemented property "defaultTavern" that acts as default value for "tavern" entry in hero class and town formats.
This commit is contained in:
		| @@ -4,10 +4,10 @@ cmake_minimum_required(VERSION 2.6) | |||||||
| include_directories(${Boost_INCLUDE_DIRS} ${CMAKE_HOME_DIRECTORY} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/lib ${CMAKE_HOME_DIRECTORY}/AI/FuzzyLite) | include_directories(${Boost_INCLUDE_DIRS} ${CMAKE_HOME_DIRECTORY} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/lib ${CMAKE_HOME_DIRECTORY}/AI/FuzzyLite) | ||||||
|  |  | ||||||
| set(VCAI_SRCS | set(VCAI_SRCS | ||||||
|         AIUtility.cpp |  | ||||||
|         Goals.cpp |  | ||||||
|         main.cpp |  | ||||||
|         VCAI.cpp |         VCAI.cpp | ||||||
|  |         Goals.cpp | ||||||
|  |         AIUtility.cpp | ||||||
|  |         main.cpp | ||||||
|         Fuzzy.cpp |         Fuzzy.cpp | ||||||
| ) | ) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -136,14 +136,14 @@ add_definitions(-DM_LIB_DIR="${CMAKE_INSTALL_PREFIX}/${LIB_DIR}") | |||||||
| SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/vcmi") | SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/vcmi") | ||||||
| SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) | SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) | ||||||
|  |  | ||||||
|  | if (ENABLE_ERM) | ||||||
|  |         add_subdirectory(scripting/erm) | ||||||
|  | endif() | ||||||
| add_subdirectory(lib) | add_subdirectory(lib) | ||||||
| add_subdirectory(lib/minizip) |  | ||||||
| add_subdirectory(client) | add_subdirectory(client) | ||||||
|  | add_subdirectory(lib/minizip) | ||||||
| add_subdirectory(server) | add_subdirectory(server) | ||||||
| add_subdirectory(AI) | add_subdirectory(AI) | ||||||
| if (ENABLE_ERM) |  | ||||||
| 	add_subdirectory(scripting/erm) |  | ||||||
| endif() |  | ||||||
| if (ENABLE_EDITOR) | if (ENABLE_EDITOR) | ||||||
| 	add_subdirectory(editor) | 	add_subdirectory(editor) | ||||||
| endif() | endif() | ||||||
|   | |||||||
| @@ -716,7 +716,6 @@ | |||||||
| 			"defend": "BGORDFND.wav", | 			"defend": "BGORDFND.wav", | ||||||
| 			"killed": "BGORKILL.wav", | 			"killed": "BGORKILL.wav", | ||||||
| 			"move": "BGORMOVE.wav", | 			"move": "BGORMOVE.wav", | ||||||
| 			"shoot": "BGORSHOT.wav", |  | ||||||
| 			"wince": "BGORWNCE.wav" | 			"wince": "BGORWNCE.wav" | ||||||
| 		} | 		} | ||||||
| 	}, | 	}, | ||||||
| @@ -1488,7 +1487,6 @@ | |||||||
| 			"defend": "BGORDFND.wav", | 			"defend": "BGORDFND.wav", | ||||||
| 			"killed": "BGORKILL.wav", | 			"killed": "BGORKILL.wav", | ||||||
| 			"move": "BGORMOVE.wav", | 			"move": "BGORMOVE.wav", | ||||||
| 			"shoot": "BGORSHOT.wav", |  | ||||||
| 			"wince": "BGORWNCE.wav" | 			"wince": "BGORWNCE.wav" | ||||||
| 		} | 		} | ||||||
| 	}, | 	}, | ||||||
|   | |||||||
| @@ -6,9 +6,15 @@ include_directories(${SDL_INCLUDE_DIR} ${SDLIMAGE_INCLUDE_DIR} ${SDLMIXER_INCLUD | |||||||
| include_directories(${Boost_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR} ${FFMPEG_INCLUDE_DIRS}) | include_directories(${Boost_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR} ${FFMPEG_INCLUDE_DIRS}) | ||||||
|  |  | ||||||
| set(client_SRCS | set(client_SRCS | ||||||
|  |         CPreGame.cpp | ||||||
|  |         Client.cpp | ||||||
|  |         CPlayerInterface.cpp | ||||||
|  |         CMT.cpp | ||||||
|  |         GUIClasses.cpp | ||||||
|  |         battle/CBattleInterface.cpp | ||||||
|  |  | ||||||
|         ../CCallback.cpp |         ../CCallback.cpp | ||||||
|         battle/CBattleAnimations.cpp |         battle/CBattleAnimations.cpp | ||||||
|         battle/CBattleInterface.cpp |  | ||||||
|         battle/CBattleInterfaceClasses.cpp |         battle/CBattleInterfaceClasses.cpp | ||||||
|         battle/CCreatureAnimation.cpp |         battle/CCreatureAnimation.cpp | ||||||
|         gui/CGuiHandler.cpp |         gui/CGuiHandler.cpp | ||||||
| @@ -28,17 +34,12 @@ set(client_SRCS | |||||||
|         CGameInfo.cpp |         CGameInfo.cpp | ||||||
|         CHeroWindow.cpp |         CHeroWindow.cpp | ||||||
|         CKingdomInterface.cpp |         CKingdomInterface.cpp | ||||||
|         Client.cpp |  | ||||||
|         CMessage.cpp |         CMessage.cpp | ||||||
|         CMT.cpp |  | ||||||
|         CMusicHandler.cpp |         CMusicHandler.cpp | ||||||
|         CPlayerInterface.cpp |  | ||||||
|         CPreGame.cpp |  | ||||||
|         CSpellWindow.cpp |         CSpellWindow.cpp | ||||||
|         CVideoHandler.cpp |         CVideoHandler.cpp | ||||||
|         CQuestLog.cpp |         CQuestLog.cpp | ||||||
|         Graphics.cpp |         Graphics.cpp | ||||||
|         GUIClasses.cpp |  | ||||||
|         mapHandler.cpp |         mapHandler.cpp | ||||||
|         NetPacksClient.cpp |         NetPacksClient.cpp | ||||||
| ) | ) | ||||||
|   | |||||||
| @@ -116,6 +116,7 @@ | |||||||
| 			}, | 			}, | ||||||
|  |  | ||||||
| 			"musicTheme" : "music/CstleTown", | 			"musicTheme" : "music/CstleTown", | ||||||
|  | 			"defaultTavern" : 5, | ||||||
|  |  | ||||||
| 			"townBackground": "TBCSBACK.bmp", | 			"townBackground": "TBCSBACK.bmp", | ||||||
| 			"guildWindow": "TPMAGECS.bmp", | 			"guildWindow": "TPMAGECS.bmp", | ||||||
|   | |||||||
| @@ -120,6 +120,7 @@ | |||||||
| 			}, | 			}, | ||||||
|  |  | ||||||
| 			"musicTheme" : "music/ElemTown", | 			"musicTheme" : "music/ElemTown", | ||||||
|  | 			"defaultTavern" : 5, | ||||||
|  |  | ||||||
| 			"townBackground": "TBELBACK.bmp", | 			"townBackground": "TBELBACK.bmp", | ||||||
| 			"guildWindow": "TPMAGEEL.bmp", | 			"guildWindow": "TPMAGEEL.bmp", | ||||||
|   | |||||||
| @@ -115,6 +115,7 @@ | |||||||
| 			}, | 			}, | ||||||
|  |  | ||||||
| 			"musicTheme" : "music/Dungeon", | 			"musicTheme" : "music/Dungeon", | ||||||
|  | 			"defaultTavern" : 5, | ||||||
|  |  | ||||||
| 			"townBackground": "TBDNBACK.bmp", | 			"townBackground": "TBDNBACK.bmp", | ||||||
| 			"guildWindow": "TPMAGEDN.bmp", | 			"guildWindow": "TPMAGEDN.bmp", | ||||||
|   | |||||||
| @@ -116,6 +116,7 @@ | |||||||
| 			}, | 			}, | ||||||
|  |  | ||||||
| 			"musicTheme" : "music/FortressTown", | 			"musicTheme" : "music/FortressTown", | ||||||
|  | 			"defaultTavern" : 5, | ||||||
|  |  | ||||||
| 			"townBackground": "TBFRBACK.bmp", | 			"townBackground": "TBFRBACK.bmp", | ||||||
| 			"guildWindow": "TPMAGEFR.bmp", | 			"guildWindow": "TPMAGEFR.bmp", | ||||||
|   | |||||||
| @@ -116,6 +116,7 @@ | |||||||
| 			}, | 			}, | ||||||
|  |  | ||||||
| 			"musicTheme" : "music/InfernoTown", | 			"musicTheme" : "music/InfernoTown", | ||||||
|  | 			"defaultTavern" : 5, | ||||||
|  |  | ||||||
| 			"townBackground": "TBINBACK.bmp", | 			"townBackground": "TBINBACK.bmp", | ||||||
| 			"guildWindow": "TPMAGEIN.bmp", | 			"guildWindow": "TPMAGEIN.bmp", | ||||||
|   | |||||||
| @@ -120,6 +120,7 @@ | |||||||
| 			}, | 			}, | ||||||
|  |  | ||||||
| 			"musicTheme" : "music/NecroTown", | 			"musicTheme" : "music/NecroTown", | ||||||
|  | 			"defaultTavern" : 5, | ||||||
|  |  | ||||||
| 			"townBackground": "TBNCBACK.bmp", | 			"townBackground": "TBNCBACK.bmp", | ||||||
| 			"guildWindow": "TPMAGENC.bmp", | 			"guildWindow": "TPMAGENC.bmp", | ||||||
|   | |||||||
| @@ -120,6 +120,7 @@ | |||||||
| 			}, | 			}, | ||||||
|  |  | ||||||
| 			"musicTheme" : "music/Rampart", | 			"musicTheme" : "music/Rampart", | ||||||
|  | 			"defaultTavern" : 5, | ||||||
|  |  | ||||||
| 			"townBackground": "TBRMBACK.bmp", | 			"townBackground": "TBRMBACK.bmp", | ||||||
| 			"guildWindow": "TPMAGERM.bmp", | 			"guildWindow": "TPMAGERM.bmp", | ||||||
|   | |||||||
| @@ -114,6 +114,7 @@ | |||||||
| 			}, | 			}, | ||||||
|  |  | ||||||
| 			"musicTheme" : "music/Stronghold", | 			"musicTheme" : "music/Stronghold", | ||||||
|  | 			"defaultTavern" : 5, | ||||||
|  |  | ||||||
| 			"townBackground": "TBSTBACK.bmp", | 			"townBackground": "TBSTBACK.bmp", | ||||||
| 			"guildWindow": "TPMAGEST.bmp", | 			"guildWindow": "TPMAGEST.bmp", | ||||||
|   | |||||||
| @@ -115,6 +115,7 @@ | |||||||
| 			}, | 			}, | ||||||
|  |  | ||||||
| 			"musicTheme" : "music/TowerTown", | 			"musicTheme" : "music/TowerTown", | ||||||
|  | 			"defaultTavern" : 5, | ||||||
|  |  | ||||||
| 			"townBackground": "TBTWBACK.bmp", | 			"townBackground": "TBTWBACK.bmp", | ||||||
| 			"guildWindow": "TPMAGETW.bmp", | 			"guildWindow": "TPMAGETW.bmp", | ||||||
|   | |||||||
| @@ -3,6 +3,7 @@ | |||||||
| 	{ | 	{ | ||||||
| 		"index": 0, | 		"index": 0, | ||||||
| 		"faction" : "castle", | 		"faction" : "castle", | ||||||
|  | 		"defaultTavern" : 5, | ||||||
| 		"animation": | 		"animation": | ||||||
| 		{ | 		{ | ||||||
| 			"battle" : { "male" : "CH00.DEF",  "female" : "CH01.DEF" }, | 			"battle" : { "male" : "CH00.DEF",  "female" : "CH01.DEF" }, | ||||||
| @@ -13,6 +14,7 @@ | |||||||
| 	{ | 	{ | ||||||
| 		"index": 1, | 		"index": 1, | ||||||
| 		"faction" : "castle", | 		"faction" : "castle", | ||||||
|  | 		"defaultTavern" : 5, | ||||||
| 		"animation": | 		"animation": | ||||||
| 		{ | 		{ | ||||||
| 			"battle" : { "male" : "CH00.DEF",  "female" : "CH01.DEF" }, | 			"battle" : { "male" : "CH00.DEF",  "female" : "CH01.DEF" }, | ||||||
| @@ -23,6 +25,7 @@ | |||||||
| 	{ | 	{ | ||||||
| 		"index": 2, | 		"index": 2, | ||||||
| 		"faction" : "rampart", | 		"faction" : "rampart", | ||||||
|  | 		"defaultTavern" : 5, | ||||||
| 		"animation": | 		"animation": | ||||||
| 		{ | 		{ | ||||||
| 			"battle" : { "male" : "CH02.DEF",  "female" : "CH03.DEF" }, | 			"battle" : { "male" : "CH02.DEF",  "female" : "CH03.DEF" }, | ||||||
| @@ -33,6 +36,7 @@ | |||||||
| 	{ | 	{ | ||||||
| 		"index": 3, | 		"index": 3, | ||||||
| 		"faction" : "rampart", | 		"faction" : "rampart", | ||||||
|  | 		"defaultTavern" : 5, | ||||||
| 		"animation": | 		"animation": | ||||||
| 		{ | 		{ | ||||||
| 			"battle" : { "male" : "CH02.DEF",  "female" : "CH03.DEF" }, | 			"battle" : { "male" : "CH02.DEF",  "female" : "CH03.DEF" }, | ||||||
| @@ -43,6 +47,7 @@ | |||||||
| 	{ | 	{ | ||||||
| 		"index": 4, | 		"index": 4, | ||||||
| 		"faction" : "tower", | 		"faction" : "tower", | ||||||
|  | 		"defaultTavern" : 5, | ||||||
| 		"animation": | 		"animation": | ||||||
| 		{ | 		{ | ||||||
| 			"battle" : { "male" : "CH05.DEF",  "female" : "CH04.DEF" }, | 			"battle" : { "male" : "CH05.DEF",  "female" : "CH04.DEF" }, | ||||||
| @@ -53,6 +58,7 @@ | |||||||
| 	{ | 	{ | ||||||
| 		"index": 5, | 		"index": 5, | ||||||
| 		"faction" : "tower", | 		"faction" : "tower", | ||||||
|  | 		"defaultTavern" : 5, | ||||||
| 		"animation": | 		"animation": | ||||||
| 		{ | 		{ | ||||||
| 			"battle" : { "male" : "CH05.DEF",  "female" : "CH04.DEF" }, | 			"battle" : { "male" : "CH05.DEF",  "female" : "CH04.DEF" }, | ||||||
| @@ -63,6 +69,7 @@ | |||||||
| 	{ | 	{ | ||||||
| 		"index": 6, | 		"index": 6, | ||||||
| 		"faction" : "inferno", | 		"faction" : "inferno", | ||||||
|  | 		"defaultTavern" : 5, | ||||||
| 		"animation": | 		"animation": | ||||||
| 		{ | 		{ | ||||||
| 			"battle" : { "male" : "CH06.DEF",  "female" : "CH07.DEF" }, | 			"battle" : { "male" : "CH06.DEF",  "female" : "CH07.DEF" }, | ||||||
| @@ -73,6 +80,7 @@ | |||||||
| 	{ | 	{ | ||||||
| 		"index": 7, | 		"index": 7, | ||||||
| 		"faction" : "inferno", | 		"faction" : "inferno", | ||||||
|  | 		"defaultTavern" : 5, | ||||||
| 		"animation": | 		"animation": | ||||||
| 		{ | 		{ | ||||||
| 			"battle" : { "male" : "CH06.DEF",  "female" : "CH07.DEF" }, | 			"battle" : { "male" : "CH06.DEF",  "female" : "CH07.DEF" }, | ||||||
| @@ -83,6 +91,7 @@ | |||||||
| 	{ | 	{ | ||||||
| 		"index": 8, | 		"index": 8, | ||||||
| 		"faction" : "necropolis", | 		"faction" : "necropolis", | ||||||
|  | 		"defaultTavern" : 5, | ||||||
| 		"animation": | 		"animation": | ||||||
| 		{ | 		{ | ||||||
| 			"battle" : { "male" : "CH08.DEF",  "female" : "CH09.DEF" }, | 			"battle" : { "male" : "CH08.DEF",  "female" : "CH09.DEF" }, | ||||||
| @@ -93,6 +102,7 @@ | |||||||
| 	{ | 	{ | ||||||
| 		"index": 9, | 		"index": 9, | ||||||
| 		"faction" : "necropolis", | 		"faction" : "necropolis", | ||||||
|  | 		"defaultTavern" : 5, | ||||||
| 		"animation": | 		"animation": | ||||||
| 		{ | 		{ | ||||||
| 			"battle" : { "male" : "CH08.DEF",  "female" : "CH09.DEF" }, | 			"battle" : { "male" : "CH08.DEF",  "female" : "CH09.DEF" }, | ||||||
| @@ -103,6 +113,7 @@ | |||||||
| 	{ | 	{ | ||||||
| 		"index": 10, | 		"index": 10, | ||||||
| 		"faction" : "dungeon", | 		"faction" : "dungeon", | ||||||
|  | 		"defaultTavern" : 5, | ||||||
| 		"animation": | 		"animation": | ||||||
| 		{ | 		{ | ||||||
| 			"battle" : { "male" : "CH010.DEF", "female" : "CH11.DEF" }, | 			"battle" : { "male" : "CH010.DEF", "female" : "CH11.DEF" }, | ||||||
| @@ -113,6 +124,7 @@ | |||||||
| 	{ | 	{ | ||||||
| 		"index": 11, | 		"index": 11, | ||||||
| 		"faction" : "dungeon", | 		"faction" : "dungeon", | ||||||
|  | 		"defaultTavern" : 5, | ||||||
| 		"animation": | 		"animation": | ||||||
| 		{ | 		{ | ||||||
| 			"battle" : { "male" : "CH010.DEF", "female" : "CH11.DEF" }, | 			"battle" : { "male" : "CH010.DEF", "female" : "CH11.DEF" }, | ||||||
| @@ -123,6 +135,7 @@ | |||||||
| 	{ | 	{ | ||||||
| 		"index": 12, | 		"index": 12, | ||||||
| 		"faction" : "stronghold", | 		"faction" : "stronghold", | ||||||
|  | 		"defaultTavern" : 5, | ||||||
| 		"animation": | 		"animation": | ||||||
| 		{ | 		{ | ||||||
| 			"battle" : { "male" : "CH013.DEF", "female" : "CH012.DEF" }, | 			"battle" : { "male" : "CH013.DEF", "female" : "CH012.DEF" }, | ||||||
| @@ -133,6 +146,7 @@ | |||||||
| 	{ | 	{ | ||||||
| 		"index": 13, | 		"index": 13, | ||||||
| 		"faction" : "stronghold", | 		"faction" : "stronghold", | ||||||
|  | 		"defaultTavern" : 5, | ||||||
| 		"animation": | 		"animation": | ||||||
| 		{ | 		{ | ||||||
| 			"battle" : { "male" : "CH013.DEF", "female" : "CH012.DEF" }, | 			"battle" : { "male" : "CH013.DEF", "female" : "CH012.DEF" }, | ||||||
| @@ -143,6 +157,7 @@ | |||||||
| 	{ | 	{ | ||||||
| 		"index": 14, | 		"index": 14, | ||||||
| 		"faction" : "fortress", | 		"faction" : "fortress", | ||||||
|  | 		"defaultTavern" : 5, | ||||||
| 		"animation": | 		"animation": | ||||||
| 		{ | 		{ | ||||||
| 			"battle" : { "male" : "CH014.DEF", "female" : "CH015.DEF" }, | 			"battle" : { "male" : "CH014.DEF", "female" : "CH015.DEF" }, | ||||||
| @@ -153,6 +168,7 @@ | |||||||
| 	{ | 	{ | ||||||
| 		"index": 15, | 		"index": 15, | ||||||
| 		"faction" : "fortress", | 		"faction" : "fortress", | ||||||
|  | 		"defaultTavern" : 5, | ||||||
| 		"animation": | 		"animation": | ||||||
| 		{ | 		{ | ||||||
| 			"battle" : { "male" : "CH014.DEF", "female" : "CH015.DEF" }, | 			"battle" : { "male" : "CH014.DEF", "female" : "CH015.DEF" }, | ||||||
| @@ -163,6 +179,7 @@ | |||||||
| 	{ | 	{ | ||||||
| 		"index": 16, | 		"index": 16, | ||||||
| 		"faction" : "conflux", | 		"faction" : "conflux", | ||||||
|  | 		"defaultTavern" : 5, | ||||||
| 		"animation": | 		"animation": | ||||||
| 		{ | 		{ | ||||||
| 			"battle" : { "male" : "CH16.DEF",  "female" : "CH17.DEF" }, | 			"battle" : { "male" : "CH16.DEF",  "female" : "CH17.DEF" }, | ||||||
| @@ -173,6 +190,7 @@ | |||||||
| 	{ | 	{ | ||||||
| 		"index": 17, | 		"index": 17, | ||||||
| 		"faction" : "conflux", | 		"faction" : "conflux", | ||||||
|  | 		"defaultTavern" : 5, | ||||||
| 		"animation": | 		"animation": | ||||||
| 		{ | 		{ | ||||||
| 			"battle" : { "male" : "CH16.DEF",  "female" : "CH17.DEF" }, | 			"battle" : { "male" : "CH16.DEF",  "female" : "CH17.DEF" }, | ||||||
|   | |||||||
| @@ -109,7 +109,7 @@ | |||||||
| 			"additionalProperties" : false, | 			"additionalProperties" : false, | ||||||
| 			"required" : [ | 			"required" : [ | ||||||
| 				"adventureMap", "buildingsIcons", "buildings", "creatures", "guildWindow", "names", | 				"adventureMap", "buildingsIcons", "buildings", "creatures", "guildWindow", "names", | ||||||
| 				"hallBackground", "hallSlots", "horde", "mageGuild", "moatDamage", | 				"hallBackground", "hallSlots", "horde", "mageGuild", "moatDamage", "defaultTavern", | ||||||
| 				"musicTheme", "siege", "structures", "townBackground", "warMachine" | 				"musicTheme", "siege", "structures", "townBackground", "warMachine" | ||||||
| 			], | 			], | ||||||
| 			"description": "town", | 			"description": "town", | ||||||
| @@ -158,12 +158,18 @@ | |||||||
| 					"additionalProperties" : { | 					"additionalProperties" : { | ||||||
| 						"type" : "number" | 						"type" : "number" | ||||||
| 					} | 					} | ||||||
|  | 				},				 | ||||||
|  | 				"defaultTavern" : { | ||||||
|  | 					"type" : "number", | ||||||
|  | 					"description" : "Default chance for hero to appear in tavern, used only when value vas not set in tavern field", | ||||||
|  | 					"minimum" : 0 | ||||||
| 				}, | 				}, | ||||||
| 				"tavern" : { | 				"tavern" : { | ||||||
| 					"type" : "object", | 					"type" : "object", | ||||||
| 					"description" : "Hero classes available in tavern. Value indicates chance for hero of this class to appear", | 					"description" : "Hero classes available in tavern. Value indicates chance for hero of this class to appear", | ||||||
| 					"additionalProperties" : { | 					"additionalProperties" : { | ||||||
| 						"type" : "number" | 						"type" : "number", | ||||||
|  | 						"minimum" : 0 | ||||||
| 					} | 					} | ||||||
| 				}, | 				}, | ||||||
| 				"names" : { | 				"names" : { | ||||||
|   | |||||||
| @@ -5,7 +5,7 @@ | |||||||
| 	"description" : "Format used to define classes of heroes in VCMI", | 	"description" : "Format used to define classes of heroes in VCMI", | ||||||
| 	"required" : [ | 	"required" : [ | ||||||
| 		"animation", "faction", "highLevelChance", "lowLevelChance", | 		"animation", "faction", "highLevelChance", "lowLevelChance", | ||||||
| 		"name", "primarySkills", "secondarySkills", "tavern" | 		"name", "primarySkills", "secondarySkills", "tavern", "defaultTavern" | ||||||
| 	], | 	], | ||||||
|  |  | ||||||
| 	"additionalProperties" : false, | 	"additionalProperties" : false, | ||||||
| @@ -94,11 +94,18 @@ | |||||||
| 				"type":"number" | 				"type":"number" | ||||||
| 			} | 			} | ||||||
| 		}, | 		}, | ||||||
|  | 		"defaultTavern" : { | ||||||
|  | 			"type" : "number", | ||||||
|  | 			"description" : "Default chance for hero to appear in tavern, used only when value vas not set in tavern field", | ||||||
|  | 			"minimum" : 0 | ||||||
|  | 		}, | ||||||
|  |  | ||||||
| 		"tavern": { | 		"tavern": { | ||||||
| 			"type":"object", | 			"type":"object", | ||||||
| 			"description": "Chance for this hero to appear in tavern of this factions. Reversed version of field \"tavern\" from town format", | 			"description": "Chance for this hero to appear in tavern of this factions. Reversed version of field \"tavern\" from town format", | ||||||
| 			"additionalProperties":{ | 			"additionalProperties":{ | ||||||
| 				"type":"number" | 				"type":"number", | ||||||
|  | 				"minimum" : 0 | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								debian/control
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								debian/control
									
									
									
									
										vendored
									
									
								
							| @@ -2,7 +2,7 @@ Source: vcmi | |||||||
| Section: games | Section: games | ||||||
| Priority: optional | Priority: optional | ||||||
| Maintainer: Ivan Savenko <saven.ivan@gmail.com> | Maintainer: Ivan Savenko <saven.ivan@gmail.com> | ||||||
| Build-Depends: debhelper (>= 8), cmake, libsdl-image1.2-dev, libsdl-ttf2.0-dev, libsdl-mixer1.2-dev (>= 1.2.8), zlib1g-dev, libavformat-dev, libswscale-dev, libboost-dev (>=1.46), libboost-program-options-dev (>=1.46), libboost-filesystem-dev (>=1.46), libboost-system-dev (>=1.46), libboost-thread-dev (>=1.46) | Build-Depends: debhelper (>= 8), cmake, libsdl-image1.2-dev, libsdl-ttf2.0-dev, libsdl-mixer1.2-dev (>= 1.2.8), zlib1g-dev, libavformat-dev, libswscale-dev, libboost-dev (>=1.48), libboost-program-options-dev (>=1.48), libboost-filesystem-dev (>=1.48), libboost-system-dev (>=1.48), libboost-locale-dev (>=1.48), libboost-thread-dev (>=1.48) | ||||||
| Standards-Version: 3.9.1 | Standards-Version: 3.9.1 | ||||||
| Homepage: http://vcmi.eu | Homepage: http://vcmi.eu | ||||||
|  |  | ||||||
|   | |||||||
| @@ -28,7 +28,7 @@ bool CModEntry::compareVersions(QString lesser, QString greater) | |||||||
| 	return false; | 	return false; | ||||||
| } | } | ||||||
|  |  | ||||||
| CModEntry::CModEntry(QVariantMap repository, QVariantMap localData, QVariant modSettings, QString modname): | CModEntry::CModEntry(QVariantMap repository, QVariantMap localData, QVariantMap modSettings, QString modname): | ||||||
|     repository(repository), |     repository(repository), | ||||||
|     localData(localData), |     localData(localData), | ||||||
|     modSettings(modSettings), |     modSettings(modSettings), | ||||||
| @@ -41,7 +41,7 @@ bool CModEntry::isEnabled() const | |||||||
| 	if (!isInstalled()) | 	if (!isInstalled()) | ||||||
| 		return false; | 		return false; | ||||||
|  |  | ||||||
| 	return modSettings.toBool(); | 	return modSettings["active"].toBool(); | ||||||
| } | } | ||||||
|  |  | ||||||
| bool CModEntry::isDisabled() const | bool CModEntry::isDisabled() const | ||||||
| @@ -140,7 +140,13 @@ CModEntry CModList::getMod(QString modname) const | |||||||
|  |  | ||||||
| 	QVariantMap repo; | 	QVariantMap repo; | ||||||
| 	QVariantMap local = localModList[modname].toMap(); | 	QVariantMap local = localModList[modname].toMap(); | ||||||
| 	QVariant settings = modSettings[modname]; | 	QVariantMap settings; | ||||||
|  |  | ||||||
|  | 	QVariant conf = modSettings[modname]; | ||||||
|  | 	if (conf.canConvert<QVariantMap>()) | ||||||
|  | 		settings = modSettings[modname].toMap(); | ||||||
|  | 	else | ||||||
|  | 		settings.insert("active", conf); | ||||||
|  |  | ||||||
| 	for (auto entry : repositories) | 	for (auto entry : repositories) | ||||||
| 	{ | 	{ | ||||||
|   | |||||||
| @@ -22,11 +22,11 @@ class CModEntry | |||||||
| 	// repository contains newest version only (if multiple are available) | 	// repository contains newest version only (if multiple are available) | ||||||
| 	QVariantMap repository; | 	QVariantMap repository; | ||||||
| 	QVariantMap localData; | 	QVariantMap localData; | ||||||
| 	QVariant modSettings; | 	QVariantMap modSettings; | ||||||
|  |  | ||||||
| 	QString modname; | 	QString modname; | ||||||
| public: | public: | ||||||
| 	CModEntry(QVariantMap repository, QVariantMap localData, QVariant modSettings, QString modname); | 	CModEntry(QVariantMap repository, QVariantMap localData, QVariantMap modSettings, QString modname); | ||||||
|  |  | ||||||
| 	// installed and enabled | 	// installed and enabled | ||||||
| 	bool isEnabled() const; | 	bool isEnabled() const; | ||||||
| @@ -76,4 +76,4 @@ public: | |||||||
|  |  | ||||||
| 	// returns list of all available mods | 	// returns list of all available mods | ||||||
| 	QVector<QString> getModList() const; | 	QVector<QString> getModList() const; | ||||||
| }; | }; | ||||||
|   | |||||||
| @@ -192,8 +192,10 @@ bool CModManager::doEnableMod(QString mod, bool on) | |||||||
| { | { | ||||||
| 	QVariant value(on); | 	QVariant value(on); | ||||||
| 	QVariantMap list = modSettings["activeMods"].toMap(); | 	QVariantMap list = modSettings["activeMods"].toMap(); | ||||||
|  | 	QVariantMap modData = list[mod].toMap(); | ||||||
|  |  | ||||||
| 	list.insert(mod, value); | 	modData.insert("active", value); | ||||||
|  | 	list.insert(mod, modData); | ||||||
| 	modSettings.insert("activeMods", list); | 	modSettings.insert("activeMods", list); | ||||||
|  |  | ||||||
| 	modList->setModSettings(modSettings["activeMods"]); | 	modList->setModSettings(modSettings["activeMods"]); | ||||||
|   | |||||||
| @@ -108,6 +108,7 @@ CHeroClass *CHeroClassHandler::loadFromJson(const JsonNode & node) | |||||||
| 		heroClass->secSkillProbability.push_back(node["secondarySkills"][secSkill].Float()); | 		heroClass->secSkillProbability.push_back(node["secondarySkills"][secSkill].Float()); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	heroClass->defaultTavernChance = node["defaultTavern"].Float(); | ||||||
| 	for(auto & tavern : node["tavern"].Struct()) | 	for(auto & tavern : node["tavern"].Struct()) | ||||||
| 	{ | 	{ | ||||||
| 		int value = tavern.second.Float(); | 		int value = tavern.second.Float(); | ||||||
| @@ -189,6 +190,24 @@ void CHeroClassHandler::loadObject(std::string scope, std::string name, const Js | |||||||
| 	VLC->modh->identifiers.registerObject(scope, "heroClass", name, object->id); | 	VLC->modh->identifiers.registerObject(scope, "heroClass", name, object->id); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | void CHeroClassHandler::afterLoadFinalization() | ||||||
|  | { | ||||||
|  | 	// for each pair <class, town> set selection probability if it was not set before in tavern entries | ||||||
|  | 	for (CHeroClass * heroClass : heroClasses) | ||||||
|  | 	{ | ||||||
|  | 		for (CFaction * faction : VLC->townh->factions) | ||||||
|  | 		{ | ||||||
|  | 			if (!faction->town) | ||||||
|  | 				continue; | ||||||
|  | 			if (heroClass->selectionProbability.count(faction->index)) | ||||||
|  | 				continue; | ||||||
|  |  | ||||||
|  | 			float chance = heroClass->defaultTavernChance * faction->town->defaultTavernChance; | ||||||
|  | 			heroClass->selectionProbability[faction->index] = round(sqrt(chance)); | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
| std::vector<bool> CHeroClassHandler::getDefaultAllowed() const | std::vector<bool> CHeroClassHandler::getDefaultAllowed() const | ||||||
| { | { | ||||||
| 	return std::vector<bool>(heroClasses.size(), true); | 	return std::vector<bool>(heroClasses.size(), true); | ||||||
|   | |||||||
| @@ -103,6 +103,10 @@ public: | |||||||
| 	TFaction faction; | 	TFaction faction; | ||||||
| 	ui8 id; | 	ui8 id; | ||||||
|  |  | ||||||
|  | 	// default chance for hero of specific class to appear in tavern, if field "tavern" was not set | ||||||
|  | 	// resulting chance = sqrt(town.chance * heroClass.chance) | ||||||
|  | 	ui32 defaultTavernChance; | ||||||
|  |  | ||||||
| 	std::vector<int> primarySkillInitial;  // initial primary skills | 	std::vector<int> primarySkillInitial;  // initial primary skills | ||||||
| 	std::vector<int> primarySkillLowLevel; // probability (%) of getting point of primary skill when getting level | 	std::vector<int> primarySkillLowLevel; // probability (%) of getting point of primary skill when getting level | ||||||
| 	std::vector<int> primarySkillHighLevel;// same for high levels (> 10) | 	std::vector<int> primarySkillHighLevel;// same for high levels (> 10) | ||||||
| @@ -121,7 +125,7 @@ public: | |||||||
|  |  | ||||||
| 	template <typename Handler> void serialize(Handler &h, const int version) | 	template <typename Handler> void serialize(Handler &h, const int version) | ||||||
| 	{ | 	{ | ||||||
| 		h & identifier & name & faction & id;// & aggression; | 		h & identifier & name & faction & id & defaultTavernChance;// & aggression; | ||||||
| 		h & primarySkillInitial   & primarySkillLowLevel; | 		h & primarySkillInitial   & primarySkillLowLevel; | ||||||
| 		h & primarySkillHighLevel & secSkillProbability; | 		h & primarySkillHighLevel & secSkillProbability; | ||||||
| 		h & selectionProbability; | 		h & selectionProbability; | ||||||
| @@ -162,6 +166,8 @@ public: | |||||||
| 	void loadObject(std::string scope, std::string name, const JsonNode & data) override; | 	void loadObject(std::string scope, std::string name, const JsonNode & data) override; | ||||||
| 	void loadObject(std::string scope, std::string name, const JsonNode & data, size_t index) override; | 	void loadObject(std::string scope, std::string name, const JsonNode & data, size_t index) override; | ||||||
|  |  | ||||||
|  | 	void afterLoadFinalization(); | ||||||
|  |  | ||||||
| 	std::vector<bool> getDefaultAllowed() const; | 	std::vector<bool> getDefaultAllowed() const; | ||||||
|  |  | ||||||
| 	~CHeroClassHandler(); | 	~CHeroClassHandler(); | ||||||
|   | |||||||
| @@ -5,6 +5,13 @@ include_directories(${CMAKE_HOME_DIRECTORY} ${CMAKE_CURRENT_SOURCE_DIRECTORY} ${ | |||||||
| include_directories(${Boost_INCLUDE_DIRS} ${SDL_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR}) | include_directories(${Boost_INCLUDE_DIRS} ${SDL_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR}) | ||||||
|  |  | ||||||
| set(lib_SRCS | set(lib_SRCS | ||||||
|  | 		RegisterTypes.cpp | ||||||
|  | 		IGameCallback.cpp | ||||||
|  | 		CGameState.cpp | ||||||
|  | 		CObjectHandler.cpp | ||||||
|  | 		Connection.cpp | ||||||
|  | 		NetPacksLib.cpp | ||||||
|  |  | ||||||
| 		filesystem/AdapterLoaders.cpp | 		filesystem/AdapterLoaders.cpp | ||||||
| 		filesystem/CCompressedStream.cpp | 		filesystem/CCompressedStream.cpp | ||||||
| 		filesystem/CFilesystemLoader.cpp | 		filesystem/CFilesystemLoader.cpp | ||||||
| @@ -47,24 +54,18 @@ set(lib_SRCS | |||||||
| 		CCreatureSet.cpp | 		CCreatureSet.cpp | ||||||
| 		CDefObjInfoHandler.cpp | 		CDefObjInfoHandler.cpp | ||||||
| 		CGameInterface.cpp | 		CGameInterface.cpp | ||||||
| 		CGameState.cpp |  | ||||||
| 		CGeneralTextHandler.cpp | 		CGeneralTextHandler.cpp | ||||||
| 		CHeroHandler.cpp | 		CHeroHandler.cpp | ||||||
| 		CModHandler.cpp | 		CModHandler.cpp | ||||||
| 		CObjectHandler.cpp |  | ||||||
| 		CObstacleInstance.cpp | 		CObstacleInstance.cpp | ||||||
| 		Connection.cpp |  | ||||||
| 		CSpellHandler.cpp | 		CSpellHandler.cpp | ||||||
| 		CThreadHelper.cpp | 		CThreadHelper.cpp | ||||||
| 		CTownHandler.cpp | 		CTownHandler.cpp | ||||||
| 		GameConstants.cpp | 		GameConstants.cpp | ||||||
| 		HeroBonus.cpp | 		HeroBonus.cpp | ||||||
| 		IGameCallback.cpp |  | ||||||
| 		JsonDetail.cpp | 		JsonDetail.cpp | ||||||
| 		JsonNode.cpp | 		JsonNode.cpp | ||||||
| 		NetPacksLib.cpp |  | ||||||
| 		ResourceSet.cpp | 		ResourceSet.cpp | ||||||
| 		RegisterTypes.cpp |  | ||||||
| 		VCMI_Lib.cpp | 		VCMI_Lib.cpp | ||||||
| 		VCMIDirs.cpp | 		VCMIDirs.cpp | ||||||
| ) | ) | ||||||
|   | |||||||
| @@ -445,17 +445,31 @@ std::vector <TModID> CModHandler::resolveDependencies(std::vector <TModID> input | |||||||
| 	return output; | 	return output; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | static void updateModSettingsFormat(JsonNode & config) | ||||||
|  | { | ||||||
|  | 	for (auto & entry : config.Struct()) | ||||||
|  | 	{ | ||||||
|  | 		if (entry.second.getType() == JsonNode::DATA_BOOL) | ||||||
|  | 		{ | ||||||
|  | 			entry.second["active"].Bool() = entry.second.Bool(); | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
| void CModHandler::initialize(std::vector<std::string> availableMods) | void CModHandler::initialize(std::vector<std::string> availableMods) | ||||||
| { | { | ||||||
| 	std::string confName = "config/modSettings.json"; | 	std::string confName = "config/modSettings.json"; | ||||||
| 	JsonNode modConfig; | 	JsonNode modConfig; | ||||||
|  |  | ||||||
| 	// Porbably new install. Create initial configuration | 	// Probably new install. Create initial configuration | ||||||
| 	if (!CResourceHandler::get()->existsResource(ResourceID(confName))) | 	if (!CResourceHandler::get()->existsResource(ResourceID(confName))) | ||||||
| 		CResourceHandler::get()->createResource(confName); | 		CResourceHandler::get()->createResource(confName); | ||||||
| 	else | 	else | ||||||
| 		modConfig = JsonNode(ResourceID(confName)); | 		modConfig = JsonNode(ResourceID(confName)); | ||||||
|  |  | ||||||
|  | 	// mod compatibility: check if modSettings has old, 0.94 format | ||||||
|  | 	updateModSettingsFormat(modConfig["activeMods"]); | ||||||
|  |  | ||||||
| 	const JsonNode & modList = modConfig["activeMods"]; | 	const JsonNode & modList = modConfig["activeMods"]; | ||||||
| 	JsonNode resultingList; | 	JsonNode resultingList; | ||||||
|  |  | ||||||
| @@ -473,12 +487,12 @@ void CModHandler::initialize(std::vector<std::string> availableMods) | |||||||
| 			if (config.isNull()) | 			if (config.isNull()) | ||||||
| 				continue; | 				continue; | ||||||
|  |  | ||||||
| 			if (!modList[name].isNull() && modList[name].Bool() == false ) | 			if (!modList[name].isNull() && modList[name]["active"].Bool() == false ) | ||||||
| 			{ | 			{ | ||||||
| 				resultingList[name].Bool() = false; | 				resultingList[name]["active"].Bool() = false; | ||||||
| 				continue; // disabled mod | 				continue; // disabled mod | ||||||
| 			} | 			} | ||||||
| 			resultingList[name].Bool() = true; | 			resultingList[name]["active"].Bool() = true; | ||||||
|  |  | ||||||
| 			CModInfo & mod = allMods[name]; | 			CModInfo & mod = allMods[name]; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -503,6 +503,7 @@ void CTownHandler::loadTown(CTown &town, const JsonNode & source) | |||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	town.defaultTavernChance = source["defaultTavern"].Float(); | ||||||
| 	/// set chance of specific hero class to appear in this town | 	/// set chance of specific hero class to appear in this town | ||||||
| 	for(auto &node : source["tavern"].Struct()) | 	for(auto &node : source["tavern"].Struct()) | ||||||
| 	{ | 	{ | ||||||
|   | |||||||
| @@ -148,6 +148,9 @@ public: | |||||||
| 	ui16 primaryRes; | 	ui16 primaryRes; | ||||||
| 	ArtifactID warMachine; | 	ArtifactID warMachine; | ||||||
| 	si32 moatDamage; | 	si32 moatDamage; | ||||||
|  | 	// default chance for hero of specific class to appear in tavern, if field "tavern" was not set | ||||||
|  | 	// resulting chance = sqrt(town.chance * heroClass.chance) | ||||||
|  | 	ui32 defaultTavernChance; | ||||||
|  |  | ||||||
| 	// Client-only data. Should be moved away from lib | 	// Client-only data. Should be moved away from lib | ||||||
| 	struct ClientInfo | 	struct ClientInfo | ||||||
| @@ -197,7 +200,7 @@ public: | |||||||
| 	template <typename Handler> void serialize(Handler &h, const int version) | 	template <typename Handler> void serialize(Handler &h, const int version) | ||||||
| 	{ | 	{ | ||||||
| 		h & names & faction & creatures & dwellings & dwellingNames & buildings & hordeLvl & mageLevel | 		h & names & faction & creatures & dwellings & dwellingNames & buildings & hordeLvl & mageLevel | ||||||
| 			& primaryRes & warMachine & clientInfo & moatDamage; | 			& primaryRes & warMachine & clientInfo & moatDamage & defaultTavernChance; | ||||||
|  |  | ||||||
| 		auto findNull = [](const std::pair<BuildingID, ConstTransitivePtr<CBuilding>> &building) | 		auto findNull = [](const std::pair<BuildingID, ConstTransitivePtr<CBuilding>> &building) | ||||||
| 		{ return building.second == nullptr; }; | 		{ return building.second == nullptr; }; | ||||||
|   | |||||||
| @@ -4,8 +4,8 @@ cmake_minimum_required(VERSION 2.6) | |||||||
| include_directories(${CMAKE_HOME_DIRECTORY} ${CMAKE_CURRENT_SOURCE_DIRECTORY}) | include_directories(${CMAKE_HOME_DIRECTORY} ${CMAKE_CURRENT_SOURCE_DIRECTORY}) | ||||||
|  |  | ||||||
| set(lib_SRCS | set(lib_SRCS | ||||||
|         ERMInterpreter.cpp |  | ||||||
|         ERMParser.cpp |         ERMParser.cpp | ||||||
|  |         ERMInterpreter.cpp | ||||||
|         ERMScriptModule.cpp |         ERMScriptModule.cpp | ||||||
| ) | ) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -6,8 +6,8 @@ include_directories(${Boost_INCLUDE_DIRS}) | |||||||
|  |  | ||||||
| set(server_SRCS | set(server_SRCS | ||||||
|         CGameHandler.cpp |         CGameHandler.cpp | ||||||
|         CQuery.cpp |  | ||||||
|         CVCMIServer.cpp |         CVCMIServer.cpp | ||||||
|  |         CQuery.cpp | ||||||
|         NetPacksServer.cpp |         NetPacksServer.cpp | ||||||
| ) | ) | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user