fixed buildings will not be drawn when crossing map edges .

close #90
This commit is contained in:
Zero Fanker 2024-09-30 19:48:45 -04:00
parent 34a09e9aca
commit 462cd5bf77
2 changed files with 16 additions and 2 deletions

View file

@ -5453,7 +5453,18 @@ void CIsoView::DrawMap()
// for structures we need to check if they weren´t drawn earlier
// (every field that this building achieves has this building as .structure)
if (Map->GetStructureAt(mapCoords - MapVec(-1, 0)) != m.structure && Map->GetStructureAt(mapCoords - MapVec(0, -1)) != m.structure) {
auto const leftStructureIdx = Map->GetStructureAt(mapCoords - MapVec(-1, 0));
auto const rightStructureIdx = Map->GetStructureAt(mapCoords - MapVec(0, -1));
bool shouldDraw = true;
if (leftStructureIdx == m.structure || rightStructureIdx == m.structure) {
shouldDraw = false;
}
if (mapCoords.x >= Map->GetWidth() || mapCoords.y >= Map->GetHeight()) {
shouldDraw = true;
}
if (shouldDraw) {
STRUCTUREPAINT objp;
Map->GetStructurePaint(m.structure, &objp);

View file

@ -307,7 +307,10 @@ public:
}
INT GetStructureAt(DWORD dwPos) const
{
if (fielddata[dwPos].structure > -1) return fielddata[dwPos].structure; return -1;
if (fielddata[dwPos].structure > -1) {
return fielddata[dwPos].structure;
}
return -1;
}
INT GetStructureAt(MapCoords pos) const
{