Whitespace cleanup of lua files.

This commit is contained in:
Pentarctagon 2021-04-25 15:11:09 -05:00
parent e3303e62b8
commit d203b061f9
No known key found for this signature in database
GPG Key ID: 9456BC54A21DBFA0
12 changed files with 31 additions and 31 deletions

View File

@ -117,7 +117,7 @@ end
local old_show_dialog = gui.show_dialog
function gui.show_dialog(dialog_wml, preshow, postshow)
local res = old_show_dialog(
dialog_wml,
function(dialog)

View File

@ -33,7 +33,7 @@ if wesnoth.kernel_type() == "Game Lua Kernel" then
moving_unit:to_map(to_x, to_y)
wesnoth.wml_actions.redraw{}
end
wesnoth.delay = wesnoth.deprecate_api('wesnoth.delay', 'wesnoth.interface.delay', 1, nil, wesnoth.interface.delay)
wesnoth.float_label = wesnoth.deprecate_api('wesnoth.float_label', 'wesnoth.interface.float_label', 1, nil, wesnoth.interface.float_label)
wesnoth.highlight_hex = wesnoth.deprecate_api('wesnoth.highlight_hex', 'wesnoth.interface.highlight_hex', 1, nil, wesnoth.interface.highlight_hex)

View File

@ -37,7 +37,7 @@ if wesnoth.kernel_type() ~= "Application Lua Kernel" then
return base .. '^'
end
end
function wesnoth.map.replace_overlay(code)
local base, overlay = wesnoth.map.split_terrain_code(code)
if overlay == nil or overlay == '' then -- A or A^
@ -48,7 +48,7 @@ if wesnoth.kernel_type() ~= "Application Lua Kernel" then
return '^' .. overlay
end
end
function wesnoth.map.replace_both(code)
local base, overlay = wesnoth.map.split_terrain_code(code)
if base == '' then -- ^ or ^B
@ -68,7 +68,7 @@ end
if wesnoth.kernel_type() == "Game Lua Kernel" then
local hex_mt = {__metatable = 'terrain hex reference'}
function hex_mt.__index(self, key)
if key == 'fogged' then
return self:fogged_for(wesnoth.current.side)
@ -100,7 +100,7 @@ if wesnoth.kernel_type() == "Game Lua Kernel" then
return hex_mt[key]
end
end
function hex_mt.__newindex(self, key, val)
if key == 'fogged' then
self:set_fogged(wesnoth.current.side, val)
@ -143,15 +143,15 @@ if wesnoth.kernel_type() == "Game Lua Kernel" then
rawset(self, key, val)
end
end
function hex_mt:fogged_for(side)
return wesnoth.map.is_fogged(side, self.x, self.y)
end
function hex_mt:shrouded_for(side)
return wesnoth.map.is_shrouded(side, self.x, self.y)
end
function hex_mt:set_shrouded(side, val)
if val then
wesnoth.map.place_shroud(side, {val})
@ -159,7 +159,7 @@ if wesnoth.kernel_type() == "Game Lua Kernel" then
wesnoth.map.remove_shroud(side, {val})
end
end
function hex_mt:set_fogged(side, val)
if val then
wesnoth.map.place_fog(side, {val})
@ -167,24 +167,24 @@ if wesnoth.kernel_type() == "Game Lua Kernel" then
wesnoth.map.remove_fog(side, {val})
end
end
function hex_mt:label_for(who)
return wesnoth.map.get_label(self.x, self.y, who)
end
function hex_mt:matches(filter)
return wesnoth.map.matches(self.x, self.y, filter)
end
-- Backwards compatibility - length is always 2
hex_mt.__len = wesnoth.deprecate_api('#location', 'nil', 3, '1.17', function() return 2 end, 'Using the length of a location as a validity test is no longer supported. You should represent an invalid location by nil instead.')
function wesnoth.map.get(x, y)
local loc, n = wesnoth.map.read_location(x, y)
if n == 0 then error('Missing or invalid coordinate') end
return setmetatable(loc, hex_mt)
end
local find_locations = wesnoth.map.find
function wesnoth.map.find(cfg)
local hexes = find_locations(cfg)
@ -193,7 +193,7 @@ if wesnoth.kernel_type() == "Game Lua Kernel" then
end
return hexes
end
wesnoth.terrain_mask = wesnoth.deprecate_api('wesnoth.terrain_mask', 'wesnoth.current.map:terrain_mask', 1, nil, function(...)
wesnoth.current.map:terrain_mask(...)
end)
@ -233,7 +233,7 @@ if wesnoth.kernel_type() == "Game Lua Kernel" then
end,
__pairs = function(_) return pairs(wesnoth.current.map.special_locations) end,
}), 'Note: the length operator has been removed')
wesnoth.place_shroud = wesnoth.deprecate_api('wesnoth.place_shroud', 'wesnoth.map.place_shroud', 1, nil, wesnoth.map.place_shroud)
wesnoth.remove_shroud = wesnoth.deprecate_api('wesnoth.remove_shroud', 'wesnoth.map.remove_shroud', 1, nil, wesnoth.map.remove_shroud)
wesnoth.is_shrouded = wesnoth.deprecate_api('wesnoth.is_shrouded', 'wesnoth.map.is_shrouded', 1, nil, wesnoth.map.is_shrouded)

