Added a new macro file debug-utils.cfg...
...and moved some debugging macros there.
This commit is contained in:
parent
137ca6bbf3
commit
b6e15aaaf3
2 changed files with 71 additions and 38 deletions
71
data/core/macros/debug-utils.cfg
Normal file
71
data/core/macros/debug-utils.cfg
Normal file
|
@ -0,0 +1,71 @@
|
|||
#textdomain wesnoth
|
||||
# This file contains macros useful for debugging and testing purposes.
|
||||
|
||||
#define DEBUG_MSG MESSAGE_TEXT
|
||||
# Emit a debug message. Meant to be overridden with no-op definition
|
||||
# of the same name for production use.
|
||||
[message]
|
||||
speaker=narrator
|
||||
message={MESSAGE_TEXT}
|
||||
image=wesnoth-icon.png
|
||||
[/message]
|
||||
#enddef
|
||||
|
||||
#define TIME_ACTIONS CONTENT_WML
|
||||
# Messing with the variable is annoying, so I'll deprecate this in favour of
|
||||
# TIMED_ACTIONS (below)
|
||||
{DEPRECATE TIME_ACTIONS 1.9.4}
|
||||
|
||||
# Measure (in milliseconds) the time arbitrary event WML takes to
|
||||
# execute. Afterwards, the time the enclosed WML took to execute
|
||||
# is found in the variable $timed_actions_ms.
|
||||
#
|
||||
# Example:
|
||||
#! [event]
|
||||
#! name=start
|
||||
#!
|
||||
#! {TIME_ACTIONS (
|
||||
#! {MODIFY_UNIT race=orc name ( _ "Azir")}
|
||||
#! )}
|
||||
#!
|
||||
#! {DEBUG_MSG "Renaming all orcs to Azir took $timed_actions_ms|ms."}
|
||||
#! [/event]
|
||||
{VARIABLE_OP TIME_ACTIONS_time_begin time stamp}
|
||||
|
||||
{CONTENT_WML}
|
||||
|
||||
{VARIABLE_OP TIME_ACTIONS_time_end time stamp}
|
||||
|
||||
{VARIABLE timed_actions_ms $TIME_ACTIONS_time_end}
|
||||
{VARIABLE_OP timed_actions_ms add "-$TIME_ACTIONS_time_begin"}
|
||||
|
||||
{CLEAR_VARIABLE TIME_ACTIONS_time_begin}
|
||||
{CLEAR_VARIABLE TIME_ACTIONS_time_end}
|
||||
#enddef
|
||||
|
||||
#define TIMED_ACTIONS TITLE CONTENT_WML
|
||||
# Measure (in milliseconds) the time arbitrary event WML takes to
|
||||
# execute.
|
||||
#
|
||||
# Example:
|
||||
#! [event]
|
||||
#! name=start
|
||||
#!
|
||||
#! {TIME_ACTIONS "orc renaming" (
|
||||
#! {MODIFY_UNIT race=orc name ( _ "Azir")}
|
||||
#! )}
|
||||
#! [/event]
|
||||
{VARIABLE_OP TIME_ACTIONS_time_begin time stamp}
|
||||
|
||||
{CONTENT_WML}
|
||||
|
||||
{VARIABLE_OP TIME_ACTIONS_time_end time stamp}
|
||||
|
||||
[message]
|
||||
speaker=narrator
|
||||
caption={TITLE}
|
||||
message="$($TIME_ACTIONS_time_end - $TIME_ACTIONS_time_begin) milliseconds."
|
||||
[/message]
|
||||
|
||||
{CLEAR_VARIABLE TIME_ACTIONS_time_begin,TIME_ACTIONS_time_end}
|
||||
#enddef
|
|
@ -241,16 +241,6 @@
|
|||
[/if]
|
||||
#enddef
|
||||
|
||||
#define DEBUG_MSG MESSAGE_TEXT
|
||||
# Emit a debug message. Meant to be overridden with no-op definition
|
||||
# of the same name for production use.
|
||||
[message]
|
||||
speaker=narrator
|
||||
message={MESSAGE_TEXT}
|
||||
image=wesnoth-icon.png
|
||||
[/message]
|
||||
#enddef
|
||||
|
||||
#define MODIFY_UNIT FILTER VAR VALUE
|
||||
# Alters a unit variable (such as unit.x, unit.type,
|
||||
# unit.side), handling all the storing and unstoring.
|
||||
|
@ -388,34 +378,6 @@
|
|||
#define MENU_IMG_TXT2 IMAGE FIRST_TEXT_VALUE SECOND_TEXT_VALUE
|
||||
"&"+{IMAGE}+"="+{FIRST_TEXT_VALUE}+"="+{SECOND_TEXT_VALUE}#enddef
|
||||
|
||||
#define TIME_ACTIONS CONTENT_WML
|
||||
# Measure (in milliseconds) the time arbitrary event WML takes to
|
||||
# execute. Afterwards, the time the enclosed WML took to execute
|
||||
# is found in the variable $timed_actions_ms.
|
||||
#
|
||||
# Example:
|
||||
#! [event]
|
||||
#! name=start
|
||||
#!
|
||||
#! {TIME_ACTIONS (
|
||||
#! {MODIFY_UNIT race=orc name ( _ "Azir")}
|
||||
#! )}
|
||||
#!
|
||||
#! {DEBUG_MSG "Renaming all orcs to Azir took $timed_actions_ms|ms."}
|
||||
#! [/event]
|
||||
{VARIABLE_OP TIME_ACTIONS_time_begin time stamp}
|
||||
|
||||
{CONTENT_WML}
|
||||
|
||||
{VARIABLE_OP TIME_ACTIONS_time_end time stamp}
|
||||
|
||||
{VARIABLE timed_actions_ms $TIME_ACTIONS_time_end}
|
||||
{VARIABLE_OP timed_actions_ms add "-$TIME_ACTIONS_time_begin"}
|
||||
|
||||
{CLEAR_VARIABLE TIME_ACTIONS_time_begin}
|
||||
{CLEAR_VARIABLE TIME_ACTIONS_time_end}
|
||||
#enddef
|
||||
|
||||
#define RECRUIT_UNIT_VARIATIONS SIDE TYPE VARIATIONS_VALUE
|
||||
# Allows a side to seemingly recruit variations of a given unit, such as the
|
||||
# the Walking Corpse.
|
||||
|
|
Loading…
Add table
Reference in a new issue