瀏覽代碼

Moving files:
- new config for objects (config/objects/generic.json)
- renamed lib/CDefObjectHandler to lib/CObjectClassesHandler

Ivan Savenko 11 年之前
父節點
當前提交
7f276185bd

+ 1 - 1
AI/VCAI/VCAI.h

@@ -4,7 +4,7 @@
 #include "Goals.h"
 #include "../../lib/AI_Base.h"
 #include "../../CCallback.h"
-#include "../../lib/CDefObjInfoHandler.h"
+#include "../../lib/CObjectClassesHandler.h"
 
 #include "../../lib/CThreadHelper.h"
 

+ 1 - 1
CCallback.cpp

@@ -9,7 +9,7 @@
 #include "client/Client.h"
 #include "lib/mapping/CMap.h"
 #include "lib/CBuildingHandler.h"
-#include "lib/CDefObjInfoHandler.h"
+#include "lib/CObjectClassesHandler.h"
 #include "lib/CGeneralTextHandler.h"
 #include "lib/CHeroHandler.h"
 #include "lib/CObjectHandler.h"

+ 1 - 1
client/CMT.cpp

@@ -44,7 +44,7 @@
 #ifdef _WIN32
 #include "SDL_syswm.h"
 #endif
-#include "../lib/CDefObjInfoHandler.h"
+#include "../lib/CObjectClassesHandler.h"
 #include "../lib/UnlockGuard.h"
 #include "CMT.h"
 

+ 1 - 1
client/CPlayerInterface.cpp

@@ -1,5 +1,5 @@
 #include "StdInc.h"
-#include "../lib/CDefObjInfoHandler.h"
+#include "../lib/CObjectClassesHandler.h"
 #include "CAdvmapInterface.h"
 #include "battle/CBattleInterface.h"
 #include "battle/CBattleInterfaceClasses.h"

+ 1 - 1
client/CPreGame.cpp

@@ -11,7 +11,7 @@
 #include "gui/CCursorHandler.h"
 #include "CAnimation.h"
 #include "CDefHandler.h"
-#include "../lib/CDefObjInfoHandler.h"
+#include "../lib/CObjectClassesHandler.h"
 #include "../lib/CGeneralTextHandler.h"
 #include "../lib/CTownHandler.h"
 #include "../lib/CHeroHandler.h"

+ 1 - 1
client/Client.cpp

@@ -11,7 +11,7 @@
 #include "../lib/BattleState.h"
 #include "../lib/CModHandler.h"
 #include "../lib/CArtHandler.h"
-#include "../lib/CDefObjInfoHandler.h"
+#include "../lib/CObjectClassesHandler.h"
 #include "../lib/CGeneralTextHandler.h"
 #include "../lib/CHeroHandler.h"
 #include "../lib/CTownHandler.h"

+ 1 - 1
client/Graphics.cpp

@@ -18,7 +18,7 @@
 #include "CBitmapHandler.h"
 #include "../lib/CObjectHandler.h"
 #include "../lib/CSpellHandler.h"
-#include "../lib/CDefObjInfoHandler.h"
+#include "../lib/CObjectClassesHandler.h"
 #include "../lib/CGameState.h"
 #include "../lib/JsonNode.h"
 #include "../lib/vcmi_endian.h"

+ 1 - 1
client/NetPacksClient.cpp

@@ -9,7 +9,7 @@
 #include "CGameInfo.h"
 #include "../lib/Connection.h"
 #include "../lib/CGeneralTextHandler.h"
-#include "../lib/CDefObjInfoHandler.h"
+#include "../lib/CObjectClassesHandler.h"
 #include "../lib/CHeroHandler.h"
 #include "../lib/CObjectHandler.h"
 #include "../lib/VCMI_Lib.h"

+ 1 - 1
client/mapHandler.cpp

@@ -4,7 +4,7 @@
 #include "CBitmapHandler.h"
 #include "gui/SDL_Extensions.h"
 #include "CGameInfo.h"
-#include "../lib/CDefObjInfoHandler.h"
+#include "../lib/CObjectClassesHandler.h"
 #include "../lib/CGameState.h"
 #include "../lib/CHeroHandler.h"
 #include "../lib/CTownHandler.h"

+ 168 - 0
config/objects/generic.json

