Skip to content
This repository has been archived by the owner on Mar 8, 2024. It is now read-only.

Commit

Permalink
Fix the problem that the map editor crashes when placing building nea…
Browse files Browse the repository at this point in the history
…r the map boundary
  • Loading branch information
secsome committed Aug 31, 2023
1 parent 55cafea commit 6c30c32
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion FA2pp
Submodule FA2pp updated 1 files
+13 −0 CINI.h
12 changes: 10 additions & 2 deletions FA2sp/Ext/CMapValidator/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,21 @@ void CMapValidatorExt::ValidateStructureOverlapping(BOOL& result)
for (int dx = 0; dx < DataExt.Height; ++dx)
{
for (int dy = 0; dy < DataExt.Width; ++dy)
Occupied[CMapData::Instance->GetCoordIndex(X + dx, Y + dy)].emplace_back(splits[1].m_pchData);
{
MapCoord coord = { X + dx, Y + dy };
if (CMapData::Instance->IsCoordInMap(coord.X, coord.Y))
Occupied[CMapData::Instance->GetCoordIndex(coord.X, coord.Y)].emplace_back(splits[1].m_pchData);
}
}
}
else
{
for (const auto& block : *DataExt.Foundations)
Occupied[CMapData::Instance->GetCoordIndex(X + block.Y, Y + block.X)].emplace_back(splits[1].m_pchData);
{
MapCoord coord = { X + block.Y, Y + block.X };
if (CMapData::Instance->IsCoordInMap(coord.X, coord.Y))
Occupied[CMapData::Instance->GetCoordIndex(coord.X, coord.Y)].emplace_back(splits[1].m_pchData);
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion FA2sp/Ext/CPropertyBuilding/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ DEFINE_HOOK(417F40, CPropertyBuilding_OnInitDialog, 7)
for (const auto& upgrade : upgrades)
{
const auto UIName = CMapData::Instance->GetUIName(upgrade.c_str());
const auto name = std::format("{} ({})", upgrade, UIName);
const auto name = std::format("{} ({})", upgrade, UIName.m_pchData);

for (int i = 0; i < nUpgrades; ++i)
pUpgrades[i]->AddString(name.c_str());
Expand Down

0 comments on commit 6c30c32

Please sign in to comment.