diff --git a/ChangeLog b/ChangeLog index 963c4e4e4..64ba175f1 100644 --- a/ChangeLog +++ b/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 diff --git a/config/rmg.json b/config/rmg.json index 8ca2e8845..8ad5fd895 100644 --- a/config/rmg.json +++ b/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" : { diff --git a/lib/NetPacksLib.cpp b/lib/NetPacksLib.cpp index 2c700b101..c2f0ef924 100644 --- a/lib/NetPacksLib.cpp +++ b/lib/NetPacksLib.cpp @@ -163,6 +163,7 @@ DLL_LINKAGE void HeroVisitCastle::applyGs( CGameState *gs ) assert(h); assert(t); + if(start()) t->setVisitingHero(h); else diff --git a/lib/mapObjects/CGTownInstance.cpp b/lib/mapObjects/CGTownInstance.cpp index 9cb8b05a5..b43e418ab 100644 --- a/lib/mapObjects/CGTownInstance.cpp +++ b/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); diff --git a/lib/mapObjects/CObjectHandler.cpp b/lib/mapObjects/CObjectHandler.cpp index 5aee86545..eea0b1b5a 100644 --- a/lib/mapObjects/CObjectHandler.cpp +++ b/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); } diff --git a/lib/rmg/CRmgTemplateZone.cpp b/lib/rmg/CRmgTemplateZone.cpp index 598231ee2..a0fc0dba4 100644 --- a/lib/rmg/CRmgTemplateZone.cpp +++ b/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; }