Compare commits
2 Commits
compress-s
...
1d4eb423d6
Author | SHA1 | Date | |
---|---|---|---|
1d4eb423d6 | |||
518e9f7893 |
@ -271,21 +271,10 @@ local function stat_str(stat)
|
|||||||
return "0"
|
return "0"
|
||||||
end
|
end
|
||||||
|
|
||||||
local function splits_from_str(splitstr)
|
|
||||||
local spl = {}
|
|
||||||
for str in splitstr:gmatch("([^ ]+)") do
|
|
||||||
table.insert(spl, tonumber(str))
|
|
||||||
end
|
|
||||||
return spl
|
|
||||||
end
|
|
||||||
|
|
||||||
local function splits_to_str(splits)
|
|
||||||
return table.concat(splits, " ")
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Read the leaderboard
|
-- Read the leaderboard
|
||||||
local f = io.open(FILENAME, "r")
|
if isserver then
|
||||||
if f then
|
local f = io.open(FILENAME, "r")
|
||||||
|
if f then
|
||||||
for l in f:lines() do
|
for l in f:lines() do
|
||||||
-- Leaderboard is stored in the following tab separated format
|
-- Leaderboard is stored in the following tab separated format
|
||||||
-- mapnum, name, skin, color, time, splits, flags, stat
|
-- mapnum, name, skin, color, time, splits, flags, stat
|
||||||
@ -301,7 +290,12 @@ if f then
|
|||||||
|
|
||||||
scoreTable = getScoreTable(tonumber(t[1]), flags) or {}
|
scoreTable = getScoreTable(tonumber(t[1]), flags) or {}
|
||||||
|
|
||||||
local spl = t[6] or ""
|
local spl = {}
|
||||||
|
if t[6] != nil then
|
||||||
|
for str in t[6]:gmatch("([^ ]+)") do
|
||||||
|
table.insert(spl, tonumber(str))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local stats = nil
|
local stats = nil
|
||||||
if t[8] != nil then
|
if t[8] != nil then
|
||||||
@ -331,8 +325,9 @@ if f then
|
|||||||
|
|
||||||
sortScores()
|
sortScores()
|
||||||
f:close()
|
f:close()
|
||||||
else
|
else
|
||||||
print("Failed to open file: ", FILENAME)
|
print("Failed to open file: ", FILENAME)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function allowJoin(v)
|
function allowJoin(v)
|
||||||
@ -1035,9 +1030,8 @@ local function drawScore(v, player, pos, x, y, gui, faceRank, score, drawPos, te
|
|||||||
)
|
)
|
||||||
|
|
||||||
-- Draw splits
|
-- Draw splits
|
||||||
local splts = splits_from_str(score["splits"])
|
if showSplit and score["splits"] and score["splits"][prevLap] != nil then
|
||||||
if showSplit and splts and splts[prevLap] != nil then
|
local split = splits[prevLap] - score["splits"][prevLap]
|
||||||
local split = splits[prevLap] - splts[prevLap]
|
|
||||||
v.drawString(
|
v.drawString(
|
||||||
x + px + FACERANK_DIM,
|
x + px + FACERANK_DIM,
|
||||||
y + 8,
|
y + 8,
|
||||||
@ -1276,7 +1270,7 @@ local function saveTime(player)
|
|||||||
player.mo.skin,
|
player.mo.skin,
|
||||||
player.skincolor,
|
player.skincolor,
|
||||||
timeFinished,
|
timeFinished,
|
||||||
splits_to_str(splits),
|
splits,
|
||||||
Flags,
|
Flags,
|
||||||
stat_t(player.HMRs or pskin.kartspeed, player.HMRw or pskin.kartweight)
|
stat_t(player.HMRs or pskin.kartspeed, player.HMRw or pskin.kartweight)
|
||||||
)
|
)
|
||||||
@ -1323,6 +1317,7 @@ local function saveTime(player)
|
|||||||
StatTrack = true
|
StatTrack = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if isserver then
|
||||||
local f = assert(io.open(FILENAME, "w"))
|
local f = assert(io.open(FILENAME, "w"))
|
||||||
if f == nil then
|
if f == nil then
|
||||||
print("Failed to open file for writing: " + FILENAME)
|
print("Failed to open file for writing: " + FILENAME)
|
||||||
@ -1338,7 +1333,7 @@ local function saveTime(player)
|
|||||||
score["skin"], "\t",
|
score["skin"], "\t",
|
||||||
score["color"], "\t",
|
score["color"], "\t",
|
||||||
score["time"], "\t",
|
score["time"], "\t",
|
||||||
score["splits"], "\t",
|
table.concat(score["splits"], " "), "\t",
|
||||||
score["flags"], "\t",
|
score["flags"], "\t",
|
||||||
stat_str(score["stat"]), "\n"
|
stat_str(score["stat"]), "\n"
|
||||||
)
|
)
|
||||||
@ -1347,6 +1342,7 @@ local function saveTime(player)
|
|||||||
end
|
end
|
||||||
|
|
||||||
f:close()
|
f:close()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- DEBUGGING
|
-- DEBUGGING
|
||||||
|
Reference in New Issue
Block a user