Skip to content

Commit

Permalink
职业染色:修复L1更新的一处BUG、优化N2ID映射表文件读写
Browse files Browse the repository at this point in the history
  • Loading branch information
tinymins committed Sep 9, 2015
1 parent 3a4e9b6 commit 66981b3
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions Farbnamen/src/MY_Farbnamen.lua
Original file line number Diff line number Diff line change
Expand Up @@ -101,32 +101,35 @@ local InfoCache = (function()
bUpdated = true
end
-- save player info
-- update L1 CACHE
if bUpdated or not tCache[k] then
if #aCache > 3000 then
tremove(aCache, 1)
end
tinsert(aCache, v)
tCache[k] = v
tCache[v.n] = v
end
-- update DataBase
if bUpdated then
-- update DataBase
-- save info to DataBase
if not tInfos[nSegID] then
tInfos[nSegID] = MY.LoadLUAData(SZ_DATA_PATH:format(nSegID)) or {}
end
tInfos[nSegID][k] = v
tInfoVisit[nSegID] = GetTime()
tInfoModified[nSegID] = GetTime()
-- update L1 CACHE
if #aCache > 3000 then
tremove(aCache, 1)
-- save szName to dwID indexing to DataBase
local nSegID = string.byte(v.n)
if not tName2ID[nSegID] then
tName2ID[nSegID] = MY.LoadLUAData(SZ_N2ID_PATH:format(nSegID)) or {}
end
tinsert(aCache, v)
tCache[k] = v
tCache[v.n] = v
end
-- save szName to dwID indexing
local nSegID = string.byte(v.n)
if not tName2ID[nSegID] then
tName2ID[nSegID] = MY.LoadLUAData(SZ_N2ID_PATH:format(nSegID)) or {}
end
if tName2ID[nSegID][v.n] ~= k then
tName2ID[nSegID][v.n] = k
tName2IDModified[nSegID] = GetTime()
if tName2ID[nSegID][v.n] ~= k then
tName2ID[nSegID][v.n] = k
tName2IDModified[nSegID] = GetTime()
end
tName2IDVisit[nSegID] = GetTime()
end
tName2IDVisit[nSegID] = GetTime()
end
end
end,
Expand Down

0 comments on commit 66981b3

Please sign in to comment.