summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugues Hiegel <hugues@hiegel.fr>2013-11-22 12:32:06 +0100
committerHugues Hiegel <hugues@hiegel.fr>2013-11-22 12:34:50 +0100
commit9e5c044ad683f913ca486dc4d45f9c5e4aa2b280 (patch)
tree151f2979b673f9b8c46d317bb366e375dbb63789
parent41250d698ac5c3c52012de5d08f5387dc7ac371e (diff)
[Sectors] cleanup
-rw-r--r--scripts/gugus/sector.lua68
1 files changed, 36 insertions, 32 deletions
diff --git a/scripts/gugus/sector.lua b/scripts/gugus/sector.lua
index 66eda91..c942888 100644
--- a/scripts/gugus/sector.lua
+++ b/scripts/gugus/sector.lua
@@ -15,6 +15,7 @@ function SectorUpdate()
if mSectorSplit == nil or mOldSector ~= sector then
mSectorSplit = GetTicks() + mSectorSplitDelay
+ -- Std values ------------------------
local s1 = GetTimeInfo("sector1")
local s2 = GetTimeInfo("sector2")
local s3 = GetTimeInfo("sector3")
@@ -22,41 +23,39 @@ function SectorUpdate()
local ls1 = GetTimeInfo("lastsector1")
local ls2 = GetTimeInfo("lastsector2")
local ls3 = GetTimeInfo("lastsector3")
-
- local Ls1 = mLastSectors[1]
- local Ls2 = mLastSectors[2]
- local Ls3 = mLastSectors[3]
+ local llt = GetTimeInfo("lastlaptime")
local bs1 = GetTimeInfo("bestsector1")
local bs2 = GetTimeInfo("bestsector2")
local bs3 = GetTimeInfo("bestsector3")
+ local blt = GetTimeInfo("bestlaptime")
+ --------------------------------------
+
+ -- Computed values ---------------------------------------------------------------------------
+ local Ls1 = mLastSectors[1]
+ local Ls2 = mLastSectors[2]
+ local Ls3 = mLastSectors[3]
+ local Llt = Ls1 + Ls2 + Ls3 -- for Debug
local Bs1 = mBestSectors[1]
local Bs2 = mBestSectors[2]
local Bs3 = mBestSectors[3]
-
- --local lt = GetTimeInfo("laptime")
- local llt = GetTimeInfo("lastlaptime")
- local blt = GetTimeInfo("bestlaptime")
- local Blt = Bs1 + Bs2 + Bs3
- local Llt = Ls1 + Ls2 + Ls3
-
if laps > 0 then
if mOldSector == 1 then
- if Bs1 == 0 then mBestSectors[1] = math.min(bs1, ls1)
- else mBestSectors[1] = math.min(Bs1, bs1, ls1)
- end
+ 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 mBestSectors[2] = math.min(bs2, ls2)
- else mBestSectors[2] = math.min(Bs2, bs2, ls2)
- end
+ if Bs2 == 0 then Bs2 = math.min(bs2, ls2) else Bs2 = math.min(Bs2, bs2, ls2) end
else -- mOldSector == 3
- if Bs3 == 0 then mBestSectors[3] = math.min(bs3, ls3)
- else mBestSectors[3] = math.min(Bs3, bs3, ls3)
- end
+ if Bs3 == 0 then Bs3 = math.min(bs3, ls3) else Bs3 = math.min(Bs3, bs3, ls3) end
end
+ mBestSectors[1] = Bs1
+ mBestSectors[2] = Bs2
+ mBestSectors[3] = Bs3
end
+ local Blt = Bs1 + Bs2 + Bs3 -- Virtual Best Lap time
+ ----------------------------------------------------------------------------------------------
+ -- Sectors split -----------------------------------------------------
mSectorSplit_Vs_LastSector = 0.0
mSectorSplit_Vs_BestSector = 0.0
mSectorSplit_Vs_BestLap = 0.0
@@ -76,23 +75,28 @@ function SectorUpdate()
mSectorSplit_Vs_BestSector = mSectorSplit_Vs_BestSector + s3 - Bs3
mSectorSplit_Vs_BestLap = mSectorSplit_Vs_BestLap + s3 - bs3
end
+ ----------------------------------------------------------------------
- if mOldSector == 1 then
- print (" sector " ..mOldSector)
- elseif mOldSector == 2 then
- print (" sector " ..mOldSector)
- else -- mOldSector == 3
- print (" sector " ..mOldSector)
+ -- Sectors times debugging --------------------------------------------------------------------
+ if true then
+ if mOldSector == 1 then
+ print (" sector " ..mOldSector)
+ elseif mOldSector == 2 then
+ print (" sector " ..mOldSector)
+ else -- mOldSector == 3
+ print (" sector " ..mOldSector)
+ end
+ print ("[curr] " .. s1 .. " " .. s2 .. " " .. s3 )
+ print ("[last] " ..ls1 .. " " ..ls2 .. " " ..ls3 )
+ print ("[Last] " ..Ls1 .. " " ..Ls2 .. " " ..Ls3 .. " | " .. (mSectorSplit_Vs_LastSector) )
+ print ("[best] " ..bs1 .. " " ..bs2 .. " " ..bs3 .. " | " .. (mSectorSplit_Vs_BestLap ) )
+ print ("[Best] " ..Bs1 .. " " ..Bs2 .. " " ..Bs3 .. " | " .. (mSectorSplit_Vs_BestSector) )
end
- print ("[curr] " .. s1 .. " " .. s2 .. " " .. s3 )
- print ("[last] " ..ls1 .. " " ..ls2 .. " " ..ls3 )
- print ("[Last] " ..Ls1 .. " " ..Ls2 .. " " ..Ls3 .. " | " .. (mSectorSplit_Vs_LastSector) )
- print ("[best] " ..bs1 .. " " ..bs2 .. " " ..bs3 .. " | " .. (mSectorSplit_Vs_BestLap ) )
- print ("[Best] " ..Bs1 .. " " ..Bs2 .. " " ..Bs3 .. " | " .. (mSectorSplit_Vs_BestSector) )
+ -----------------------------------------------------------------------------------------------
if sector == 1 then
- mLastSectors = { ls1 , ls2 , ls3 }
-- new lap
+ mLastSectors = { ls1 , ls2 , ls3 }
print ("")
print (" last best")
print ("[lapt] " .. llt .. " - " .. blt )