Minor fix

This commit is contained in:
Jean-Patrick Guerrero 2021-04-06 03:13:44 +02:00
parent 91b88e81af
commit c4a05272ce

View File

@ -2501,11 +2501,12 @@ i3.new_tab {
elseif fields.waypoint_add then
data.waypoints = data.waypoints or {}
data.waypoint_id = data.waypoint_id + 1
local waypoint = fields.waypoint_name
local last = #data.waypoints + 1
data.waypoint_id = last
if fields.waypoint_name == "" then
waypoint = fmt("Waypoint %u", #data.waypoints + 1)
waypoint = fmt("Waypoint %u", last)
end
local color = random(0xffffff)
@ -2526,6 +2527,7 @@ i3.new_tab {
local waypoint = data.waypoints[data.waypoint_id]
player:hud_remove(waypoint.id)
remove(data.waypoints, data.waypoint_id)
data.waypoint_id = data.waypoint_id + (data.waypoint_id == 1 and 0 or -1)
elseif fields.waypoint_teleport then
local waypoint = data.waypoints[data.waypoint_id]