Skip to content

Commit

Permalink
Update the DEPRECATED macro and [deprecated_message] ActionWML to und…
Browse files Browse the repository at this point in the history
…erstand deprecation levels
  • Loading branch information
CelticMinstrel committed Aug 14, 2017
1 parent d192f07 commit c734f56
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
18 changes: 15 additions & 3 deletions data/core/macros/deprecated-utils.cfg
Expand Up @@ -5,11 +5,23 @@

#wmllint: markcheck off
#define DEPRECATE MACRO_NAME VERSION_NAME
# Tag macros for removal, where VERSION_NAME is the the next development series from the date of deprecation.
# Tag ActionWML macros for removal, where VERSION_NAME is the the next development series from the date of deprecation.
[deprecated_message]
message="Macro '" + {MACRO_NAME} + "' is scheduled for removal in Wesnoth " + {VERSION_NAME} + "."
what={MACRO_NAME}
level=2
version={VERSION_NAME}
[/deprecated_message]
#enddef

#define DEPRECATE_ACTION_MACRO MACRO_NAME LEVEL VERSION MESSAGE
# Tag ActionWML macros for removal, where VERSION is the the next development series from the date of deprecation.
[deprecated_message]
what={MACRO_NAME}
level={LEVEL}
version={VERSION_NAME}
message={MESSAGE}
[/deprecated_message]
#enddef
#wmllint: markcheck on

#define MAGENTA_IS_THE_TEAM_COLOR
Expand Down Expand Up @@ -382,6 +394,6 @@ _"No gold carried over to the next scenario."#enddef
#define NO_INTERRUPT_NO_UNDO
# This can be used in mid-movement events (enter_hex and exit_hex) to cause
# no interruption of movement, yet prevent the move from being undone.
{DEPRECATE "NO_INTERRUPT_NO_UNDO" "1.16"}
{DEPRECATE_ACTION_MACRO "NO_INTERRUPT_NO_UNDO" 3 "1.16" ""}
#enddef

9 changes: 8 additions & 1 deletion data/lua/wml-tags.lua
Expand Up @@ -888,8 +888,15 @@ function wml_actions.sound_source(cfg)
end

function wml_actions.deprecated_message(cfg)
if type(cfg.level) ~= "number" or cfg.level < 1 or cfg.level > 4 then
local _ = wesnoth.textdomain "wesnoth"
helper.wml_error(_"Invalid deprecation level (should be 1-4)")
end
wesnoth.deprecation_message(cfg.what, cfg.level, cfg.version, cfg.message or '')
if not wesnoth.game_config.debug then return end
wesnoth.log('wml', cfg.message)
if cfg.level > 1 then
wesnoth.log('wml', cfg.message)
end
end

function wml_actions.wml_message(cfg)
Expand Down
3 changes: 3 additions & 0 deletions data/scenario-test.cfg
Expand Up @@ -3351,7 +3351,10 @@ Result:
x,y=10, 10
[/filter]
[deprecated_message]
what="Deprecation Test"
message="Moving to this location is no longer supported... bye bye"
level=3
version=1.0
[/deprecated_message]
[kill]
x,y=10,10
Expand Down

0 comments on commit c734f56

Please sign in to comment.