Beautified error message when passing an invalid side attribute to [gold].

(Subsumes patch #1477.)
This commit is contained in:
Guillaume Melquiond 2010-02-27 09:55:49 +00:00
parent b6afa49502
commit 6f9986d190

View file

@ -123,7 +123,9 @@ local function wml_message(cfg)
end end
local function wml_gold(cfg) local function wml_gold(cfg)
local team = wesnoth.get_side(cfg.side or 1) local side = tonumber(cfg.side or 1) or
helper.wml_error("[gold] given a noninteger side= attribute.")
local team = wesnoth.get_side(side)
local amount = tonumber(cfg.amount) or local amount = tonumber(cfg.amount) or
helper.wml_error("[gold] missing required amount= attribute.") helper.wml_error("[gold] missing required amount= attribute.")
team.gold = team.gold + amount team.gold = team.gold + amount