1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

- Fixed uninitialized guarding creature positions

- Fix for guard placement
This commit is contained in:
DjWarmonger 2014-05-23 19:45:17 +02:00
parent 35d6215b7b
commit 75cea9206d
3 changed files with 9 additions and 6 deletions

View File

@ -1909,6 +1909,8 @@ void CGameState::initMapObjects()
} }
} }
CGTeleport::postInit(); //pairing subterranean gates CGTeleport::postInit(); //pairing subterranean gates
map->calculateGuardingGreaturePositions(); //calculate once again when all the guards are placed and initialized
} }
void CGameState::initVisitingAndGarrisonedHeroes() void CGameState::initVisitingAndGarrisonedHeroes()

View File

@ -43,8 +43,6 @@ std::unique_ptr<CMap> CMapGenerator::generate()
{ {
logGlobal->errorStream() << "Random map generation received exception: " << e.what(); logGlobal->errorStream() << "Random map generation received exception: " << e.what();
} }
map->calculateGuardingGreaturePositions(); //calculate once again when all the guards are placed
return std::move(map); return std::move(map);
} }

View File

@ -544,11 +544,14 @@ bool CRmgTemplateZone::guardObject(CMapGenerator* gen, CGObjectInstance* object,
auto it = tileinfo.find(visitable + int3(i, j, 0)); auto it = tileinfo.find(visitable + int3(i, j, 0));
if (it != tileinfo.end()) if (it != tileinfo.end())
{ {
logGlobal->infoStream() << boost::format("Block at %d %d") % it->first.x % it->first.y; if (it->first != visitable)
if ( ! it->second.isOccupied() && ! it->second.isObstacle())
{ {
tiles.push_back(it->first); logGlobal->infoStream() << boost::format("Block at %d %d") % it->first.x % it->first.y;
it->second.setObstacle(true); if (!it->second.isOccupied() && !it->second.isObstacle())
{
tiles.push_back(it->first);
it->second.setObstacle(true);
}
} }
} }
} }