Cache maintenance; Parser options

This commit is contained in:
Tercio Jose
2023-01-27 14:45:33 -03:00
parent 6352fc8387
commit 59372cc0bd
11 changed files with 1123 additions and 1561 deletions
+44 -30
View File
@@ -1785,82 +1785,96 @@
end
--call update functions
function Details:RefreshAllMainWindows (forcar)
local combatTable = self.showing
function Details:RefreshAllMainWindows(bForceRefresh)
local combatObject = self.showing
--the the segment does not have a valid combat, freeze the window
if (not combatTable) then
if (not combatObject) then
if (not self.freezed) then
return self:Freeze()
end
return
end
local need_refresh = combatTable[self.atributo].need_refresh
if (not need_refresh and not forcar) then
return --no precisa de refresh
--else
--combatTable[self.atributo].need_refresh = false
local needRefresh = combatObject[self.atributo].need_refresh
if (not needRefresh and not bForceRefresh) then
return
end
--measure the cpu time spent on this function
--local startTime = debugprofilestop()
if (self.atributo == 1) then --damage
return atributo_damage:RefreshWindow(self, combatTable, forcar, nil, need_refresh)
--[[return]] atributo_damage:RefreshWindow(self, combatObject, bForceRefresh, nil, needRefresh)
elseif (self.atributo == 2) then --heal
return atributo_heal:RefreshWindow(self, combatTable, forcar, nil, need_refresh)
--[[return]] atributo_heal:RefreshWindow(self, combatObject, bForceRefresh, nil, needRefresh)
elseif (self.atributo == 3) then --energy
return atributo_energy:RefreshWindow(self, combatTable, forcar, nil, need_refresh)
--[[return]] atributo_energy:RefreshWindow(self, combatObject, bForceRefresh, nil, needRefresh)
elseif (self.atributo == 4) then --outros
return atributo_misc:RefreshWindow(self, combatTable, forcar, nil, need_refresh)
--[[return]] atributo_misc:RefreshWindow(self, combatObject, bForceRefresh, nil, needRefresh)
elseif (self.atributo == 5) then --ocustom
return atributo_custom:RefreshWindow(self, combatTable, forcar, nil, need_refresh)
--[[return]] atributo_custom:RefreshWindow(self, combatObject, bForceRefresh, nil, needRefresh)
end
--[[if (Details222.Perf.WindowUpdateC) then
local elapsedTime = debugprofilestop() - startTime
if (Details222.Perf.WindowUpdate) then
Details222.Perf.WindowUpdate = Details222.Perf.WindowUpdate + elapsedTime
end
end--]]
end
--["1"] = "WindowUpdate",
--["2"] = 308.6662000129,
function Details:DumpPerf()
local t = {}
for name, value in pairs(Details222.Perf) do
t[#t+1] = {name, value}
end
dumpt(t)
end
function Details:ForceRefresh()
self:RefreshMainWindow(true)
end
function Details:RefreshMainWindow(instance, forceRefresh)
function Details:RefreshMainWindow(instance, bForceRefresh)
if (not instance or type(instance) == "boolean") then
forceRefresh = instance
bForceRefresh = instance
instance = self
end
if (not forceRefresh) then
if (not bForceRefresh) then
Details.LastUpdateTick = Details._tempo
end
if (instance == -1) then
--update
for index, instance in ipairs(Details.tabela_instancias) do
if (instance.ativa) then
if (instance.modo == modo_GROUP or instance.modo == modo_ALL) then
instance:RefreshAllMainWindows(forceRefresh)
--print("all instances got updates")
for index, thisInstance in ipairs(Details.tabela_instancias) do
if (thisInstance.ativa) then
if (thisInstance.modo == modo_GROUP or thisInstance.modo == modo_ALL) then
thisInstance:RefreshAllMainWindows(bForceRefresh)
end
end
end
--flag windows as no need update next tick
for index, instance in ipairs(Details.tabela_instancias) do
if (instance.ativa and instance.showing) then
if (instance.modo == modo_GROUP or instance.modo == modo_ALL) then
if (instance.atributo <= 4) then
instance.showing [instance.atributo].need_refresh = false
for index, thisInstance in ipairs(Details.tabela_instancias) do
if (thisInstance.ativa and thisInstance.showing) then
if (thisInstance.modo == modo_GROUP or thisInstance.modo == modo_ALL) then
if (thisInstance.atributo <= 4) then
thisInstance.showing[thisInstance.atributo].need_refresh = false
end
end
end
end
if (not forceRefresh) then --update player details window if opened
if (not bForceRefresh) then --update player details window if opened
if (info.ativo) then
--print("info.jogador:MontaInfo()")
return info.jogador:MontaInfo()
end
end
@@ -1876,7 +1890,7 @@
if (instance.modo == modo_ALL or instance.modo == modo_GROUP) then
--print("updating all instances...")
return instance:RefreshAllMainWindows (forceRefresh)
return instance:RefreshAllMainWindows(bForceRefresh)
end
end