@@ -0,0 +1,168 @@
+{
+	"altarOfSacrifice"				: { "id" :2,  "handler": "market" },
+	"arena"							: { "id" :4,  "handler": "oncePerHero" },
+	"artifact"						: { "id" :5,  "handler": "artifact" },
+	"pandoraBox"					: { "id" :6,  "handler": "pandora" },
+	"blackMarket"					: { "id" :7,  "handler": "blackMarket" },
+	"boat"							: { "id" :8,  "handler": "boat" },
+	"borderGuard"					: { "id" :9,  "handler": "borderGuard" },
+	"keymasterTent"					: { "id" :10, "handler": "keymaster" },
+	"buoy"							: { "id" :11, "handler": "bonusingObject" },
+	"campfire"						: { "id" :12, "handler": "pickable" },
+	"cartographer"					: { "id" :13, "handler": "cartographer" },
+	"swanPond"						: { "id" :14, "handler": "bonusingObject" },
+	"coverOfDarkness"				: { "id" :15, "handler": "observatory" },
+	"creatureBank"					: { "id" :16, "handler": "bank" },
+	"creatureGeneratorCommon"		: { "id" :17, "handler": "dwelling" },
+	"creatureGeneratorSpecial"		: { "id" :20, "handler": "dwelling" },
+	"cursedGround"					: { "id" :21, "handler": "generic" },
+	"corpse"						: { "id" :22, "handler": "onceVisitable" },
+	"marlettoTower"					: { "id" :23, "handler": "oncePerHero" },
+	"derelictShip"					: { "id" :24, "handler": "bank" },
+	"dragonUtopia"					: { "id" :25, "handler": "bank" },
+	"event"							: { "id" :26, "handler": "event" },
+	"eyeOfTheMagi"					: { "id" :27, "handler": "magi" },
+	"faerieRing"					: { "id" :28, "handler": "bonusingObject" },
+	"flotsam"						: { "id" :29, "handler": "pickable" },
+	"fountainOfFortune"				: { "id" :30, "handler": "bonusingObject" },
+	"fountainOfYouth"				: { "id" :31, "handler": "bonusingObject" },
+	"gardenOfRevelation"			: { "id" :32, "handler": "oncePerHero" },
+	"garrison"						: { "id" :33, "handler": "garrison" },
+	"hero"							: { "id" :34, "handler": "hero" },
+	"hillFort"						: { "id" :35, "handler": "generic" },
+	"grail"							: { "id" :36, "handler": "generic" },
+	"hutOfTheMagi"					: { "id" :37, "handler": "magi" },
+	"idolOfFortune"					: { "id" :38, "handler": "bonusingObject" },
+	"leanTo"						: { "id" :39, "handler": "onceVisitable" },
+	"libraryOfEnlightenment"		: { "id" :41, "handler": "oncePerHero" },
+	"lighthouse"					: { "id" :42, "handler": "lighthouse" },
+	"monolithOneWayEntrance"		: { "id" :43, "handler": "teleport" },
+	"monolithOneWayExit"			: { "id" :44, "handler": "teleport" },
+	"monolithTwoWay"				: { "id" :45, "handler": "teleport" },
+	"magicPlains"					: { "id" :46, "handler": "generic" },
+	"schoolOfMagic"					: { "id" :47, "handler": "oncePerHero" },
+	"magicSpring"					: { "id" :48, "handler": "magicSpring" },
+	"magicWell"						: { "id" :49, "handler": "magicWell" },
+	"mercenaryCamp"					: { "id" :51, "handler": "oncePerHero" },
+	"mermaids"						: { "id" :52, "handler": "bonusingObject" },
+	"mine"							: { "id" :53, "handler": "mine" },
+	"monster"						: { "id" :54, "handler": "monster" },
+	"mysticalGarden"				: { "id" :55, "handler": "oncePerWeek" },
+	"oasis"							: { "id" :56, "handler": "bonusingObject" },
+	"obelisk"						: { "id" :57, "handler": "obelisk" },
+	"redwoodObservatory"			: { "id" :58, "handler": "observatory" },
+	"oceanBottle"					: { "id" :59, "handler": "sign" },
+	"pillarOfFire"					: { "id" :60, "handler": "observatory" },
+	"starAxis"						: { "id" :61, "handler": "oncePerHero" },
+	"prison"						: { "id" :62, "handler": "hero" },
+	"pyramid"						: { "id" :63, "handler": "pyramid" },
+	"rallyFlag"						: { "id" :64, "handler": "bonusingObject" },
+	"randomArtifact"				: { "id" :65, "handler": "artifact" },
+	"randomArtifactTreasure"		: { "id" :66, "handler": "artifact" },
+	"randomArtifactMinor"			: { "id" :67, "handler": "artifact" },
+	"randomArtifactMajor"			: { "id" :68, "handler": "artifact" },
+	"randomArtifactRelic"			: { "id" :69, "handler": "artifact" },
+	"randomHero"					: { "id" :70, "handler": "hero" },
+	"randomMonster"					: { "id" :71, "handler": "monster" },
+	"randomMonsterLevel1"			: { "id" :72, "handler": "monster" },
+	"randomMonsterLevel2"			: { "id" :73, "handler": "monster" },
+	"randomMonsterLevel3"			: { "id" :74, "handler": "monster" },
+	"randomMonsterLevel4"			: { "id" :75, "handler": "monster" },
+	"randomResource"				: { "id" :76, "handler": "resource" },
+	"randomTown"					: { "id" :77, "handler": "town" },
+	"refugeeCamp"					: { "id" :78, "handler": "dwelling" },
+	"resource"						: { "id" :79, "handler": "resource" },
+	"sanctuary"						: { "id" :80, "handler": "generic" },
+	"scholar"						: { "id" :81, "handler": "scholar" },
+	"seaChest"						: { "id" :82, "handler": "pickable" },
+	"seerHut"						: { "id" :83, "handler": "seerHut" },
+	"crypt"							: { "id" :84, "handler": "bank" },
+	"shipwreck"						: { "id" :85, "handler": "bank" },
+	"shipwreckSurvivor"				: { "id" :86, "handler": "pickable" },
+	"shipyard"						: { "id" :87, "handler": "shipyard" },
+	"shrineOfMagicLevel1"			: { "id" :88, "handler": "shrine" },
+	"shrineOfMagicLevel2"			: { "id" :89, "handler": "shrine" },
+	"shrineOfMagicLevel3"			: { "id" :90, "handler": "shrine" },
+	"sign"							: { "id" :91, "handler": "sign" },
+	"sirens"						: { "id" :92, "handler": "siren" },
+	"spellScroll"					: { "id" :93, "handler": "artifact" },
+	"stables"						: { "id" :94, "handler": "bonusingObject" },
+	"tavern"						: { "id" :95, "handler": "generic" },
+	"temple"						: { "id" :96, "handler": "bonusingObject" },
+	"denOfThieves"					: { "id" :97, "handler": "denOfThieves" },
+	"town"							: { "id" :98, "handler": "town" },
+	"tradingPost"					: { "id" :99, "handler": "market" },
+	"learningStone"					: { "id" :100, "handler": "oncePerHero" },
+	"treasureChest"					: { "id" :101, "handler": "pickable" },
+	"treeOfKnowledge"				: { "id" :102, "handler": "oncePerHero" },
+	"subterraneanGate"				: { "id" :103, "handler": "teleport" },
+	"university"					: { "id" :104, "handler": "university" },
+	"wagon"							: { "id" :105, "handler": "onceVisitable" },
+	"warMachineFactory"				: { "id" :106, "handler": "dwelling" },
+	"schoolOfWar"					: { "id" :107, "handler": "oncePerHero" },
+	"warriorTomb"					: { "id" :108, "handler": "onceVisitable" },
+	"waterWheel"					: { "id" :109, "handler": "oncePerWeek" },
+	"wateringHole"					: { "id" :110, "handler": "bonusingObject" },
+	"whirlpool"						: { "id" :111, "handler": "teleport" },
+	"windmill"						: { "id" :112, "handler": "oncePerWeek" },
+	"witchHut"						: { "id" :113, "handler": "witch" },
+	"cactus"						: { "id" :116, "handler": "generic" },
+	"canyon"						: { "id" :117, "handler": "generic" },
+	"crater"						: { "id" :118, "handler": "generic" },
+	"deadVegetation"				: { "id" :119, "handler": "generic" },
+	"flowers"						: { "id" :120, "handler": "generic" },
+	"frozenLake"					: { "id" :121, "handler": "generic" },
+	"hole"							: { "id" :124, "handler": "generic" },
+	"kelp"							: { "id" :125, "handler": "generic" },
+	"lake"							: { "id" :126, "handler": "generic" },
+	"lavaFlow"						: { "id" :127, "handler": "generic" },
+	"lavaLake"						: { "id" :128, "handler": "generic" },
+	"mushrooms"						: { "id" :129, "handler": "generic" },
+	"log"							: { "id" :130, "handler": "generic" },
+	"mandrake"						: { "id" :131, "handler": "generic" },
+	"moss"							: { "id" :132, "handler": "generic" },
+	"mound"							: { "id" :133, "handler": "generic" },
+	"mountain"						: { "id" :134, "handler": "generic" },
+	"oakTrees"						: { "id" :135, "handler": "generic" },
+	"outcropping"					: { "id" :136, "handler": "generic" },
+	"pineTrees"						: { "id" :137, "handler": "generic" },
+	"riverDelta"					: { "id" :143, "handler": "generic" },
+	"rock"							: { "id" :147, "handler": "generic" },
+	"sandDune"						: { "id" :148, "handler": "generic" },
+	"sandPit"						: { "id" :149, "handler": "generic" },
+	"shrub"							: { "id" :150, "handler": "generic" },
+	"skull"							: { "id" :151, "handler": "generic" },
+	"stump"							: { "id" :153, "handler": "generic" },
+	"trees"							: { "id" :155, "handler": "generic" },
+	"volcano"						: { "id" :158, "handler": "generic" },
+	"reef"							: { "id" :161, "handler": "generic" },
+	"randomMonsterLevel5"			: { "id" :162, "handler": "monster" },
+	"randomMonsterLevel6"			: { "id" :163, "handler": "monster" },
+	"randomMonsterLevel7"			: { "id" :164, "handler": "monster" },
+	"lake"							: { "id" :177, "handler": "generic" },
+	"trees"							: { "id" :199, "handler": "generic" },
+	"desertHills"					: { "id" :206, "handler": "generic" },
+	"dirtHills"						: { "id" :207, "handler": "generic" },
+	"grassHills"					: { "id" :208, "handler": "generic" },
+	"roughHills"					: { "id" :209, "handler": "generic" },
+	"subterraneanRocks"				: { "id" :210, "handler": "generic" },
+	"swampFoliage"					: { "id" :211, "handler": "generic" },
+	"borderGate"					: { "id" :212, "handler": "borderGate" },
+	"freelancer'SGuild"				: { "id" :213, "handler": "market" },
+	"heroPlaceholder"				: { "id" :214, "handler": "heroPlaceholder" },
+	"questGuard"					: { "id" :215, "handler": "questGuard" },
+	"randomDwelling"				: { "id" :216, "handler": "dwelling" },
+	"garrison"						: { "id" :219, "handler": "garrison" },
+	"mine"							: { "id" :220, "handler": "mine" },
+	"tradingPost"					: { "id" :221, "handler": "market" },
+	"cloverField"					: { "id" :222, "handler": "generic" },
+	"cursedGround"					: { "id" :223, "handler": "generic" },
+	"evilFog"						: { "id" :224, "handler": "generic" },
+	"favorableWinds"				: { "id" :225, "handler": "generic" },
+	"fieryFields"					: { "id" :226, "handler": "generic" },
+	"holyGround"					: { "id" :227, "handler": "generic" },
+	"lucidPools"					: { "id" :228, "handler": "generic" },
+	"magicClouds"					: { "id" :229, "handler": "generic" },
+	"magicPlains"					: { "id" :230, "handler": "generic" },
+	"rocklands"						: { "id" :231, "handler": "generic" }
+}

