remove movecount, write LiveStore on servers only
This commit is contained in:
parent
d4bbf62945
commit
3c5234f7b2
11
lb_store.lua
11
lb_store.lua
@ -275,8 +275,6 @@ local function moveRecords(from, to, modeSep)
|
|||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
local moveCount = #store[from.id][from.checksum]
|
|
||||||
|
|
||||||
store[to.id] = $ or {}
|
store[to.id] = $ or {}
|
||||||
store[to.id][to.checksum] = $ or {}
|
store[to.id][to.checksum] = $ or {}
|
||||||
for i, score in ipairs(store[from.id][from.checksum]) do
|
for i, score in ipairs(store[from.id][from.checksum]) do
|
||||||
@ -287,24 +285,21 @@ local function moveRecords(from, to, modeSep)
|
|||||||
|
|
||||||
-- Destroy the original table
|
-- Destroy the original table
|
||||||
store[from.id][from.checksum] = nil
|
store[from.id][from.checksum] = nil
|
||||||
|
|
||||||
return moveCount
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- move livestore records and write to disk
|
-- move livestore records and write to disk
|
||||||
local moveCount = moveRecordsInStore(LiveStore)
|
moveRecordsInStore(LiveStore)
|
||||||
|
|
||||||
|
if isserver then
|
||||||
dumpStoreToFile(LEADERBOARD_FILE, LiveStore)
|
dumpStoreToFile(LEADERBOARD_FILE, LiveStore)
|
||||||
|
|
||||||
-- move coldstore records
|
-- move coldstore records
|
||||||
if isserver then
|
|
||||||
local ok, coldstore = pcall(loadStoreFile, COLDSTORE_FILE)
|
local ok, coldstore = pcall(loadStoreFile, COLDSTORE_FILE)
|
||||||
if ok and coldstore then
|
if ok and coldstore then
|
||||||
moveRecordsInStore(coldstore)
|
moveRecordsInStore(coldstore)
|
||||||
dumpStoreToFile(COLDSTORE_FILE, coldstore)
|
dumpStoreToFile(COLDSTORE_FILE, coldstore)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return moveCount
|
|
||||||
end
|
end
|
||||||
rawset(_G, "lb_move_records", moveRecords)
|
rawset(_G, "lb_move_records", moveRecords)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user