Skip to content

Commit

Permalink
Do not select unit in silent object
Browse files Browse the repository at this point in the history
This causes, for example, units the player does not control to be selected at the start of HttT S08, S11 and S16.
  • Loading branch information
GregoryLundberg committed Aug 12, 2016
1 parent cf4f488 commit 652c5b9
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions data/lua/wml/object.lua
Expand Up @@ -24,6 +24,10 @@ function wml_actions.object(cfg)
unit = wesnoth.get_unit(context.x1, context.y1)
end

-- Default to silent if object has no description
local silent = cfg.silent
if silent == nil then silent = (text:len() == 0) end

-- If a unit matches the filter, proceed
if unit then
text = tostring(cfg.description or "")
Expand All @@ -41,8 +45,10 @@ function wml_actions.object(cfg)
wesnoth.add_modification(unit, "object", helper.parsed(cfg), add)
end

wesnoth.select_unit(unit, false)
wesnoth.highlight_hex(unit.x, unit.y)
if not silent then
wesnoth.select_unit(unit, false)
wesnoth.highlight_hex(unit.x, unit.y)
end

-- Mark this item as used up
if obj_id and unique then used_items[obj_id] = true end
Expand All @@ -51,10 +57,6 @@ function wml_actions.object(cfg)
command_type = "else"
end

-- Default to silent if object has no description
local silent = cfg.silent
if silent == nil then silent = (text:len() == 0) end

if not silent then
wml_actions.redraw{}
local name = tostring(cfg.name or "")
Expand Down

0 comments on commit 652c5b9

Please sign in to comment.