Added unit::get_role. Renamed unit::assign_role.

This commit is contained in:
Guillaume Melquiond 2009-05-08 08:41:46 +00:00
parent b2a84544dc
commit cb549ea282
2 changed files with 5 additions and 3 deletions

View file

@ -1722,7 +1722,7 @@ WML_HANDLER_FUNCTION(role, /*event_info*/, cfg)
unit_map::iterator itor;
for (itor = rsrc.units->begin(); itor != rsrc.units->end(); ++itor) {
if(game_events::unit_matches_filter(itor, filter)) {
itor->second.assign_role(cfg["role"]);
itor->second.set_role(cfg["role"]);
found = true;
break;
}
@ -1761,7 +1761,7 @@ WML_HANDLER_FUNCTION(role, /*event_info*/, cfg)
u.set_game_context(rsrc.units, rsrc.game_map, rsrc.status_ptr, rsrc.teams);
scoped_recall_unit auto_store("this_unit", player_id, i);
if(game_events::unit_matches_filter(u, filter, map_location())) {
u.assign_role(cfg["role"]);
u.set_role(cfg["role"]);
found=true;
break;
}

View file

@ -187,7 +187,9 @@ public:
void write(config& cfg) const;
// void write(config_writer& out) const;
void assign_role(const std::string& role) { role_ = role; }
void set_role(const std::string& role) { role_ = role; }
const std::string &get_role() const { return role_; }
void assign_ai_special(const std::string& s) { ai_special_ = s;}
std::string get_ai_special() const { return(ai_special_); }
const std::vector<attack_type>& attacks() const { return attacks_; }