mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	- adventure map defs are now part of town config. Should be the last part
- possibly fixed #1136
This commit is contained in:
		| @@ -957,7 +957,6 @@ void CPlayerInterface::showInfoDialog(const std::string &text, const std::vector | |||||||
| { | { | ||||||
| 	waitWhileDialog(); | 	waitWhileDialog(); | ||||||
|  |  | ||||||
| 	stopMovement(); |  | ||||||
| 	if (settings["session"]["autoSkip"].Bool() && !LOCPLINT->shiftPressed()) | 	if (settings["session"]["autoSkip"].Bool() && !LOCPLINT->shiftPressed()) | ||||||
| 	{ | 	{ | ||||||
| 		return; | 		return; | ||||||
| @@ -968,6 +967,7 @@ void CPlayerInterface::showInfoDialog(const std::string &text, const std::vector | |||||||
| 	{ | 	{ | ||||||
| 		CCS->soundh->playSound(static_cast<soundBase::soundID>(soundID)); | 		CCS->soundh->playSound(static_cast<soundBase::soundID>(soundID)); | ||||||
| 		showingDialog->set(true); | 		showingDialog->set(true); | ||||||
|  | 		stopMovement(); // interrupt movement to show dialog | ||||||
| 		GH.pushInt(temp); | 		GH.pushInt(temp); | ||||||
| 	} | 	} | ||||||
| 	else | 	else | ||||||
| @@ -1271,7 +1271,7 @@ bool CPlayerInterface::moveHero( const CGHeroInstance *h, CGPath path ) | |||||||
| 					stillMoveHero.cond.wait(un); | 					stillMoveHero.cond.wait(un); | ||||||
|  |  | ||||||
| 				tlog5 << "Resuming " << __FUNCTION__ << std::endl; | 				tlog5 << "Resuming " << __FUNCTION__ << std::endl; | ||||||
| 				if (guarded) // Abort movement if a guard was fought. | 				if (guarded || showingDialog->get() == true) // Abort movement if a guard was fought or there is a dialog to display (Mantis #1136) | ||||||
| 					break; | 					break; | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
|   | |||||||
| @@ -66,6 +66,12 @@ | |||||||
| 		}, | 		}, | ||||||
| 		"town" : | 		"town" : | ||||||
| 		{ | 		{ | ||||||
|  | 			"adventureMap" : | ||||||
|  | 			{ | ||||||
|  | 				"castle" : "AVCcasx0.def", | ||||||
|  | 				"village" : "AVCCAST0.DEF", | ||||||
|  | 				"capitol" : "AVCCASZ0.DEF" | ||||||
|  | 			}, | ||||||
| 			"structures" : | 			"structures" : | ||||||
| 			[ | 			[ | ||||||
| 				{ "animation" : "TBCSEXT2.def", "x" : 46,  "y" : 119 }, | 				{ "animation" : "TBCSEXT2.def", "x" : 46,  "y" : 119 }, | ||||||
| @@ -298,7 +304,12 @@ | |||||||
| 		}, | 		}, | ||||||
| 		"town" : | 		"town" : | ||||||
| 		{ | 		{ | ||||||
|  | 			"adventureMap" : | ||||||
|  | 			{ | ||||||
|  | 				"castle" : "AVCramx0.def", | ||||||
|  | 				"village" : "AVCRAMP0.DEF", | ||||||
|  | 				"capitol" : "AVCRAMZ0.DEF" | ||||||
|  | 			}, | ||||||
| 			"structures" : | 			"structures" : | ||||||
| 			[ | 			[ | ||||||
| 				{ "animation" : "TBRMEXT2.def", "x" : 327, "y" : 236 }, | 				{ "animation" : "TBRMEXT2.def", "x" : 327, "y" : 236 }, | ||||||
| @@ -535,6 +546,12 @@ | |||||||
| 		}, | 		}, | ||||||
| 		"town" : | 		"town" : | ||||||
| 		{ | 		{ | ||||||
|  | 			"adventureMap" : | ||||||
|  | 			{ | ||||||
|  | 				"castle" : "AVCtowx0.def", | ||||||
|  | 				"village" : "AVCTOWR0.DEF", | ||||||
|  | 				"capitol" : "AVCTOWZ0.DEF" | ||||||
|  | 			}, | ||||||
| 			"structures" : | 			"structures" : | ||||||
| 			[ | 			[ | ||||||
| 				{ "id" : 0,  "animation" : "TBTWMAGE.def", "x" : 597, "y" : 82,  "border" : "TOTGLD1.bmp",  "area" : "TZTGLD1.bmp" }, | 				{ "id" : 0,  "animation" : "TBTWMAGE.def", "x" : 597, "y" : 82,  "border" : "TOTGLD1.bmp",  "area" : "TZTGLD1.bmp" }, | ||||||
| @@ -764,6 +781,12 @@ | |||||||
| 		}, | 		}, | ||||||
| 		"town" : | 		"town" : | ||||||
| 		{ | 		{ | ||||||
|  | 			"adventureMap" : | ||||||
|  | 			{ | ||||||
|  | 				"castle" : "AVCinfx0.def", | ||||||
|  | 				"village" : "AVCINFT0.DEF", | ||||||
|  | 				"capitol" : "AVCINFZ0.DEF" | ||||||
|  | 			}, | ||||||
| 			"structures" : | 			"structures" : | ||||||
| 			[ | 			[ | ||||||
| 				{ "id" : 0,  "animation" : "TBINMAGE.def", "x" : 667, "y" : 127, "border" : "TOIMAG1A.bmp", "area" : "TZIMAG1A.bmp" }, | 				{ "id" : 0,  "animation" : "TBINMAGE.def", "x" : 667, "y" : 127, "border" : "TOIMAG1A.bmp", "area" : "TZIMAG1A.bmp" }, | ||||||
| @@ -995,6 +1018,12 @@ | |||||||
| 		}, | 		}, | ||||||
| 		"town" : | 		"town" : | ||||||
| 		{ | 		{ | ||||||
|  | 			"adventureMap" : | ||||||
|  | 			{ | ||||||
|  | 				"castle" : "AVCnecx0.def", | ||||||
|  | 				"village" : "AVCNECR0.DEF", | ||||||
|  | 				"capitol" : "AVCNECZ0.DEF" | ||||||
|  | 			}, | ||||||
| 			"structures" : | 			"structures" : | ||||||
| 			[ | 			[ | ||||||
| 				{ "animation" : "TBNCEXT2.def", "x" : 25,  "y" : 279 }, | 				{ "animation" : "TBNCEXT2.def", "x" : 25,  "y" : 279 }, | ||||||
| @@ -1229,6 +1258,12 @@ | |||||||
| 		}, | 		}, | ||||||
| 		"town" : | 		"town" : | ||||||
| 		{ | 		{ | ||||||
|  | 			"adventureMap" : | ||||||
|  | 			{ | ||||||
|  | 				"castle" : "AVCdunx0.def", | ||||||
|  | 				"village" : "AVCDUNG0.DEF", | ||||||
|  | 				"capitol" : "AVCDUNZ0.DEF" | ||||||
|  | 			}, | ||||||
| 			"structures" : | 			"structures" : | ||||||
| 			[ | 			[ | ||||||
| 				{ "id" : 0,  "animation" : "TBDNMAGE.def", "x" : 164, "y" : 119, "z" : -1, "border" : "TODMAG1.bmp",  "area" : "TZDMAG1.bmp" }, | 				{ "id" : 0,  "animation" : "TBDNMAGE.def", "x" : 164, "y" : 119, "z" : -1, "border" : "TODMAG1.bmp",  "area" : "TZDMAG1.bmp" }, | ||||||
| @@ -1457,6 +1492,12 @@ | |||||||
| 		}, | 		}, | ||||||
| 		"town" : | 		"town" : | ||||||
| 		{ | 		{ | ||||||
|  | 			"adventureMap" : | ||||||
|  | 			{ | ||||||
|  | 				"castle" : "AVCstrx0.def", | ||||||
|  | 				"village" : "AVCSTRO0.DEF", | ||||||
|  | 				"capitol" : "AVCSTRZ0.DEF" | ||||||
|  | 			}, | ||||||
| 			"structures" : | 			"structures" : | ||||||
| 			[ | 			[ | ||||||
| 				{ "animation" : "TBSTEXT3.def", "x" : 23,  "y" : 20 }, | 				{ "animation" : "TBSTEXT3.def", "x" : 23,  "y" : 20 }, | ||||||
| @@ -1684,6 +1725,12 @@ | |||||||
| 		}, | 		}, | ||||||
| 		"town" : | 		"town" : | ||||||
| 		{ | 		{ | ||||||
|  | 			"adventureMap" : | ||||||
|  | 			{ | ||||||
|  | 				"castle" : "AVCftrx0.def", | ||||||
|  | 				"village" : "AVCFTRT0.DEF", | ||||||
|  | 				"capitol" : "AVCFORZ0.DEF" | ||||||
|  | 			}, | ||||||
| 			"structures" : | 			"structures" : | ||||||
| 			[ | 			[ | ||||||
| 				{ "animation" : "TBFREXT2.def", "x" : 372, "y" : 227 }, | 				{ "animation" : "TBFREXT2.def", "x" : 372, "y" : 227 }, | ||||||
| @@ -1914,6 +1961,12 @@ | |||||||
| 		}, | 		}, | ||||||
| 		"town" : | 		"town" : | ||||||
| 		{ | 		{ | ||||||
|  | 			"adventureMap" : | ||||||
|  | 			{ | ||||||
|  | 				"castle" : "avchforx.def", | ||||||
|  | 				"village" : "AVCHFOR0.DEF", | ||||||
|  | 				"capitol" : "AVCHFORZ.DEF" | ||||||
|  | 			}, | ||||||
| 			"structures" : | 			"structures" : | ||||||
| 			[ | 			[ | ||||||
| 				{ "animation" : "TBELEXT5.def", "x" : 682, "y" : 183,  "z" : -1, }, | 				{ "animation" : "TBELEXT5.def", "x" : 682, "y" : 183,  "z" : -1, }, | ||||||
|   | |||||||
| @@ -1,14 +0,0 @@ | |||||||
| { |  | ||||||
| 	// Graphics for villages and castles on the map, ordered by town id. |  | ||||||
| 	"town_defnames": [ |  | ||||||
| 		{ "village": "AVCCAST0.DEF", "capitol": "AVCCASZ0.DEF" }, |  | ||||||
| 		{ "village": "AVCRAMP0.DEF", "capitol": "AVCRAMZ0.DEF" }, |  | ||||||
| 		{ "village": "AVCTOWR0.DEF", "capitol": "AVCTOWZ0.DEF" }, |  | ||||||
| 		{ "village": "AVCINFT0.DEF", "capitol": "AVCINFZ0.DEF" }, |  | ||||||
| 		{ "village": "AVCNECR0.DEF", "capitol": "AVCNECZ0.DEF" }, |  | ||||||
| 		{ "village": "AVCDUNG0.DEF", "capitol": "AVCDUNZ0.DEF" }, |  | ||||||
| 		{ "village": "AVCSTRO0.DEF", "capitol": "AVCSTRZ0.DEF" }, |  | ||||||
| 		{ "village": "AVCFTRT0.DEF", "capitol": "AVCFORZ0.DEF" }, |  | ||||||
| 		{ "village": "AVCHFOR0.DEF", "capitol": "AVCHFORZ.DEF" } |  | ||||||
| 	] |  | ||||||
| } |  | ||||||
| @@ -120,8 +120,6 @@ void CDefObjInfoHandler::load() | |||||||
|  |  | ||||||
|  |  | ||||||
| 		gobjs[nobj->id][nobj->subid] = nobj; | 		gobjs[nobj->id][nobj->subid] = nobj; | ||||||
| 		if(nobj->id==Obj::TOWN) |  | ||||||
| 			castles[nobj->subid]=nobj; |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	for (int i = 0; i < 8 ; i++) | 	for (int i = 0; i < 8 ; i++) | ||||||
|   | |||||||
| @@ -49,7 +49,6 @@ class DLL_LINKAGE CDefObjInfoHandler | |||||||
| { | { | ||||||
| public: | public: | ||||||
| 	bmap<int, bmap<int, ConstTransitivePtr<CGDefInfo> > > gobjs; | 	bmap<int, bmap<int, ConstTransitivePtr<CGDefInfo> > > gobjs; | ||||||
| 	bmap<int, ConstTransitivePtr<CGDefInfo> > castles; |  | ||||||
|  |  | ||||||
| 	void load(); | 	void load(); | ||||||
| 	~CDefObjInfoHandler(); | 	~CDefObjInfoHandler(); | ||||||
| @@ -57,6 +56,5 @@ public: | |||||||
| 	template <typename Handler> void serialize(Handler &h, const int version) | 	template <typename Handler> void serialize(Handler &h, const int version) | ||||||
| 	{ | 	{ | ||||||
| 		h & gobjs; | 		h & gobjs; | ||||||
| 		h & castles; |  | ||||||
| 	} | 	} | ||||||
| }; | }; | ||||||
|   | |||||||
| @@ -1754,27 +1754,34 @@ int CGameState::getPlayerRelations( ui8 color1, ui8 color2 ) | |||||||
|  |  | ||||||
| void CGameState::loadTownDInfos() | void CGameState::loadTownDInfos() | ||||||
| { | { | ||||||
|     int i; | 	assert(!VLC->dobjinfo->gobjs[Obj::TOWN].empty()); //make sure that at least some def info was found | ||||||
| 	const JsonNode config(ResourceID("config/towns_defs.json")); |  | ||||||
|  |  | ||||||
|     assert(config["town_defnames"].Vector().size() == GameConstants::F_NUMBER); | 	const CGDefInfo * baseInfo = VLC->dobjinfo->gobjs[Obj::TOWN].begin()->second; | ||||||
|  | 	auto & townInfos = VLC->dobjinfo->gobjs[Obj::TOWN]; | ||||||
|  |  | ||||||
|     i = 0; |  | ||||||
| 	BOOST_FOREACH(const JsonNode &t, config["town_defnames"].Vector()) | 	BOOST_FOREACH(auto & town, VLC->townh->towns) | ||||||
| 	{ | 	{ | ||||||
| 		villages[i] = new CGDefInfo(*VLC->dobjinfo->castles[i]); | 		if (!vstd::contains(VLC->dobjinfo->gobjs[Obj::TOWN], town.first)) // no obj info for this town type | ||||||
|         villages[i]->name = t["village"].String(); | 		{ | ||||||
| 		map->defy.push_back(villages[i]); | 			CGDefInfo * info = new CGDefInfo(*baseInfo); | ||||||
|  | 			info->subid = town.first; | ||||||
|  |  | ||||||
| 		forts[i] = VLC->dobjinfo->castles[i]; | 			townInfos[town.first] = info; | ||||||
| 		map->defy.push_back(forts[i]); | 		} | ||||||
|  | 		forts[town.first] = townInfos[town.first]; | ||||||
|  | 		townInfos[town.first]->name = town.second.clientInfo.advMapCastle; | ||||||
|  |  | ||||||
| 		capitols[i] = new CGDefInfo(*VLC->dobjinfo->castles[i]); | 		villages[town.first] = new CGDefInfo(*townInfos[town.first]); | ||||||
|         capitols[i]->name = t["capitol"].String(); | 		villages[town.first]->name = town.second.clientInfo.advMapVillage; | ||||||
| 		map->defy.push_back(capitols[i]); |  | ||||||
|  |  | ||||||
| 		++i; | 		capitols[town.first] = new CGDefInfo(*townInfos[town.first]); | ||||||
|     } | 		capitols[town.first]->name = town.second.clientInfo.advMapCapitol; | ||||||
|  |  | ||||||
|  | 		map->defy.push_back(villages[town.first]); | ||||||
|  | 		map->defy.push_back(forts[town.first]); | ||||||
|  | 		map->defy.push_back(capitols[town.first]); | ||||||
|  | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
| void CGameState::getNeighbours(const TerrainTile &srct, int3 tile, std::vector<int3> &vec, const boost::logic::tribool &onLand, bool limitCoastSailing) | void CGameState::getNeighbours(const TerrainTile &srct, int3 tile, std::vector<int3> &vec, const boost::logic::tribool &onLand, bool limitCoastSailing) | ||||||
|   | |||||||
| @@ -380,6 +380,10 @@ void CTownHandler::loadClientData(CTown &town, const JsonNode & source) | |||||||
| 	town.clientInfo.guildWindow = source["guildWindow"].String(); | 	town.clientInfo.guildWindow = source["guildWindow"].String(); | ||||||
| 	town.clientInfo.buildingsIcons = source["buildingsIcons"].String(); | 	town.clientInfo.buildingsIcons = source["buildingsIcons"].String(); | ||||||
|  |  | ||||||
|  | 	town.clientInfo.advMapVillage = source["adventureMap"]["village"].String(); | ||||||
|  | 	town.clientInfo.advMapCastle  = source["adventureMap"]["castle"].String(); | ||||||
|  | 	town.clientInfo.advMapCapitol = source["adventureMap"]["capitol"].String(); | ||||||
|  |  | ||||||
| 	loadTownHall(town,   source["hallSlots"]); | 	loadTownHall(town,   source["hallSlots"]); | ||||||
| 	loadStructures(town, source["structures"]); | 	loadStructures(town, source["structures"]); | ||||||
| 	loadSiegeScreen(town, source["siege"]); | 	loadSiegeScreen(town, source["siege"]); | ||||||
|   | |||||||
| @@ -119,6 +119,10 @@ public: | |||||||
| 		/// NOTE: index in vector is meaningless. Vector used instead of list for a bit faster access | 		/// NOTE: index in vector is meaningless. Vector used instead of list for a bit faster access | ||||||
| 		std::vector<ConstTransitivePtr<CStructure> > structures; | 		std::vector<ConstTransitivePtr<CStructure> > structures; | ||||||
|  |  | ||||||
|  | 		std::string advMapVillage; | ||||||
|  | 		std::string advMapCastle; | ||||||
|  | 		std::string advMapCapitol; | ||||||
|  |  | ||||||
| 		std::string siegePrefix; | 		std::string siegePrefix; | ||||||
| 		std::vector<Point> siegePositions; | 		std::vector<Point> siegePositions; | ||||||
| 		TCreature siegeShooter; // shooter creature ID | 		TCreature siegeShooter; // shooter creature ID | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user