1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 20:29:57 +00:00

Address feedback

This commit is contained in:
Evil Eye 2024-03-08 17:09:49 +01:00
parent b055367b3b
commit 504a9e7d43

View file

@ -96,11 +96,11 @@ namespace
viewingDistanceInCells, Constants::CellGridRadius, Settings::map().mMaxLocalViewingDistance.get()); viewingDistanceInCells, Constants::CellGridRadius, Settings::map().mMaxLocalViewingDistance.get());
} }
ESM::RefId getCellIdInWorldSpace(const MWWorld::Cell* cell, int x, int y) ESM::RefId getCellIdInWorldSpace(const MWWorld::Cell& cell, int x, int y)
{ {
if (cell->isExterior()) if (cell.isExterior())
return ESM::Cell::generateIdForCell(true, {}, x, y); return ESM::Cell::generateIdForCell(true, {}, x, y);
return cell->getId(); return cell.getId();
} }
} }
@ -260,9 +260,8 @@ namespace MWGui
{ {
// normalized cell coordinates // normalized cell coordinates
auto mapWidgetSize = getWidgetSize(); auto mapWidgetSize = getWidgetSize();
return MyGUI::IntPoint( return MyGUI::IntPoint(std::round((nX + mCellDistance + cellX - mActiveCell->getGridX()) * mapWidgetSize),
std::round(nX * mapWidgetSize + (mCellDistance + (cellX - mActiveCell->getGridX())) * mapWidgetSize), std::round((nY + mCellDistance - cellY + mActiveCell->getGridY()) * mapWidgetSize));
std::round(nY * mapWidgetSize + (mCellDistance - (cellY - mActiveCell->getGridY())) * mapWidgetSize));
} }
MyGUI::IntPoint LocalMapBase::getMarkerPosition(float worldX, float worldY, MarkerUserData& markerPos) const MyGUI::IntPoint LocalMapBase::getMarkerPosition(float worldX, float worldY, MarkerUserData& markerPos) const
@ -350,7 +349,7 @@ namespace MWGui
for (int dY = -mCellDistance; dY <= mCellDistance; ++dY) for (int dY = -mCellDistance; dY <= mCellDistance; ++dY)
{ {
ESM::RefId cellRefId ESM::RefId cellRefId
= getCellIdInWorldSpace(mActiveCell, mActiveCell->getGridX() + dX, mActiveCell->getGridY() + dY); = getCellIdInWorldSpace(*mActiveCell, mActiveCell->getGridX() + dX, mActiveCell->getGridY() + dY);
CustomMarkerCollection::RangeType markers = mCustomMarkers.getMarkers(cellRefId); CustomMarkerCollection::RangeType markers = mCustomMarkers.getMarkers(cellRefId);
for (CustomMarkerCollection::ContainerType::const_iterator it = markers.first; it != markers.second; for (CustomMarkerCollection::ContainerType::const_iterator it = markers.first; it != markers.second;
@ -892,7 +891,7 @@ namespace MWGui
mEditingMarker.mWorldX = worldPos.x(); mEditingMarker.mWorldX = worldPos.x();
mEditingMarker.mWorldY = worldPos.y(); mEditingMarker.mWorldY = worldPos.y();
ESM::RefId clickedId = getCellIdInWorldSpace(mActiveCell, x, y); ESM::RefId clickedId = getCellIdInWorldSpace(*mActiveCell, x, y);
mEditingMarker.mCell = clickedId; mEditingMarker.mCell = clickedId;