map identity by checksum

This commit is contained in:
Not
2022-11-18 01:35:59 +01:00
parent 68e44e534b
commit cf74af8945
5 changed files with 91 additions and 69 deletions

View File

@ -92,6 +92,7 @@ local ticsToTime = lb_TicsToTime
local zoneAct = lb_ZoneAct
local stat_t = lb_stat_t
local lbComp = lb_comp
local mapChecksum = lb_map_checksum
-- browser.lua
local InitBrowser = InitBrowser
@ -403,7 +404,7 @@ local function records(player, ...)
return
end
mapRecords = GetMapRecords(mapnum, ST_SEP)
mapRecords = GetMapRecords(mapnum, mapChecksum(mapnum), ST_SEP)
end
local map = mapheaderinfo[mapnum]
@ -562,14 +563,14 @@ local function findRival(player, ...)
local totalDiff = 0
CONS_Printf(player, string.format("\x89%s's times:", rival))
CONS_Printf(player, "MAP Time Diff Mode")
CONS_Printf(player, "MAP CHCK Time Diff Mode")
local maplist = MapList()
local mapRecords
local rivalScore
local yourScore
for i = 1, #maplist do
mapRecords = GetMapRecords(maplist[i], ST_SEP)
mapRecords = GetMapRecords(maplist[i].id, maplist[i].checksum, ST_SEP)
for mode, records in pairs(mapRecords) do
scores[mode] = $ or {}
@ -636,9 +637,10 @@ local function findRival(player, ...)
CONS_Printf(
player,
string.format(
"%s %8s %s%9s \x80%s",
G_BuildMapName(score["rival"]["map"]),
ticsToTime(score["rival"]["time"]),
"%s %4s %8s %s%9s \x80%s",
G_BuildMapName(score.rival.map),
score.rival.checksum,
ticsToTime(score.rival.time),
color,
sym[diff<0] + ticsToTime(abs(diff)),
modestr
@ -648,9 +650,10 @@ local function findRival(player, ...)
CONS_Printf(
player,
string.format(
"%s %8s %9s %s",
G_BuildMapName(score["rival"]["map"]),
ticsToTime(score["rival"]["time"]),
"%s %4s %8s %9s %s",
G_BuildMapName(score.rival.map),
score.rival.checksum,
ticsToTime(score.rival.time),
ticsToTime(0, true),
modestr
)
@ -714,7 +717,7 @@ addHook("MapLoad", function()
allowJoin(true)
--printTable(lb)
MapRecords = GetMapRecords(gamemap, ST_SEP)
MapRecords = GetMapRecords(gamemap, mapChecksum(gamemap), ST_SEP)
end
)
@ -1149,7 +1152,8 @@ local function saveTime(player)
TimeFinished,
splits,
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),
mapChecksum(gamemap)
)
-- Check if you beat your previous best
@ -1178,7 +1182,7 @@ local function saveTime(player)
FlashVFlags = YellowFlash
-- Reload the MapRecords
MapRecords = GetMapRecords(gamemap, ST_SEP)
MapRecords = GetMapRecords(gamemap, mapChecksum(gamemap), ST_SEP)
-- Set the updated ScoreTable
ScoreTable = MapRecords[Flags]