Merge pull request #197 from Quintinon/master
Fix for Issue #188 - Battle list ordering
This commit is contained in:
commit
4305b9e8f4
|
@ -97,21 +97,26 @@ function onMiniWindowClose()
|
||||||
end
|
end
|
||||||
|
|
||||||
function checkCreatures()
|
function checkCreatures()
|
||||||
removeAllCreatures()
|
|
||||||
|
|
||||||
local spectators = {}
|
|
||||||
local player = g_game.getLocalPlayer()
|
local player = g_game.getLocalPlayer()
|
||||||
if g_game.isOnline() then
|
if g_game.isOnline() then
|
||||||
creatures = g_map.getSpectators(player:getPosition(), false)
|
creatures = g_map.getSpectators(player:getPosition(), false)
|
||||||
for i, creature in ipairs(creatures) do
|
for i, creature in ipairs(creatures) do
|
||||||
if creature ~= player and doCreatureFitFilters(creature) then
|
if creature ~= player and doCreatureFitFilters(creature) then
|
||||||
table.insert(spectators, creature)
|
if not hasCreature(creature) then
|
||||||
|
addCreature(creature)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
local toRemove = {}
|
||||||
|
for i, b in pairs(battleButtonsByCreaturesList) do
|
||||||
|
if (not table.contains(creatures, b.creature)) or (not doCreatureFitFilters(b.creature)) then
|
||||||
|
table.insert(toRemove, b.creature)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
for i, v in pairs(spectators) do
|
for i, creature in pairs(toRemove) do
|
||||||
addCreature(v)
|
removeCreature(creature)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue