Skip to content
This repository has been archived by the owner on Sep 30, 2020. It is now read-only.

Commit

Permalink
Removed quite some warnings.
Browse files Browse the repository at this point in the history
Removed more unused code.
  • Loading branch information
Maczuga committed Jun 7, 2020
1 parent 7c83227 commit fe969ec
Show file tree
Hide file tree
Showing 16 changed files with 199 additions and 343 deletions.
25 changes: 8 additions & 17 deletions battlegrounds/alterac_valley.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local addonName, OQ = ...
local _, OQ = ...
local oq = OQ:mod() -- thank goodness i stumbled across this trick
local tbl = OQ.table

Expand Down Expand Up @@ -120,7 +120,6 @@ local function utimer_init_AV()
tbl.clear(graveyards)
tbl.clear(towers)
local nMarks = GetNumMapLandmarks()
local i, v
for i = 1, nMarks, 1 do
local name, _, textureIndex = GetMapLandmarkInfo(i)
if name and textureIndex then
Expand Down Expand Up @@ -172,7 +171,7 @@ local function utimer_init_AV()
end

-- show bosses; this way we can see the count of our ppl in the area/defending
for i, v in pairs(bosses) do
for _, v in pairs(bosses) do
oq.utimer_start(v.name, v.faction, v.texture, 30, 5) -- node
end

Expand All @@ -188,12 +187,10 @@ local function utimer_init_AV()
_init = 1
end

local GRAVEYARD_RANGE = 0.01
local NODE_RANGE = 0.015

local function get_location_name(x, y, location, radius)
local i, v
for i, v in pairs(location) do
for _, v in pairs(location) do
if (x > (v.x - radius)) and (x < (v.x + radius)) and (y > (v.y - radius)) and (y < (v.y + radius)) then
return v.name
end
Expand All @@ -217,7 +214,6 @@ local function check_ressers()
-- Grab our data
tbl.clear(dead_count)
tbl.clear(node_count)
local i, v
for i = 1, GetNumGroupMembers() do
local name = GetUnitName('raid' .. i, true)
local hp = UnitHealth('raid' .. i)
Expand Down Expand Up @@ -247,7 +243,7 @@ local function check_ressers()
units[name] = hp
end
-- set count on cycle timers
for i, v in pairs(oq._utimers) do
for _, v in pairs(oq._utimers) do
if (v._start ~= 0) then
v._count = node_count[v.label:GetText()]
v._dead = dead_count[v.label:GetText()]
Expand Down Expand Up @@ -286,7 +282,6 @@ local function av_utimer_check()

utimer_init_AV()

local k, v
for k, v in pairs(graveyards) do
local name, _, textureIndex = GetMapLandmarkInfo(k)
if name and textureIndex then
Expand Down Expand Up @@ -415,7 +410,6 @@ local function av_shuffle()
local cx = OQ_data.timer_width or 200
local cy = 20
local n = 0
local i, v
oq._utimer_bosses = (oq._utimer_bosses and tbl.clear(oq._utimer_bosses)) or tbl.new()
oq._utimer_items = (oq._utimer_items and tbl.clear(oq._utimer_items)) or tbl.new()
oq._utimer_gys = (oq._utimer_gys and tbl.clear(oq._utimer_gys)) or tbl.new()
Expand All @@ -439,7 +433,7 @@ local function av_shuffle()
-- bosses
n = 0
table.sort(oq._utimer_bosses, av_boss_compare)
for i, v in pairs(oq._utimer_bosses) do
for _, v in pairs(oq._utimer_bosses) do
oq.setpos(oq._utimers[v], x, y, cx, cy)
y = y + cy
n = n + 1
Expand All @@ -451,7 +445,7 @@ local function av_shuffle()
end
n = 0
table.sort(oq._utimer_items, oq.utimer_compare)
for i, v in pairs(oq._utimer_items) do
for _, v in pairs(oq._utimer_items) do
oq.setpos(oq._utimers[v], x, y, cx, cy)
y = y + cy
n = n + 1
Expand All @@ -463,7 +457,7 @@ local function av_shuffle()
end
n = 0
table.sort(oq._utimer_controlled, av_compare_controlled)
for i, v in pairs(oq._utimer_controlled) do
for _, v in pairs(oq._utimer_controlled) do
oq.setpos(oq._utimers[v], x, y, cx, cy)
y = y + cy
n = n + 1
Expand All @@ -474,7 +468,7 @@ local function av_shuffle()
y = y + cy
end
table.sort(oq._utimer_gys, oq.utimer_compare_alpha)
for i, v in pairs(oq._utimer_gys) do
for _, v in pairs(oq._utimer_gys) do
oq.setpos(oq._utimers[v], x, y, cx, cy)
y = y + cy
end
Expand All @@ -488,8 +482,6 @@ end
local function av_test_2()
print('av test 2')
oq.utimer_stop_all() -- clear out existing timers
local t
-- t = oq.utimer_start( "Lumber Mill", "horde" , 24, 1*60, 1 ) ; -- horde capping lumbermill
end

