Game Version number: 1.2.0.76
Modded?: Yes and no
If modded, please list the mods: N/A
Issue Description:
Not sure if it was a design oversight but SCR_MapMarkerManagerComponent has a bug where sometimes a static marker cannot be removed, after countless hours / days of pulling my hair out I think I've found the reason for it and it's due to the overall design of the scripted system.
When you add a static marker it's stored in an array called m_aStaticMarkers, that's cool and all but there is additional processes happening specifically in Update where I can only assume it's checking for markers within the camera pan of the map view, if they're outside of the view they get added to an array called m_aDisabledMarkers and removed from m_aStaticMarkers.
So what's the issue? The issue is in the call chain of the removal. When you want to remove a static marker you call RemoveStaticMarker this eventually leads to OnRemoveSynchedMarker which only searches and removes from m_aStaticMarkers and not m_aDisabledMarkers so if a user is panning around in the map and that marker is "disabled / out of view" when the event is called they will get stuck with a static marker that will never be removed.
Possible solution:
SCR_MapMarkerBase GetStaticMarkerByID(int markerID) { foreach ( SCR_MapMarkerBase marker : m_aStaticMarkers ) { if (markerID == marker.GetMarkerID()) return marker; } foreach ( SCR_MapMarkerBase marker : m_aDisabledMarkers ) { if (markerID == marker.GetMarkerID()) return marker; } return null; } void OnRemoveSynchedMarker(int markerID) { SCR_MapMarkerBase marker = GetStaticMarkerByID(markerID); if (marker) marker.OnDelete(); m_aStaticMarkers.RemoveItem(marker); m_aDisabledMarkers.RemoveItem(marker); }
Or just some other solution entirely where you have a master list of markers and then you have the static array and disabled array.. Or a flag in the mapmarkerbase its self saying its disabled and using only the array m_aStaticMarkers