More macro typechecking improvements.

This commit is contained in:
Eric S. Raymond 2008-02-14 04:56:52 +00:00
parent 06d31fba2b
commit 608ded4239
6 changed files with 48 additions and 48 deletions

View file

@ -85,7 +85,7 @@
# Ice randomly breaks and kills the unit (0.25 probability).
# This event should filter out flying units, but doesn't yet.
#define IF_ICE_BREAKS ACTION
#define IF_ICE_BREAKS ACTION_WML
[set_variable]
name=ice_random
random=1,2,3,4
@ -96,7 +96,7 @@
numerical_equals=1
[/variable]
[then]
{ACTION}
{ACTION_WML}
[terrain]
terrain=Wo
x,y=$x1,$y1

View file

@ -13,7 +13,7 @@
[/have_location]
#enddef
#define IF_VAR VAR OP VAL CONTENTS
#define IF_VAR VAR OP_NAME VALUE CONTENTS_WML
# Shortcut for IF statements testing the value of a variable.
# Need to write [then] and [else] tags manually.
# Use like this:
@ -24,16 +24,16 @@
#! )}
[if]
[variable]
name={VAR}
{OP}={VAL}
name={VAR_NAME}
{OP_NAME}={VALUE}
[/variable]
{CONTENTS}
{CONTENTS_WML}
[/if]
#enddef
#define IF_ALIVE SIDE ACTION
# Condition triggering of ACTION on whether SIDE has at least one unit left.
#define IF_ALIVE SIDE ACTION_WML
# Condition triggering of ACTION_WML on whether SIDE has at least one unit left.
# For example, if the player 2 is still alive, kill all his units.
#! {IF_ALIVE 2 (
#! [kill]
@ -45,13 +45,13 @@
side={SIDE}
[/have_unit]
[then]
{ACTION}
{ACTION_WML}
[/then]
[/if]
#enddef
#define IF_DEAD SIDE ACTION
# Condition triggering of ACTION on whether SIDE has no units left.
#define IF_DEAD SIDE ACTION_WML
# Condition triggering of ACTION_WML on whether SIDE has no units left.
# For example, give player 2 gold if player 1 is dead
#! {IF_DEAD 1 (
#! [gold]
@ -66,12 +66,12 @@
[then]
[/then]
[else]
{ACTION}
{ACTION_WML}
[/else]
[/if]
#enddef
#define IF_ALLIED PLAYER1 PLAYER2 ACTION
#define IF_ALLIED PLAYER1 PLAYER2 ACTION_WML
# Condition that triggers if PLAYER1 and PLAYER2 belong to the same team.
# NOTE: only works if leaders are alive, are the same leader as the game
# started and haven't changed teams.
@ -110,7 +110,7 @@
equals=$leader2.team_name
[/variable]
[then]
{ACTION}
{ACTION_WML}
[/then]
[/if]
[clear_variable]

View file

@ -9,15 +9,15 @@
# These don't depend on any other macros. Please don't change this.
# ! in comments is used in generating HTML documentation, ignore it otherwise.
#define ON_EVENT NAME ACTION
#define ON_EVENT NAME ACTION_WML
# Creates a generic event. Strictly a syntactic shortcut
[event]
name={NAME}
{ACTION}
{ACTION_WML}
[/event]
#enddef
#define ON_PRESTART ACTION
#define ON_PRESTART ACTION_WML
# Creates an event that triggers when the scenario starts but before the user
# gets any visible output. Strictly a syntactic shortcut.
#
@ -32,11 +32,11 @@
#! )}
[event]
name=prestart
{ACTION}
{ACTION_WML}
[/event]
#enddef
#define ON_START ACTION
#define ON_START ACTION_WML
# Creates an event that triggers when the scenario starts, after the map is
# displayed but before the player can act. Strictly a syntactic shortcut.
#
@ -55,11 +55,11 @@
#! )}
[event]
name=start
{ACTION}
{ACTION_WML}
[/event]
#enddef
#define ON_SIDETURN ACTION
#define ON_SIDETURN ACTION_WML
# Creates an event that triggers at the start of every players turn
# For example, you could set each players gold to a fixed amount every turn.
#! {ON_SIDETURN (
@ -71,11 +71,11 @@
[event]
name=side turn
first_time_only=no
{ACTION}
{ACTION_WML}
[/event]
#enddef
#define ON_TURN TURN ACTION
#define ON_TURN TURN ACTION_WML
# Creates an event that triggers at the start of turn TURN
# For example you can create a Wose belonging to player 1 at turn 3:
# Strictly a syntactic shortcut.
@ -88,11 +88,11 @@
#! )}
[event]
name=turn {TURN}
{ACTION}
{ACTION_WML}
[/event]
#enddef
#define ON_VICTORY ACTION
#define ON_VICTORY ACTION_WML
# Creates an event that triggers when a player wins the game, before
# the game ends. Strictly a syntactic shortcut.
#
@ -105,11 +105,11 @@
#! )}
[event]
name=victory
{ACTION}
{ACTION_WML}
[/event]
#enddef
#define ON_DEFEAT ACTION
#define ON_DEFEAT ACTION_WML
# Creates an event that triggers when a player wins the game, before
# the game ends. Strictly a syntactic shortcut.
#
@ -123,7 +123,7 @@
#! )}
[event]
name=defeat
{ACTION}
{ACTION_WML}
[/event]
#enddef
@ -143,7 +143,7 @@
[/allow_undo]
#enddef
#define ON_TILE_ONCE X Y FILTER ACTION
#define ON_TILE_ONCE X Y FILTER ACTION_WML
# Creates an event that triggers the first time a unit steps on a
# given tile. The filter can be used to only affect special units, or
# units of a given player.
@ -164,6 +164,6 @@
y={Y}
{FILTER}
[/filter]
{ACTION}
{ACTION_WML}
[/event]
#enddef