local function av_start()
Expand Down Expand Up @@ -518,7 +510,6 @@ local function av_show_control(show)
av_utimer_check()
else
oq.utimer_stop(nil, 4) -- clear controlled towers
local i, v
for i, v in pairs(graveyards) do
if (state[v] == 1) or (state[v] == 2) then
graveyards[i] = 0
Expand Down
27 changes: 3 additions & 24 deletions battlegrounds/fog_of_war.lua
Original file line number Diff line number Diff line change
@@ -1,28 +1,11 @@
local addonName, OQ = ...
local _, OQ = ...
local oq = OQ:mod() -- thank goodness i stumbled across this trick
local _ -- throw away (was getting taint warning; what happened blizz?)
if (OQ.table == nil) then
OQ.table = {}
end
local tbl = OQ.table

local cloud_cover = {
[0] = 0.0,
[1] = 0.55,
[2] = 0.75,
[3] = 0.85,
[4] = 0.90,
[5] = 0.99
}
local cloud_size = {
[0] = 10,
[1] = 24,
[2] = 36,
[3] = 50,
[4] = 64,
[5] = 80
}

--------------------------------------------------------------------------
-- Bogey
--------------------------------------------------------------------------
Expand Down Expand Up @@ -93,7 +76,6 @@ function Bogey:on_timer(now)
local n = 0
local x = 0
local y = 0
local i, v
local tmp = tbl.new()
local v_x, v_y, v_tm

Expand Down Expand Up @@ -140,8 +122,7 @@ local function fog_refresh(self)
if ((self._next_update_tm) and (self._next_update_tm > now)) or (OQ_data.fog_enabled == 0) then
return
end
local i, v
for i, v in pairs(self._bogeys) do
for _, v in pairs(self._bogeys) do
v:on_timer(now)
end
self._next_update_tm = now + 0.25 -- four times a second the fog will refresh
Expand All @@ -168,8 +149,7 @@ end
function oq.fog_clear()
local f = WorldMapButton._fog
if (f) and (f._bogeys) then
local i, v
for i, v in pairs(f._bogeys) do
for _, v in pairs(f._bogeys) do
v:clear()
end
end
Expand Down Expand Up @@ -277,7 +257,6 @@ function oq.fog_new_data(d)
local n = strlen(d) - 4
local now = GetTime()
local id = 0
local i
for i = 1, n do
id = oq.decode_mime64_digits(d:sub(4 + i, 4 + i))
f._bogeys[id] = f._bogeys[id] or Bogey:new(f, x, y, 32, 32)
Expand Down
17 changes: 6 additions & 11 deletions battlegrounds/twin_peaks.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local addonName, OQ = ...
local _, OQ = ...
local oq = OQ:mod() -- thank goodness i stumbled across this trick
local tbl = OQ.table