+ 1 - 1
lib/CGameState.cpp

@@ -2,7 +2,7 @@
 #include "CGameState.h"
 
 #include "mapping/CCampaignHandler.h"
-#include "CDefObjInfoHandler.h"
+#include "CObjectClassesHandler.h"
 #include "CArtHandler.h"
 #include "CBuildingHandler.h"
 #include "CGeneralTextHandler.h"

+ 1 - 1
lib/CMakeLists.txt

@@ -62,7 +62,7 @@ set(lib_SRCS
 		CConsoleHandler.cpp
 		CCreatureHandler.cpp
 		CCreatureSet.cpp
-		CDefObjInfoHandler.cpp
+		CObjectClassesHandler.cpp
 		CGameInterface.cpp
 		CGeneralTextHandler.cpp
 		CHeroHandler.cpp

+ 1 - 1
lib/CModHandler.cpp

@@ -1,6 +1,6 @@
 #include "StdInc.h"
 #include "CModHandler.h"
-#include "CDefObjInfoHandler.h"
+#include "CObjectClassesHandler.h"
 #include "JsonNode.h"
 #include "filesystem/Filesystem.h"
 #include "filesystem/AdapterLoaders.h"

+ 6 - 4
lib/CDefObjInfoHandler.cpp → lib/CObjectClassesHandler.cpp

@@ -1,5 +1,5 @@
 #include "StdInc.h"
-#include "CDefObjInfoHandler.h"
+#include "CObjectClassesHandler.h"
 
 #include "filesystem/Filesystem.h"
 #include "filesystem/CBinaryReader.h"
@@ -14,7 +14,7 @@
 #include "CObjectConstructor.h"
 
 /*
- * CDefObjInfoHandler.cpp, part of VCMI engine
+ * CObjectClassesHandler.cpp, part of VCMI engine
  *
  * Authors: listed in file AUTHORS in main folder
  *
@@ -331,7 +331,7 @@ bool ObjectTemplate::canBePlacedAt(ETerrainType terrain) const
 	return allowedTerrains.count(terrain) != 0;
 }
 /*
-void CDefObjInfoHandler::readTextFile(std::string path)
+void CObjectClassesHandler::readTextFile(std::string path)
 {
 	CLegacyConfigParser parser(path);
 	size_t totalNumber = parser.readNumber(); // first line contains number of objects to read and nothing else
@@ -346,7 +346,7 @@ void CDefObjInfoHandler::readTextFile(std::string path)
 	}
 }
 
-CDefObjInfoHandler::CDefObjInfoHandler()
+CObjectClassesHandler::CObjectClassesHandler()
 {
 	readTextFile("Data/Objects.txt");
 	readTextFile("Data/Heroes.txt");
@@ -464,10 +464,12 @@ CObjectClassesHandler::ObjectContainter * CObjectClassesHandler::loadFromJson(co
 
 void CObjectClassesHandler::loadObject(std::string scope, std::string name, const JsonNode & data)
 {
+
 }
 
 void CObjectClassesHandler::loadObject(std::string scope, std::string name, const JsonNode & data, size_t index)
 {
+
 }
 
 std::vector<bool> CObjectClassesHandler::getDefaultAllowed() const

+ 1 - 1
lib/CDefObjInfoHandler.h → lib/CObjectClassesHandler.h

@@ -5,7 +5,7 @@
 #include "IHandlerBase.h"
 
 /*
- * CDefObjInfoHandler.h, part of VCMI engine
+ * CObjectClassesHandler.h, part of VCMI engine
  *
  * Authors: listed in file AUTHORS in main folder
  *

+ 1 - 1
lib/CObjectConstructor.h

@@ -1,7 +1,7 @@
 #pragma once
 
 #include "CObjectWithReward.h"
-#include "CDefObjInfoHandler.h"
+#include "CObjectClassesHandler.h"
 #include "JsonNode.h"
 
 /*

+ 2 - 2
lib/CObjectHandler.cpp

@@ -11,9 +11,9 @@
 #include "StdInc.h"
 #include "CObjectHandler.h"
 
-#include "CDefObjInfoHandler.h"
+#include "CObjectClassesHandler.h"
 #include "CGeneralTextHandler.h"
-#include "CDefObjInfoHandler.h"
+#include "CObjectClassesHandler.h"
 #include "CHeroHandler.h"
 #include "CSpellHandler.h"
 #include "CModHandler.h"

+ 1 - 1
lib/CObjectHandler.h

@@ -2,7 +2,7 @@
 
 #include "../lib/CCreatureSet.h"
 #include "../lib/CTownHandler.h"
-#include "../lib/CDefObjInfoHandler.h"
+#include "../lib/CObjectClassesHandler.h"
 #include "CArtHandler.h"
 #include "../lib/ConstTransitivePtr.h"
 #include "int3.h"

+ 1 - 1
lib/CTownHandler.cpp

@@ -11,7 +11,7 @@
 #include "CArtHandler.h"
 #include "CSpellHandler.h"
 #include "filesystem/Filesystem.h"
-#include "CDefObjInfoHandler.h"
+#include "CObjectClassesHandler.h"
 #include "CObjectHandler.h"
 
 /*

+ 1 - 1
lib/GameConstants.cpp

@@ -13,7 +13,7 @@
 #include "StdInc.h"
 
 #include "VCMI_Lib.h"
-#include "CDefObjInfoHandler.h"
+#include "CObjectClassesHandler.h"
 #include "CArtHandler.h"
 #include "CCreatureHandler.h"
 #include "CSpellHandler.h"

+ 1 - 1
lib/IGameCallback.cpp

@@ -25,7 +25,7 @@
 #include "CBuildingHandler.h"
 #include "GameConstants.h"
 #include "CModHandler.h"
-#include "CDefObjInfoHandler.h"
+#include "CObjectClassesHandler.h"
 #include "CBonusTypeHandler.h"
 
 #include "Connection.h"

+ 1 - 1
lib/NetPacksLib.cpp

@@ -2,7 +2,7 @@
 #include "NetPacks.h"
 
 #include "CGeneralTextHandler.h"
-#include "CDefObjInfoHandler.h"
+#include "CObjectClassesHandler.h"
 #include "CArtHandler.h"
 #include "CHeroHandler.h"
 #include "CObjectHandler.h"

+ 1 - 1
lib/VCMI_Lib.cpp

@@ -14,7 +14,7 @@
 #include "CArtHandler.h"
 #include "CBonusTypeHandler.h"
 #include "CCreatureHandler.h"
-#include "CDefObjInfoHandler.h"
+#include "CObjectClassesHandler.h"
 #include "CHeroHandler.h"
 #include "CObjectHandler.h"
 #include "CTownHandler.h"

+ 64 - 64
lib/mapping/CMap.cpp

@@ -6,7 +6,7 @@
 #include "../CCreatureHandler.h"
 #include "../CTownHandler.h"
 #include "../CHeroHandler.h"
-#include "../CDefObjInfoHandler.h"
+#include "../CObjectClassesHandler.h"
 #include "../CGeneralTextHandler.h"
 #include "../CSpellHandler.h"
 #include "CMapEditManager.h"
@@ -336,72 +336,72 @@ bool CMap::isWaterTile(const int3 &pos) const
 	return isInTheMap(pos) && getTile(pos).terType == ETerrainType::WATER;
 }
 
-bool CMap::checkForVisitableDir(const int3 & src, const TerrainTile *pom, const int3 & dst ) const
-{
-	for(ui32 b=0; b<pom->visitableObjects.size(); ++b) //checking destination tile
-	{
-		if(!vstd::contains(pom->blockingObjects, pom->visitableObjects[b])) //this visitable object is not blocking, ignore
-			continue;
-
-		const CGObjectInstance * obj = pom->visitableObjects[b];
-
-		if (!obj->appearance.isVisitableFrom(src.x - dst.x, src.y - dst.y))
-			return false;
-	}
-	return true;
+bool CMap::checkForVisitableDir(const int3 & src, const TerrainTile *pom, const int3 & dst ) const
+{
+	for(ui32 b=0; b<pom->visitableObjects.size(); ++b) //checking destination tile
+	{
+		if(!vstd::contains(pom->blockingObjects, pom->visitableObjects[b])) //this visitable object is not blocking, ignore
+			continue;
+
+		const CGObjectInstance * obj = pom->visitableObjects[b];
+
+		if (!obj->appearance.isVisitableFrom(src.x - dst.x, src.y - dst.y))
+			return false;
+	}
+	return true;
 }
 
 int3 CMap::guardingCreaturePosition (int3 pos) const
-{
-
-	const int3 originalPos = pos;
-	// Give monster at position priority.
-	if (!isInTheMap(pos))
-		return int3(-1, -1, -1);
-	const TerrainTile &posTile = getTile(pos);
-	if (posTile.visitable)
-	{
-		for (CGObjectInstance* obj : posTile.visitableObjects)
-		{
-			if(obj->blockVisit)
-			{
-				if (obj->ID == Obj::MONSTER) // Monster
-					return pos;
-				else
-					return int3(-1, -1, -1); //blockvis objects are not guarded by neighbouring creatures
-			}
-		}
-	}
-
-	// See if there are any monsters adjacent.
-	bool water = posTile.isWater();
-
-	pos -= int3(1, 1, 0); // Start with top left.
-	for (int dx = 0; dx < 3; dx++)
-	{
-		for (int dy = 0; dy < 3; dy++)
-		{
-			if (isInTheMap(pos))
-			{
-				const auto & tile = getTile(pos);
-                if (tile.visitable && (tile.isWater() == water))
-				{
-					for (CGObjectInstance* obj : tile.visitableObjects)
-					{
-						if (obj->ID == Obj::MONSTER  &&  checkForVisitableDir(pos, &posTile, originalPos)) // Monster being able to attack investigated tile
-						{
-							return pos;
-						}
-					}
-				}
-			}
-
-			pos.y++;
-		}
-		pos.y -= 3;
-		pos.x++;
-	}
-
+{
+
+	const int3 originalPos = pos;
+	// Give monster at position priority.
+	if (!isInTheMap(pos))
+		return int3(-1, -1, -1);
+	const TerrainTile &posTile = getTile(pos);
+	if (posTile.visitable)
+	{
+		for (CGObjectInstance* obj : posTile.visitableObjects)
+		{
+			if(obj->blockVisit)
+			{
+				if (obj->ID == Obj::MONSTER) // Monster
+					return pos;
+				else
+					return int3(-1, -1, -1); //blockvis objects are not guarded by neighbouring creatures
+			}
+		}
+	}
+
+	// See if there are any monsters adjacent.
+	bool water = posTile.isWater();
+
+	pos -= int3(1, 1, 0); // Start with top left.
+	for (int dx = 0; dx < 3; dx++)
+	{
+		for (int dy = 0; dy < 3; dy++)
+		{
+			if (isInTheMap(pos))
+			{
+				const auto & tile = getTile(pos);
+                if (tile.visitable && (tile.isWater() == water))
+				{
+					for (CGObjectInstance* obj : tile.visitableObjects)
+					{
+						if (obj->ID == Obj::MONSTER  &&  checkForVisitableDir(pos, &posTile, originalPos)) // Monster being able to attack investigated tile
+						{
+							return pos;
+						}
+					}
+				}
+			}
+
+			pos.y++;
+		}
+		pos.y -= 3;
+		pos.x++;
+	}
+
 	return int3(-1, -1, -1);
 }
 

+ 1 - 1
lib/mapping/CMapEditManager.cpp

@@ -3,7 +3,7 @@
 
 #include "../JsonNode.h"
 #include "../filesystem/Filesystem.h"
-#include "../CDefObjInfoHandler.h"
+#include "../CObjectClassesHandler.h"
 #include "../VCMI_Lib.h"
 
 MapRect::MapRect() : x(0), y(0), z(0), width(0), height(0)

+ 2 - 2
lib/mapping/MapFormatH3M.cpp

@@ -21,8 +21,8 @@
 #include "../CGeneralTextHandler.h"
 #include "../CHeroHandler.h"
 #include "../CObjectHandler.h"
-#include "../CObjectWithReward.h"
-#include "../CDefObjInfoHandler.h"
+#include "../CObjectWithReward.h"
+#include "../CObjectClassesHandler.h"
 #include "../VCMI_Lib.h"
 #include "../NetPacksBase.h"
 

+ 1 - 1
lib/mapping/MapFormatH3M.h

@@ -14,7 +14,7 @@
 #include "CMapService.h"
 #include "../GameConstants.h"
 #include "../ResourceSet.h"
-#include "../CDefObjInfoHandler.h"
+#include "../CObjectClassesHandler.h"
 
 #include "../int3.h"
 

+ 1 - 1
lib/registerTypes/RegisterTypes.cpp

@@ -17,7 +17,7 @@
 #include "../CTownHandler.h"
 #include "../mapping/CCampaignHandler.h"
 #include "../NetPacks.h"
-#include "../CDefObjInfoHandler.h"
+#include "../CObjectClassesHandler.h"
 
 // For reference: peak memory usage by gcc during compilation of register type templates
 // registerTypesMapObjects:  1.9 Gb

+ 1 - 1
lib/registerTypes/TypesClientPacks1.cpp

@@ -16,7 +16,7 @@
 #include "../CTownHandler.h"
 #include "../mapping/CCampaignHandler.h"
 #include "../NetPacks.h"
-#include "../CDefObjInfoHandler.h"
+#include "../CObjectClassesHandler.h"
 
 
 template void registerTypesClientPacks1<CISer<CConnection>>(CISer<CConnection>& s);

+ 1 - 1
lib/registerTypes/TypesClientPacks2.cpp

@@ -16,7 +16,7 @@
 #include "../CTownHandler.h"
 #include "../mapping/CCampaignHandler.h"
 #include "../NetPacks.h"
-#include "../CDefObjInfoHandler.h"
+#include "../CObjectClassesHandler.h"
 
 
 template void registerTypesClientPacks2<CISer<CConnection>>(CISer<CConnection>& s);

+ 1 - 1
lib/registerTypes/TypesMapObjects1.cpp

@@ -16,7 +16,7 @@
 #include "../CTownHandler.h"
 #include "../mapping/CCampaignHandler.h"
 #include "../NetPacks.h"
-#include "../CDefObjInfoHandler.h"
+#include "../CObjectClassesHandler.h"
 
 
 template void registerTypesMapObjects1<CISer<CConnection>>(CISer<CConnection>& s);

+ 1 - 1
lib/registerTypes/TypesMapObjects2.cpp

@@ -16,7 +16,7 @@
 #include "../CTownHandler.h"
 #include "../mapping/CCampaignHandler.h"
 #include "../NetPacks.h"
-#include "../CDefObjInfoHandler.h"
+#include "../CObjectClassesHandler.h"
 
 
 template void registerTypesMapObjects2<CISer<CConnection>>(CISer<CConnection>& s);

+ 1 - 1
lib/registerTypes/TypesPregamePacks.cpp

@@ -16,7 +16,7 @@
 #include "../CTownHandler.h"
 #include "../mapping/CCampaignHandler.h"
 #include "../NetPacks.h"
-#include "../CDefObjInfoHandler.h"
+#include "../CObjectClassesHandler.h"
 
 template void registerTypesPregamePacks<CISer<CConnection>>(CISer<CConnection>& s);
 template void registerTypesPregamePacks<COSer<CConnection>>(COSer<CConnection>& s);

+ 1 - 1
lib/registerTypes/TypesServerPacks.cpp

@@ -16,7 +16,7 @@
 #include "../CTownHandler.h"
 #include "../mapping/CCampaignHandler.h"
 #include "../NetPacks.h"
-#include "../CDefObjInfoHandler.h"
+#include "../CObjectClassesHandler.h"
 
 template void registerTypesServerPacks<CISer<CConnection>>(CISer<CConnection>& s);
 template void registerTypesServerPacks<COSer<CConnection>>(COSer<CConnection>& s);

+ 1 - 1
lib/rmg/CMapGenerator.cpp

@@ -17,7 +17,7 @@
 #include "../CGeneralTextHandler.h"
 #include "../mapping/CMapEditManager.h"
 #include "../CObjectHandler.h"
-#include "../CDefObjInfoHandler.h"
+#include "../CObjectClassesHandler.h"
 #include "../CTownHandler.h"
 #include "../StringConstants.h"
 #include "CRmgTemplate.h"

+ 1 - 1
server/CGameHandler.cpp

@@ -8,7 +8,7 @@
 #include "../lib/CModHandler.h"
 #include "../lib/CArtHandler.h"
 #include "../lib/CBuildingHandler.h"
-#include "../lib/CDefObjInfoHandler.h"
+#include "../lib/CObjectClassesHandler.h"
 #include "../lib/CHeroHandler.h"
 #include "../lib/CObjectHandler.h"
 #include "../lib/CSpellHandler.h"

+ 1 - 1
server/CVCMIServer.cpp

@@ -8,7 +8,7 @@
 #include "../lib/Connection.h"
 #include "../lib/CModHandler.h"
 #include "../lib/CArtHandler.h"
-#include "../lib/CDefObjInfoHandler.h"
+#include "../lib/CObjectClassesHandler.h"
 #include "../lib/CGeneralTextHandler.h"
 #include "../lib/CHeroHandler.h"
 #include "../lib/CTownHandler.h"