New [fire_event] tag to fire any (possibly custom) event from an event.
In short, it works like this : [fire_event] name=event name [primary_unit] x=x1 y=y1 weapon=attack_weapon [/primary_unit] [secondary_unit] x=x2 y=y2 weapon=defend_weapon [/secondary_unit] [/fire_event]
This commit is contained in:
parent
f910b9240f
commit
8f3ad1f8f8
2 changed files with 26 additions and 0 deletions
|
@ -58,6 +58,7 @@ Version 1.5.0-svn:
|
|||
* it's now possible to specify with loop= how many times a sample
|
||||
associated with a sound source should be played
|
||||
* new [switch] conditional command
|
||||
* new [fire_event] event tag to fire any custom event
|
||||
* new [unit_side] theme element : this is the side of the current unit (flag)
|
||||
* miscellaneous and bug fixes:
|
||||
* Removed spurious -R linker switch from command line generated by the Boost
|
||||
|
|
|
@ -2229,6 +2229,31 @@ void event_handler::handle_event_command(const queued_event& event_info,
|
|||
new_handlers.push_back(event_handler(cfg.get_config()));
|
||||
}
|
||||
|
||||
// Fire any events
|
||||
else if(cmd == "fire_event") {
|
||||
gamemap::location loc1,loc2;
|
||||
config data;
|
||||
if (cfg.has_child("primary_unit")) {
|
||||
vconfig u = cfg.child("primary_unit");
|
||||
if (u.has_attribute("x") && u.has_attribute("y"))
|
||||
loc1 = cfg_to_loc(u);
|
||||
if (u.has_attribute("weapon")) {
|
||||
config& f = data.add_child("first");
|
||||
f["weapon"] = u.get_attribute("weapon");
|
||||
}
|
||||
}
|
||||
if (cfg.has_child("secondary_unit")) {
|
||||
vconfig u = cfg.child("secondary_unit");
|
||||
if (u.has_attribute("x") && u.has_attribute("y"))
|
||||
loc2 = cfg_to_loc(u);
|
||||
if (u.has_attribute("weapon")) {
|
||||
config& s = data.add_child("second");
|
||||
s["weapon"] = u.get_attribute("weapon");
|
||||
}
|
||||
}
|
||||
game_events::fire(cfg["name"],loc1,loc2,data);
|
||||
}
|
||||
|
||||
// Setting of menu items
|
||||
else if(cmd == "set_menu_item") {
|
||||
/*
|
||||
|
|
Loading…
Add table
Reference in a new issue