2
0
DjWarmonger 11 жил өмнө
parent
commit
bda71bed83

+ 1 - 1
ChangeLog

@@ -15,7 +15,7 @@ SPELLS:
 * New configuration format: http://wiki.vcmi.eu/index.php?title=Spell_Format
 
 RANDOM MAP GENERATOR
-* Towns from mods can be used
+* Towns form mods cna be used
 * Reading connections, terrains, towns and mines from template
 * Zone placement
 * Zone borders and connections, fractalized paths inside zones

+ 2 - 2
config/rmg.json

@@ -2,7 +2,7 @@
 {
 	"Analogy" : 
 	{
-		"minSize" : "s", "maxSize" : "m",
+		"minSize" : "m", "maxSize" : "m",
 		"players" : "4",
 		"zones" :
 		{
@@ -63,7 +63,7 @@
 	},
 	"Upgrade" :
 	{
-		"minSize" : "m", "maxSize" : "m",
+		"minSize" : "s", "maxSize" : "m",
 		"players" : "2",
 		"zones" :
 		{

+ 1 - 0
lib/NetPacksLib.cpp

@@ -163,6 +163,7 @@ DLL_LINKAGE void HeroVisitCastle::applyGs( CGameState *gs )
 
 	assert(h);
 	assert(t);
+
 	if(start())
 		t->setVisitingHero(h);
 	else

+ 7 - 1
lib/mapObjects/CGTownInstance.cpp

@@ -907,7 +907,13 @@ bool CGTownInstance::addBonusIfBuilt(BuildingID building, Bonus::BonusType type,
 
 void CGTownInstance::setVisitingHero(CGHeroInstance *h)
 {
-	assert(!!visitingHero == !h);
+	if (!(!!visitingHero == !h))
+	{
+		logGlobal->warnStream() << boost::format("Hero visiting town %s is %s ") % name % (visitingHero.get() ? visitingHero->name : "NULL");
+		logGlobal->warnStream() << boost::format("New hero will be %s ") % (h ? h->name : "NULL");
+		assert(!!visitingHero == !h);
+	}
+
 	if(h)
 	{
 		PlayerState *p = cb->gameState()->getPlayer(h->tempOwner);

+ 1 - 1
lib/mapObjects/CObjectHandler.cpp

@@ -246,7 +246,7 @@ int3 CGObjectInstance::getVisitableOffset() const
 			if (appearance.isVisitableAt(x, y))
 				return int3(x,y,0);
 
-    logGlobal->warnStream() << "Warning: getVisitableOffset called on non-visitable obj!";
+    //logGlobal->warnStream() << "Warning: getVisitableOffset called on non-visitable obj!";
 	return int3(0,0,0);
 }
 

+ 6 - 3
lib/rmg/CRmgTemplateZone.cpp

@@ -761,7 +761,7 @@ void CRmgTemplateZone::initTownType (CMapGenerator* gen)
 			playerInfo.allowedFactions.clear();
 			playerInfo.allowedFactions.insert (townType);
 			playerInfo.hasMainTown = true;
-			playerInfo.posOfMainTown = town->pos - int3(2, 0, 0);
+			playerInfo.posOfMainTown = town->pos - town->getVisitableOffset();
 			playerInfo.generateHeroAtMainTown = true;
 
 			//now create actual towns
@@ -1264,8 +1264,11 @@ bool CRmgTemplateZone::guardObject(CMapGenerator* gen, CGObjectInstance* object,
 
 		gen->setOccupied (guardTile, ETileType::USED);
 	}
-	else
-		gen->setOccupied (guardTile, ETileType::FREE);
+	else //allow no guard or other object in front of this object
+	{
+		for (auto tile : tiles)
+			gen->setOccupied (tile, ETileType::FREE);
+	}
 
 	return true;
 }