Skip to content

Commit

Permalink
fix: highlight position
Browse files Browse the repository at this point in the history
  • Loading branch information
mehah committed Sep 30, 2023
1 parent a6dfacf commit f171949
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/client/mapview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ void MapView::updateVisibleTiles()

m_updateVisibleTiles = false;
m_resetCoveredCache = false;
updateHighlightTile();
updateHighlightTile(m_mousePosition);
}

void MapView::updateRect(const Rect& rect) {
Expand Down Expand Up @@ -475,7 +475,7 @@ void MapView::onMouseMove(const Position& mousePos, const bool /*isVirtualMove*/
{
{ // Highlight Target System
destroyHighlightTile();
updateHighlightTile();
updateHighlightTile(mousePos);
}
}

Expand Down Expand Up @@ -849,9 +849,9 @@ void MapView::setCrosshairTexture(const std::string& texturePath)
m_crosshairTexture = texturePath.empty() ? nullptr : g_textures.getTexture(texturePath);
}

void MapView::updateHighlightTile() {
void MapView::updateHighlightTile(const Position& mousePos) {
if (m_drawHighlightTarget) {
if ((m_lastHighlightTile = (m_shiftPressed ? getTopTile(m_mousePosition) : g_map.getTile(m_mousePosition))))
if ((m_lastHighlightTile = (m_shiftPressed ? getTopTile(mousePos) : g_map.getTile(mousePos))))
m_lastHighlightTile->select(m_shiftPressed ? TileSelectType::NO_FILTERED : TileSelectType::FILTERED);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/client/mapview.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ class MapView : public LuaObject
void updateViewportDirectionCache();
void drawFloor();

void updateHighlightTile();
void updateHighlightTile(const Position& mousePos);
void destroyHighlightTile();

void updateViewport(const Otc::Direction dir = Otc::InvalidDirection) { m_viewport = m_viewPortDirection[dir]; }
Expand Down

0 comments on commit f171949

Please sign in to comment.