View File

@ -2,7 +2,7 @@
if wesnoth.kernel_type() == "Game Lua Kernel" then
print("Creating persistent_tags table...")
wesnoth.persistent_tags = setmetatable({}, {
-- This just makes assignment of the read/write funtions more convenient
__index = function(t,k)

View File

@ -29,7 +29,7 @@ if wesnoth.kernel_type() == "Game Lua Kernel" then
if type(side) == 'number' then side = wesnoth.sides[side] end
return side.starting_location
end
wesnoth.get_side_variable = wesnoth.deprecate_api('wesnoth.get_side_variable', 'wesnoth.sides[].variables', 1, nil, wesnoth.get_side_variable)
wesnoth.set_side_variable = wesnoth.deprecate_api('wesnoth.set_side_variable', 'wesnoth.sides[].variables', 1, nil, wesnoth.set_side_variable)
wesnoth.get_starting_location = wesnoth.deprecate_api('wesnoth.get_starting_location', 'wesnoth.sides[].starting_location', 1, nil, wesnoth.get_starting_location)

View File

@ -43,7 +43,7 @@ if wesnoth.kernel_type() == "Game Lua Kernel" then
function wesnoth.units.resistance(...)
return 100 - wesnoth.units.resistance_against(...)
end
wesnoth.match_unit = wesnoth.deprecate_api('wesnoth.match_unit', 'wesnoth.units.matches', 1, nil, wesnoth.units.matches)
wesnoth.put_recall_unit = wesnoth.deprecate_api('wesnoth.put_recall_unit', 'wesnoth.units.to_recall', 1, nil, wesnoth.units.to_recall)
wesnoth.put_unit = wesnoth.deprecate_api('wesnoth.put_unit', 'wesnoth.units.to_map', 1, nil, wesnoth.units.to_map)

View File

@ -185,7 +185,7 @@ if wesnoth.kernel_type() == "Game Lua Kernel" then
function wml.error(m)
error("~wml:" .. m, 0)
end
--- Calling wesnoth.fire isn't the same as calling wesnoth.wml_actions[name] due to the passed vconfig userdata
--- which also provides "constness" of the passed wml object from the point of view of the caller.
--- So please don't remove since it's not deprecated.

View File

@ -13,7 +13,7 @@ local u_pos_filter = function(u_id)
end
for i, dir in ipairs(hex_dirs) do
if diversion_unit:matches {
id = u_id,
id = u_id,
T.filter_adjacent {
is_enemy = "yes",
adjacent = dir,
@ -26,7 +26,7 @@ local u_pos_filter = function(u_id)
}
} then
output = "diverter"
break
break
end
end
if output ~= "initial" then
@ -67,7 +67,7 @@ local status_anim_update = function(is_undo)
}
end
end
-- find all units on map with ability = diversion and status.diversion = true
local stop_candidates = wesnoth.units.find_on_map({
ability = "diversion",
@ -102,6 +102,6 @@ end
on_event("moveto, die, recruit, recall", function()
status_anim_update()
end)

View File

@ -350,7 +350,7 @@ function wesnoth.wml_actions.message(cfg)
elseif option.description then
msg_text = tostring(option.description)
end
local opt = {
label = option.label,
description = msg_text,
@ -358,7 +358,7 @@ function wesnoth.wml_actions.message(cfg)
default = option.default,
value = option.value
}
table.insert(options, opt)
table.insert(option_events, {})

View File

@ -103,7 +103,7 @@ function wesnoth.wml_actions.modify_side(cfg)
side.variables.__cfg = wml.merge(side.variables.__cfg, content, cfg.var_merge_mode or "replace")
end
end
if cfg.switch_ai then
side:switch_ai(cfg.switch_ai)
end

View File

@ -113,7 +113,7 @@ function wesnoth.wml_actions.move_unit(cfg)
local x2, y2 = current_unit.x, current_unit.y
current_unit.x, current_unit.y = x, y
current_unit:to_map()
if unshroud then
wesnoth.wml_actions.redraw {clear_shroud=true}
end

View File

@ -124,7 +124,7 @@ function wesnoth.wml_actions.set_variable(cfg, variables)
local ivalue, fvalue = math.modf(tonumber(cfg.fpart) or 0)
variables[name] = fvalue
end
-- similarly, min and max operate on the list assigned to the variable
-- and do not consider value already contained in the variable
if cfg.min then
@ -134,7 +134,7 @@ function wesnoth.wml_actions.set_variable(cfg, variables)
end
variables[name] = math.min(table.unpack(values))
end
if cfg.max then
local values = cfg.max:split()
for i = 1, #values do