Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partial fix for minimap black tiles #1209

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

vfjpl
Copy link
Contributor

@vfjpl vfjpl commented Aug 12, 2023

No description provided.

@diath
Copy link
Collaborator

diath commented Aug 12, 2023

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 <contact@diath.net>
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);

@Ochmar
Copy link
Contributor

Ochmar commented Jan 15, 2024

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

@vfjpl
Copy link
Contributor Author

vfjpl commented Oct 3, 2024

Btw, this issue seems to be somewhat hardware/(other)software dependent. On new laptop and different linux version it seems like I can't easily reproduce it XD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants