From 15fa1b9be2688cc7aa7594f742ac9e98f80f3e3d Mon Sep 17 00:00:00 2001 From: James Whitehead II Date: Sat, 5 Apr 2008 12:59:05 +0000 Subject: [PATCH] * Stop duplicate waypoints from being set --- TomTom.lua | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/TomTom.lua b/TomTom.lua index 79df88b..724ba26 100755 --- a/TomTom.lua +++ b/TomTom.lua @@ -639,15 +639,26 @@ function TomTom:AddZWaypoint(c, z, x, y, desc, persistent, minimap, world) if persistent == nil then persistent = self.profile.persistence.savewaypoints end if minimap == nil then minimap = true end if world == nil then world = true end + + local coord = self:GetCoord(x / 100, y / 100) + local zone = self:GetMapFile(c, z) + -- Ensure there isn't already a waypoint at this location + if waypoints[zone] then + for uid in pairs(waypoints[zone]) do + local data = waypoints[uid] + if data.title == desc and data.coord == coord then + -- This is a duplicate waypoint + return + end + end + end + local uid = self:SetWaypoint(c,z,x/100,y/100, callbacks, minimap, world) if self.profile.arrow.autoqueue then self:SetCrazyArrow(uid, self.profile.arrow.arrival, desc) end - local coord = self:GetCoord(x / 100, y / 100) - local zone = self:GetMapFile(c, z) - waypoints[uid] = { title = desc, coord = coord, -- 1.7.9.5