View file

@ -379,8 +379,8 @@
[/scroll]
#enddef
#define EARTHQUAKE ACTION
# Creates an earthquake-effect while performing ACTION
#define EARTHQUAKE ACTION_WML
# Creates an earthquake-effect while performing ACTION_WML
# For example we could kill all non-leader units in the earthquake:
#! {EARTHQUAKE (
#! [kill]
@ -394,7 +394,7 @@
{SCROLL 2 1}
{SCROLL -1 -3}
{SCROLL -3 1}
{ACTION}
{ACTION_WML}
{SCROLL 1 3}
{SCROLL 1 -2}
#enddef
@ -410,7 +410,7 @@
[/colour_adjust]
#enddef
# Flashes the screen with a given color performing ACTION
# Flashes the screen with a given color performing ACTION_WML
# These macros come in WHITE, RED, GREEN and BLUE and can
# easily be expanded for ORANGE, PURPLE etc.
#
@ -420,44 +420,44 @@
#! {FLASH_BLUE ()}
#! {FLASH_WHITE ()}
#define FLASH_WHITE ACTION
#define FLASH_WHITE ACTION_WML
# Flash the screen momentarily white.
{COLOR_ADJUST 67 67 67}
{COLOR_ADJUST 100 100 100}
{ACTION}
{ACTION_WML}
{COLOR_ADJUST 33 33 33}
{COLOR_ADJUST 0 0 0}
#enddef
#define FLASH_RED ACTION
#define FLASH_RED ACTION_WML
# Flash the screen momentarily red.
{COLOR_ADJUST 67 0 0}
{COLOR_ADJUST 100 0 0}
{ACTION}
{ACTION_WML}
{COLOR_ADJUST 33 0 0}
{COLOR_ADJUST 0 0 0}
#enddef
#define FLASH_GREEN ACTION
#define FLASH_GREEN ACTION_WML
# Flash the screen momentarily green.
{COLOR_ADJUST 0 67 0}
{COLOR_ADJUST 0 100 0}
{ACTION}
{ACTION_WML}
{COLOR_ADJUST 0 33 0}
{COLOR_ADJUST 0 0 0}
#enddef
#define FLASH_BLUE ACTION
#define FLASH_BLUE ACTION_WML
# Flash the screen momentarily blue.
{COLOR_ADJUST 0 0 67}
{COLOR_ADJUST 0 0 100}
{ACTION}
{ACTION_WML}
{COLOR_ADJUST 0 0 33}
{COLOR_ADJUST 0 0 0}
#enddef
#define THUNDER ACTION
# Creates a thunder-and-lightning effect while performing ACTION.
#define THUNDER ACTION_WML
# Creates a thunder-and-lightning effect while performing ACTION_WML.
# For example, player 3 might disappear in the flash of lightning:
#! {THUNDER (
#! [store_unit]
@ -471,5 +471,5 @@
[sound]
name=lightning.ogg
[/sound]
{FLASH_WHITE ({ACTION}) }
{FLASH_WHITE ({ACTION_WML}) }
#enddef

View file

@ -63,11 +63,11 @@
[/set_variable]
#enddef
#define VARIABLE_OP VAR OP ARG
#define VARIABLE_OP VAR OP_NAME VALUE
# Macro to do mathematical operations on variables.
[set_variable]
name={VAR}
{OP}={ARG}
{OP_NAME}={VALUE}
[/set_variable]
#enddef

View file

@ -83,7 +83,7 @@ def formaltype(f):
ftype = "image"
elif f in ("MUSIC",) or f.endswith("SOUND"):
ftype = "sound"
elif f in ("FILTER", "ACTION"):
elif f in ("FILTER"):
ftype = "filter"
elif f.endswith("_WML"):
ftype = "wml"