mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
Corrected y-axis orientation, now object placement is correct.
This commit is contained in:
parent
492b866806
commit
6c0a396094
@ -367,7 +367,9 @@ int3 ObjectTemplate::getVisitableOffset() const
|
||||
|
||||
bool ObjectTemplate::isVisitableFromTop() const
|
||||
{
|
||||
return isVisitableFrom (0, 1);
|
||||
return visitDir & 2;
|
||||
//for some reason the line below is never called :?
|
||||
//return isVisitableFrom (0, 1);
|
||||
}
|
||||
|
||||
bool ObjectTemplate::canBePlacedAt(ETerrainType terrain) const
|
||||
|
@ -750,7 +750,7 @@ bool CRmgTemplateZone::createTreasurePile (CMapGenerator* gen, int3 &pos)
|
||||
{
|
||||
if (closestFreeTile.dist2d(visitablePos) < minDistance)
|
||||
{
|
||||
closestTile = visitablePos - int3 (0,-1, 0); //start below object, possibly even outside the map (?)
|
||||
closestTile = visitablePos + int3 (0, 1, 0); //start below object (y+1), possibly even outside the map (?)
|
||||
minDistance = closestFreeTile.dist2d(visitablePos);
|
||||
}
|
||||
}
|
||||
@ -791,7 +791,7 @@ bool CRmgTemplateZone::createTreasurePile (CMapGenerator* gen, int3 &pos)
|
||||
{
|
||||
gen->foreach_neighbour (tile, [tile, &boundary](int3 pos)
|
||||
{
|
||||
if (tile.y >= pos.y) //don't block these objects from above
|
||||
if (pos.y >= tile.y) //don't block these objects from above
|
||||
boundary.insert(pos);
|
||||
});
|
||||
}
|
||||
@ -1445,6 +1445,7 @@ ObjectInfo CRmgTemplateZone::getRandomObject (CMapGenerator* gen, CTreasurePileI
|
||||
continue;
|
||||
}
|
||||
|
||||
//NOTE: y coordinate grows downwards
|
||||
if (info.visitableFromBottomPositions.size() + info.visitableFromTopPositions.size()) //do not try to match first object in zone
|
||||
{
|
||||
bool fitsHere = false;
|
||||
@ -1463,7 +1464,7 @@ ObjectInfo CRmgTemplateZone::getRandomObject (CMapGenerator* gen, CTreasurePileI
|
||||
for (auto tile : info.visitableFromBottomPositions)
|
||||
{
|
||||
int3 actualTile = tile + newVisitableOffset;
|
||||
if (newVisitablePos.areNeighbours(actualTile) && newVisitablePos.y <= actualTile.y) //we access existing static object from side or bottom only
|
||||
if (newVisitablePos.areNeighbours(actualTile) && newVisitablePos.y >= actualTile.y) //we access existing static object from side or bottom only
|
||||
{
|
||||
fitsHere = true;
|
||||
break;
|
||||
@ -1475,7 +1476,7 @@ ObjectInfo CRmgTemplateZone::getRandomObject (CMapGenerator* gen, CTreasurePileI
|
||||
for (auto tile : info.visitableFromTopPositions)
|
||||
{
|
||||
int3 actualTile = tile + newVisitableOffset;
|
||||
if (newVisitablePos.areNeighbours(actualTile) && newVisitablePos.y >= actualTile.y) //we access existing removable object from top or side only
|
||||
if (newVisitablePos.areNeighbours(actualTile) && newVisitablePos.y <= actualTile.y) //we access existing removable object from top or side only
|
||||
{
|
||||
fitsHere = true;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user