otclient icon indicating copy to clipboard operation
otclient copied to clipboard

Partial fix for minimap black tiles

Open vfjpl opened this issue 1 year ago • 3 comments

vfjpl avatar Aug 12 '23 09:08 vfjpl

I have noticed that I have a more proper fix that doesn't completely remove the map view tile updates locally that I didn't push upstream, could you test if this fixes the issue?

From cd3fdc24a85a8c7c6911724c18962a26c0dd3267 Mon Sep 17 00:00:00 2001
From: Kamil Chojnowski <[email protected]>
Date: Thu, 24 Sep 2020 14:08:07 +0200
Subject: [PATCH] Fix minimap tiles with walking creatures being reset under
 some circumstances

---
 src/client/creature.cpp |  2 +-
 src/client/map.cpp      | 10 ++++++----
 src/client/map.h        |  2 +-
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/client/creature.cpp b/src/client/creature.cpp
index ca1a4cab..308ae337 100644
--- a/src/client/creature.cpp
+++ b/src/client/creature.cpp
@@ -737,7 +737,7 @@ void Creature::updateWalkingTile()
 
             // recache visible tiles in map views
             if(newWalkingTile->isEmpty())
-                g_map.notificateTileUpdate(newWalkingTile->getPosition());
+                g_map.notificateTileUpdate(newWalkingTile->getPosition(), true);
         }
         m_walkingTile = newWalkingTile;
     }
diff --git a/src/client/map.cpp b/src/client/map.cpp
index 79312336..05c69f96 100644
--- a/src/client/map.cpp
+++ b/src/client/map.cpp
@@ -31,7 +31,7 @@ void Map::setMapView(const MapViewPtr &view)
     m_mapView = view;
 }
 
-void Map::notificateTileUpdate(const Position& pos)
+void Map::notificateTileUpdate(const Position& pos, const bool ignoreMinimap/* = false*/)
 {
     if(!pos.isMapPosition())
         return;
@@ -40,9 +40,11 @@ void Map::notificateTileUpdate(const Position& pos)
         m_mapView->onTileUpdate(pos);
     }
 
-    LocalPlayerPtr localPlayer = g_game.getLocalPlayer();
-    if (localPlayer && (localPlayer->getFakePosition().z == pos.z || localPlayer->getPosition().z == pos.z)) {
-        g_minimap.updateTile(pos, getTile(pos));
+    if (!ignoreMinimap) {
+        LocalPlayerPtr localPlayer = g_game.getLocalPlayer();
+        if (localPlayer && (localPlayer->getFakePosition().z == pos.z || localPlayer->getPosition().z == pos.z)) {
+            g_minimap.updateTile(pos, getTile(pos));
+        }
     }
 }
 
diff --git a/src/client/map.h b/src/client/map.h
index f87e0a3f..8b61d893 100644
--- a/src/client/map.h
+++ b/src/client/map.h
@@ -67,7 +67,7 @@ class Map
     void terminate();
 
     void setMapView(const MapViewPtr &view);
-    void notificateTileUpdate(const Position& pos);
+    void notificateTileUpdate(const Position& pos, const bool ignoreMinimap = false);
 
     bool loadOtcm(const std::string& fileName);
     void saveOtcm(const std::string& fileName);

diath avatar Aug 12 '23 23:08 diath

From my tests solution proposed by @diath; is better, but I have a lot of changes on my fork that could also influence minimap behavior. Would be great to raise some awareness and push it forward, does not seem to be that hard

Ochmar avatar Jan 15 '24 18:01 Ochmar