diff options
author | Hugues Hiegel <hugues@hiegel.fr> | 2013-11-22 12:36:47 +0100 |
---|---|---|
committer | Hugues Hiegel <hugues@hiegel.fr> | 2013-11-22 12:36:47 +0100 |
commit | 4d913f0033bd56acb86ad9d42237246d01a44a51 (patch) | |
tree | 4138aac20cdd2c48c81ce078e97a63d428ad5722 | |
parent | 9e5c044ad683f913ca486dc4d45f9c5e4aa2b280 (diff) |
[Sectors] don’t catch erroneous last/best values...
-rw-r--r-- | scripts/gugus/sector.lua | 14 |
1 files 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 |