1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-06-02 01:11:32 +00:00

Fix local map issues

This commit is contained in:
Evil Eye 2024-06-13 23:03:57 +02:00
parent b001deeff7
commit 5a54cd9406
2 changed files with 11 additions and 15 deletions

View file

@ -679,6 +679,9 @@ namespace MWGui
mWeapBox->setUserData(MyGUI::Any::Null); mWeapBox->setUserData(MyGUI::Any::Null);
mSpellBox->clearUserStrings(); mSpellBox->clearUserStrings();
mSpellBox->setUserData(MyGUI::Any::Null); mSpellBox->setUserData(MyGUI::Any::Null);
mActiveCell = nullptr;
mHasALastActiveCell = false;
} }
void HUD::customMarkerCreated(MyGUI::Widget* marker) void HUD::customMarkerCreated(MyGUI::Widget* marker)

View file

@ -82,7 +82,7 @@ namespace
MyGUI::IntRect createRect(const MyGUI::IntPoint& center, int radius) MyGUI::IntRect createRect(const MyGUI::IntPoint& center, int radius)
{ {
return { center.left - radius, center.top + radius, center.left + radius, center.top - radius }; return { center.left - radius, center.top - radius, center.left + radius, center.top + radius };
} }
int getLocalViewingDistance() int getLocalViewingDistance()
@ -387,16 +387,6 @@ namespace MWGui
if (cell.isExterior()) if (cell.isExterior())
{ {
int curX = 0;
int curY = 0;
if (mActiveCell)
{
curX = mActiveCell->getGridX();
curY = mActiveCell->getGridY();
}
const MyGUI::IntRect intersection = { std::max(x, curX) - mCellDistance, std::max(y, curY) - mCellDistance,
std::min(x, curX) + mCellDistance, std::min(y, curY) + mCellDistance };
const MyGUI::IntRect activeGrid = createRect({ x, y }, Constants::CellGridRadius); const MyGUI::IntRect activeGrid = createRect({ x, y }, Constants::CellGridRadius);
const MyGUI::IntRect currentView = createRect({ x, y }, mCellDistance); const MyGUI::IntRect currentView = createRect({ x, y }, mCellDistance);
@ -416,10 +406,13 @@ namespace MWGui
for (auto& widget : mDoorMarkersToRecycle) for (auto& widget : mDoorMarkersToRecycle)
widget->setVisible(false); widget->setVisible(false);
for (auto const& entry : mMaps) if (mHasALastActiveCell)
{ {
if (mHasALastActiveCell && !intersection.inside({ entry.mCellX, entry.mCellY })) for (const auto& entry : mMaps)
mLocalMapRender->removeExteriorCell(entry.mCellX, entry.mCellY); {
if (!currentView.inside({ entry.mCellX, entry.mCellY }))
mLocalMapRender->removeExteriorCell(entry.mCellX, entry.mCellY);
}
} }
} }
@ -513,7 +506,7 @@ namespace MWGui
if (markers.empty()) if (markers.empty())
return; return;
std::string markerTexture; std::string_view markerTexture;
if (type == MWBase::World::Detect_Creature) if (type == MWBase::World::Detect_Creature)
{ {
markerTexture = "textures\\detect_animal_icon.dds"; markerTexture = "textures\\detect_animal_icon.dds";