From c718584755960bb7c312072b49466befaed51511 Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 24 Jul 2021 23:25:26 +0200 Subject: [PATCH] Update OpsGroup.lua --- Moose Development/Moose/Ops/OpsGroup.lua | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Moose Development/Moose/Ops/OpsGroup.lua b/Moose Development/Moose/Ops/OpsGroup.lua index a4ec949b2..b3c912dfa 100644 --- a/Moose Development/Moose/Ops/OpsGroup.lua +++ b/Moose Development/Moose/Ops/OpsGroup.lua @@ -6087,12 +6087,18 @@ end --- Clear waypoints. -- @param #OPSGROUP self -function OPSGROUP:ClearWaypoints() +-- @param #number IndexMin Clear waypoints up to this min WP index. Default 1. +-- @param #number IndexMax Clear waypoints up to this max WP index. Default `#self.waypoints`. +function OPSGROUP:ClearWaypoints(IndexMin, IndexMax) + + IndexMin=IndexMin or 1 + IndexMax=IndexMax or #self.waypoints + -- Clear all waypoints. - for i=1,#self.waypoints do + for i=IndexMax,IndexMin,-1 do table.remove(self.waypoints, i) end - self.waypoints={} + --self.waypoints={} end --- Set (new) cargo status. @@ -6768,7 +6774,7 @@ function OPSGROUP:onafterBoard(From, Event, To, CarrierGroup, Carrier) local Coordinate=Carrier.unit:GetCoordinate() -- Clear all waypoints. - self:ClearWaypoints() + self:ClearWaypoints(self.currentwp+1) if self.isArmygroup then local waypoint=ARMYGROUP.AddWaypoint(self, Coordinate) ; waypoint.detour=0