diff --git a/data/modules/FlightLog/FlightLogEntries.lua b/data/modules/FlightLog/FlightLogEntries.lua index 57f59d15a70..acce3b2de8b 100644 --- a/data/modules/FlightLog/FlightLogEntries.lua +++ b/data/modules/FlightLog/FlightLogEntries.lua @@ -49,8 +49,8 @@ function FlightLogEntry.Base:GetEntry() return self.entry end ----@return boolean true if this has a Delete() method -function FlightLogEntry.Base:SupportsDelete() +---@return boolean true if this can be removed from the flightlog method +function FlightLogEntry.Base:CanBeRemoved() return false end @@ -303,17 +303,10 @@ function FlightLogEntry.Custom:GetDataPairs( earliest_first ) end ---@return boolean true if this has a Delete() method -function FlightLogEntry.Custom:SupportsDelete() +function FlightLogEntry.Custom:CanBeRemoved() return true end ----Delete this entry ----@return nil -function FlightLogEntry.Custom:Delete() - FlightLogEntry.TotalDefaultElements = FlightLogEntry.TotalDefaultElements - 1 - utils.remove_elem( FlightLogData, self ) -end - ---@class FlightLogEntry.Station : FlightLogEntry.Base ---@field systemp SystemPath The system the player is in when the log was written ---@field time deptime The game time the log was made, on departure from teh system, relative to the epoch diff --git a/data/pigui/modules/info-view/06-flightlog.lua b/data/pigui/modules/info-view/06-flightlog.lua index bc156df4d99..e712178406b 100644 --- a/data/pigui/modules/info-view/06-flightlog.lua +++ b/data/pigui/modules/info-view/06-flightlog.lua @@ -113,9 +113,9 @@ local function renderLog( formatter ) ui.nextColumn() end - if entry:SupportsDelete() then + if entry:CanBeRemoved() then if ui.iconButton(icons.trashcan, buttonSpaceSize, l.REMOVE .. "##custom" .. counter) then - entry:Delete() + FlightLog:RemoveEntry( entry ) -- if we were already in edit mode, reset it, or else it carries over to next iteration entering_text = false end