From 3de4abc6082ea735d4b70ca12cac1ea503ce5ff9 Mon Sep 17 00:00:00 2001 From: James Whitehead II Date: Sat, 3 May 2008 22:07:00 +0000 Subject: [PATCH] * Added a public API to allow for custom callbacks that work with the frontend --- TomTom.lua | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/TomTom.lua b/TomTom.lua index c40b054..f14529a 100755 --- a/TomTom.lua +++ b/TomTom.lua @@ -621,21 +621,26 @@ function TomTom:AddWaypoint(x, y, desc, persistent, minimap, world) return self:AddZWaypoint(c, z, x, y, desc, persistent, minimap, world) end -function TomTom:AddZWaypoint(c, z, x, y, desc, persistent, minimap, world) - local callbacks = { - minimap = { - onclick = _both_onclick, - tooltip_show = _minimap_tooltip_show, - tooltip_update = _both_tooltip_update, - }, - world = { - onclick = _both_onclick, - tooltip_show = _world_tooltip_show, - tooltip_update = _both_tooltip_show, - }, - distance = { - }, - } +function TomTom:AddZWaypoint(c, z, x, y, desc, persistent, minimap, world, custom_callbacks) + local callbacks + if custom_callbacks then + callbacks = custom_callbacks + else + callbacks = { + minimap = { + onclick = _both_onclick, + tooltip_show = _minimap_tooltip_show, + tooltip_update = _both_tooltip_update, + }, + world = { + onclick = _both_onclick, + tooltip_show = _world_tooltip_show, + tooltip_update = _both_tooltip_show, + }, + distance = { + }, + } + end local cleardistance = self.profile.persistence.cleardistance if cleardistance > 0 then @@ -689,8 +694,11 @@ function TomTom:AddZWaypoint(c, z, x, y, desc, persistent, minimap, world) return uid end --- Code taken from HandyNotes, thanks Xinhuan +function TomTom:SetCustomWaypoint(c,z,x,y,callback,minimap,world) + return self:AddZWaypoint(c, z, x, y, desc, false, minimap, world, callback) +end +-- Code taken from HandyNotes, thanks Xinhuan --------------------------------------------------------- -- Public functions for plugins to convert between MapFile <-> C,Z -- -- 1.7.9.5