From 4d913f0033bd56acb86ad9d42237246d01a44a51 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Fri, 22 Nov 2013 12:36:47 +0100 Subject: [Sectors] don’t catch erroneous last/best values... MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/gugus/sector.lua | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/scripts/gugus/sector.lua b/scripts/gugus/sector.lua index c942888..a3814f6 100644 --- a/scripts/gugus/sector.lua +++ b/scripts/gugus/sector.lua @@ -40,14 +40,12 @@ function SectorUpdate() local Bs1 = mBestSectors[1] local Bs2 = mBestSectors[2] local Bs3 = mBestSectors[3] - if laps > 0 then - if mOldSector == 1 then - if Bs1 == 0 then Bs1 = math.min(bs1, ls1) else Bs1 = math.min(Bs1, bs1, ls1) end - elseif mOldSector == 2 then - if Bs2 == 0 then Bs2 = math.min(bs2, ls2) else Bs2 = math.min(Bs2, bs2, ls2) end - else -- mOldSector == 3 - if Bs3 == 0 then Bs3 = math.min(bs3, ls3) else Bs3 = math.min(Bs3, bs3, ls3) end - end + -- Don’t compute Best sector times if irrelevant last lap time. + if llt >= 0 then + if Bs1 ~= 0 then Bs1 = math.min(Bs1, bs1, ls1) else Bs1 = math.min(bs1, ls1) end + if Bs2 ~= 0 then Bs2 = math.min(Bs2, bs2, ls2) else Bs2 = math.min(bs2, ls2) end + if Bs3 ~= 0 then Bs3 = math.min(Bs3, bs3, ls3) else Bs3 = math.min(bs3, ls3) end + -- store new values mBestSectors[1] = Bs1 mBestSectors[2] = Bs2 mBestSectors[3] = Bs3 -- cgit v1.2.3