Skip to content

Commit

Permalink
Fix instances of 'if not x == y'. (beyond-all-reason#3980)
Browse files Browse the repository at this point in the history
  • Loading branch information
saurtron authored Dec 6, 2024
1 parent 3bdd8f5 commit 514bced
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion luarules/gadgets/unit_target_on_the_move.lua
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ if gadgetHandler:IsSyncedCode() then
spSetUnitRulesParam(unitID, "targetCoordX", -1)
spSetUnitRulesParam(unitID, "targetCoordY", -1)
spSetUnitRulesParam(unitID, "targetCoordZ", -1)
if unitTargets[unitID] and not keeptrack == true then
if unitTargets[unitID] and not keeptrack then
SendToUnsynced("targetList", unitID, 0)
end
unitTargets[unitID] = nil
Expand Down
4 changes: 2 additions & 2 deletions luaui/Widgets/gui_info.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1103,7 +1103,7 @@ local function drawUnitInfo()

local unitNameColor = tooltipTitleColor
if SelectedUnitsCount > 0 then
if not displayMode == 'unitdef' or (WG['buildmenu'] and (activeCmdID and activeCmdID < 0 and (not WG['buildmenu'].hoverID or (-activeCmdID == WG['buildmenu'].hoverID)))) then
if displayMode ~= 'unitdef' or (WG['buildmenu'] and (activeCmdID and activeCmdID < 0 and (not WG['buildmenu'].hoverID or (-activeCmdID == WG['buildmenu'].hoverID)))) then
unitNameColor = '\255\125\255\125'
end
end
Expand Down Expand Up @@ -1143,7 +1143,7 @@ local function drawUnitInfo()
-- custom unit info area
customInfoArea = { math_floor(backgroundRect[3] - width - bgpadding), math_floor(backgroundRect[2]), math_floor(backgroundRect[3] - bgpadding), math_floor(backgroundRect[2] + height) }

if not displayMode == 'unitdef' or not showBuilderBuildlist or not unitDefInfo[displayUnitDefID].buildOptions or (not (WG['buildmenu'] and WG['buildmenu'].hoverID)) then
if displayMode ~= 'unitdef' or not showBuilderBuildlist or not unitDefInfo[displayUnitDefID].buildOptions or (not (WG['buildmenu'] and WG['buildmenu'].hoverID)) then
RectRound(customInfoArea[1], customInfoArea[2], customInfoArea[3], customInfoArea[4], elementCorner*0.66, 1, 0, 0, 0, { 0.8, 0.8, 0.8, 0.08 }, { 0.8, 0.8, 0.8, 0.15 })
end

Expand Down
6 changes: 3 additions & 3 deletions luaui/Widgets/gui_unit_stats.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ end
if damageStats and damageStats[gameName] and damageStats[gameName].team then
local rate = 0
for k, v in pairs (damageStats[gameName].team) do
if not v == damageStats[gameName].team.games and v.cost and v.killed_cost then
if k ~= "games" and v.cost and v.killed_cost then
local compRate = v.killed_cost/v.cost
if compRate > rate then
highestUnitDef = k
Expand All @@ -36,7 +36,7 @@ if damageStats and damageStats[gameName] and damageStats[gameName].team then
end
local scndRate = 0
for k, v in pairs (damageStats[gameName].team) do
if not v == damageStats[gameName].team.games and v.cost and v.killed_cost then
if k ~= "games" and v.cost and v.killed_cost then
local compRate = v.killed_cost/v.cost
if compRate > scndRate and k ~= highestUnitDef then
scndhighestUnitDef = k
Expand All @@ -47,7 +47,7 @@ if damageStats and damageStats[gameName] and damageStats[gameName].team then
local thirdRate = 0
--local thirdhighestUnitDef
for k, v in pairs (damageStats[gameName].team) do
if not v == damageStats[gameName].team.games and v.cost and v.killed_cost then
if k ~= "games" and v.cost and v.killed_cost then
local compRate = v.killed_cost/v.cost
if compRate > thirdRate and k ~= highestUnitDef and k ~= scndhighestUnitDef then
--thirdhighestUnitDef = k
Expand Down

0 comments on commit 514bced

Please sign in to comment.