Expand Down Expand Up @@ -27,8 +27,7 @@ local graveyards = {
local GRAVEYARD_RANGE = 0.02
local NODE_RANGE = 0.08
local function get_location_name(x, y, location, radius)
local i, v
for i, v in pairs(location) do
for _, v in pairs(location) do
if (x > (v.x - radius)) and (x < (v.x + radius)) and (y > (v.y - radius)) and (y < (v.y + radius)) then
return v.name
end
Expand Down Expand Up @@ -100,14 +99,11 @@ local function check_ressers()
-- Grab our data
tbl.clear(dead_count)
tbl.clear(node_count)
local i, v
for i = 1, GetNumGroupMembers() do
local name = GetUnitName('raid' .. i, true)
local hp = UnitHealth('raid' .. i)
if (units[name] ~= nil) and (units[name] <= 1) and (hp > 1) then
-- ressed
local x, y = GetPlayerMapPosition('raid' .. i)
local loc = get_location_name(x, y, graveyards, GRAVEYARD_RANGE)
tp_graveyard_timers_reset()
elseif (units[name] ~= nil) and (units[name] <= 1) then
-- dead, waiting to res. which graveyard?
Expand All @@ -130,7 +126,7 @@ local function check_ressers()
units[name] = hp
end
-- set count on cycle timers
for i, v in pairs(oq._utimers) do
for _, v in pairs(oq._utimers) do
if (v._start ~= 0) then
if (v._type == 3) then
v._dead = dead_count[v.label:GetText()]
Expand Down Expand Up @@ -232,7 +228,6 @@ local function tp_shuffle()
local cx = OQ_data.timer_width or 200
local cy = 20
local n = 0
local i, v
oq._utimer_items = (oq._utimer_items and tbl.clear(oq._utimer_items)) or tbl.new()
oq._utimer_gys = (oq._utimer_gys and tbl.clear(oq._utimer_gys)) or tbl.new()
oq._utimer_controlled = (oq._utimer_controlled and tbl.clear(oq._utimer_controlled)) or tbl.new()
Expand All @@ -256,7 +251,7 @@ local function tp_shuffle()
end
n = 0
table.sort(oq._utimer_items, oq.utimer_compare)
for i, v in pairs(oq._utimer_items) do
for _, v in pairs(oq._utimer_items) do
oq.setpos(oq._utimers[v], x, y, cx, cy)
y = y + cy
n = n + 1
Expand All @@ -268,7 +263,7 @@ local function tp_shuffle()
end
n = 0
table.sort(oq._utimer_controlled, oq.utimer_compare_alpha)
for i, v in pairs(oq._utimer_controlled) do
for _, v in pairs(oq._utimer_controlled) do
oq.setpos(oq._utimers[v], x, y, cx, cy)
y = y + cy
n = n + 1
Expand All @@ -279,7 +274,7 @@ local function tp_shuffle()
y = y + cy
end
table.sort(oq._utimer_gys, oq.utimer_compare_alpha)
for i, v in pairs(oq._utimer_gys) do
for _, v in pairs(oq._utimer_gys) do
oq.setpos(oq._utimers[v], x, y, cx, cy)
y = y + cy
end
Expand Down
21 changes: 8 additions & 13 deletions battlegrounds/warsong_gulch.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
--[[
--[[
@file warsong_gulch.lua
@brief user timer functions to support warsong gulch
Expand All @@ -7,9 +7,9 @@
@copyright Solid ICE Technologies
this file may be distributed so long as it remains unaltered
if this file is posted to a web site, credit must be given to me along with a link to my web page
no code in this file may be used in other works without expressed permission
no code in this file may be used in other works without expressed permission
]] --
local addonName, OQ = ...
local _, OQ = ...
local oq = OQ:mod() -- thank goodness i stumbled across this trick
local tbl = OQ.table

Expand All @@ -36,8 +36,7 @@ local graveyards = {
local GRAVEYARD_RANGE = 0.02
local NODE_RANGE = 0.08
local function get_location_name(x, y, location, radius)
local i, v
for i, v in pairs(location) do
for _, v in pairs(location) do
if (x > (v.x - radius)) and (x < (v.x + radius)) and (y > (v.y - radius)) and (y < (v.y + radius)) then
return v.name
end
Expand Down Expand Up @@ -107,14 +106,11 @@ local function check_ressers()
-- Grab our data
tbl.clear(dead_count)
tbl.clear(node_count)
local i, v
for i = 1, GetNumGroupMembers() do
local name = GetUnitName('raid' .. i, true)
local hp = UnitHealth('raid' .. i)
if (units[name] ~= nil) and (units[name] <= 1) and (hp > 1) then
-- ressed
local x, y = GetPlayerMapPosition('raid' .. i)
local loc = get_location_name(x, y, graveyards, GRAVEYARD_RANGE)
wsg_graveyard_timers_reset()
elseif (units[name] ~= nil) and (units[name] <= 1) then
-- dead, waiting to res. which graveyard?
Expand All @@ -137,7 +133,7 @@ local function check_ressers()
units[name] = hp
end
-- set count on cycle timers
for i, v in pairs(oq._utimers) do
for _, v in pairs(oq._utimers) do
if (v._start ~= 0) then
if (v._type == 3) then
v._dead = dead_count[v.label:GetText()]
Expand Down Expand Up @@ -239,7 +235,6 @@ local function wsg_shuffle()
local cx = OQ_data.timer_width or 200
local cy = 20
local n = 0
local i, v
oq._utimer_items = (oq._utimer_items and tbl.clear(oq._utimer_items)) or tbl.new()
oq._utimer_gys = (oq._utimer_gys and tbl.clear(oq._utimer_gys)) or tbl.new()
oq._utimer_controlled = (oq._utimer_controlled and tbl.clear(oq._utimer_controlled)) or tbl.new()
Expand All @@ -263,7 +258,7 @@ local function wsg_shuffle()
end
n = 0
table.sort(oq._utimer_items, oq.utimer_compare)
for i, v in pairs(oq._utimer_items) do
for _, v in pairs(oq._utimer_items) do
oq.setpos(oq._utimers[v], x, y, cx, cy)
y = y + cy
n = n + 1
Expand All @@ -275,7 +270,7 @@ local function wsg_shuffle()
end
n = 0
table.sort(oq._utimer_controlled, oq.utimer_compare_alpha)
for i, v in pairs(oq._utimer_controlled) do
for _, v in pairs(oq._utimer_controlled) do
oq.setpos(oq._utimers[v], x, y, cx, cy)
y = y + cy
n = n + 1
Expand All @@ -286,7 +281,7 @@ local function wsg_shuffle()
y = y + cy
end
table.sort(oq._utimer_gys, oq.utimer_compare_alpha)
for i, v in pairs(oq._utimer_gys) do
for _, v in pairs(oq._utimer_gys) do
oq.setpos(oq._utimers[v], x, y, cx, cy)
y = y + cy
end
Expand Down
Loading

0 comments on commit fe969ec

Please sign in to comment.