give WML authors a user-friendly and more consistent naming scheme for...

...auto-stored unit variables
This commit is contained in:
Patrick Parker 2007-02-03 03:40:34 +00:00
parent b82dbbcd2b
commit fc740cdf2d
4 changed files with 11 additions and 11 deletions

View file

@ -192,9 +192,9 @@ Version 1.3-svn:
* Animations now have a frequency= filter to allow to tweak realtive rarety
compatible)
* [message]s now use the duration= tag instead of [delay]ing afterwards
* the filtered unit can be accessed in SUF using $_filtered_unit
* the primary unit can be accessed in filter using $_primary_unit
* the secondary unit can be accessed in filter using $_secondary_unit
* the filtered unit can be accessed in SUF using $this_unit
* the primary unit can be accessed in events using $unit
* the secondary unit can be accessed in events using $second_unit
* added support for random_start_time in [scenario] (feature request #8024)
* extended label to support team only and colors
* gender-specific forms for trait names are now possible.

View file

@ -498,7 +498,7 @@ victory_when_enemies_defeated=no
speaker=unit
[if]
[variable]
name=Unit.description
name=MyUnit.description
equals="Arne"
[/variable]
[then]
@ -512,11 +512,11 @@ victory_when_enemies_defeated=no
x=3,4,5
y=5,5,5
[/filter]
variable=Unit
variable=MyUnit
[/store_unit]
[if]
[variable]
name=Unit.description
name=MyUnit.description
equals="Arne"
[/variable]
[then]

View file

@ -301,19 +301,19 @@ void event_handler::add_event_var(const unit* primary_unit, const unit* secondar
if(primary_unit) {
config tmp_cfg;
primary_unit->write(tmp_cfg);
cfg_.add_local_var("_primary_unit",tmp_cfg);
cfg_.add_local_var("unit",tmp_cfg);
}
if(secondary_unit) {
config tmp_cfg;
secondary_unit->write(tmp_cfg);
cfg_.add_local_var("_secondary_unit",tmp_cfg);
cfg_.add_local_var("second_unit",tmp_cfg);
}
}
void event_handler::rem_event_var()
{
cfg_.rem_local_var("_primary_unit");
cfg_.rem_local_var("_secondary_unit");
cfg_.rem_local_var("unit");
cfg_.rem_local_var("second_unit");
}
gamemap::location cfg_to_loc(const vconfig cfg,int defaultx = 0, int defaulty = 0)

View file

@ -717,7 +717,7 @@ bool unit::matches_filter(const config& orig_cfg,const gamemap::location& loc,bo
vconfig tmp_vconf(&orig_cfg);
config tmp_unit;
write(tmp_unit);
tmp_vconf.add_local_var("_filtered_unit",tmp_unit);
tmp_vconf.add_local_var("this_unit",tmp_unit);
config cfg = tmp_vconf.get_parsed_config();
const std::string& description = cfg["description"];
const std::string& speaker = cfg["speaker"];