View Single Post
07-24-18, 05:14 AM   #1
Ferodra
A Defias Bandit
Join Date: Jul 2018
Posts: 3
Using the new Map API

Hey guys!

I'm currently working on my own UI and already coded a lot of modules.
One of those modules adds markers to the worldmap which show old dungeon/raid entrances.

Since 8.0, i have to check the current Map ID via OnUpdate, since there seems to be no event anymore that indicates a change of the viewed zone.
My method to retrieve the current zone looks like that:

Code:
local EmptyMapInfo = {0, 0, 0, 0}
function WM:UpdateCurrentZone()
	self.CurrentZone	= WorldMapFrame:GetMapID()
	if not self.CurrentZone then
		self.MapInfo 		= EmptyMapInfo
	else
		self.MapInfo		= C_Map.GetMapInfo(self.CurrentZone)
	end
end
I still have to set the MapInfo to empty by value of course.
But the main problem is that C_Map.GetMapInfo now returns a table.
And since this runs OnUpdate, yeah. The memory skyrockets.

I'm also experiencing the same problem with my coordinate module. But there i use C_Map.GetPlayerMapPosition. This also returns a table.
I already throttled the updates.

But there must be a workaround, right?

Thanks in advance!
  Reply With Quote