Remove deprecated [goal]name=protect_my_unit

This commit is contained in:
Celtic Minstrel 2016-02-27 23:39:52 -05:00 committed by mattsc
parent bcbba6dde3
commit f545fbcbe8
3 changed files with 5 additions and 30 deletions

View file

@ -262,11 +262,7 @@ void protect_goal::add_targets(std::back_insert_iterator< std::vector< target >
{
std::string goal_type;
if (protect_unit_) {
if (protect_only_own_unit_) {
goal_type = "protect_my_unit";
} else {
goal_type = "protect_unit";
}
goal_type = "protect_unit";
} else {
goal_type ="protect_location";
}
@ -291,9 +287,6 @@ void protect_goal::add_targets(std::back_insert_iterator< std::vector< target >
const unit_filter ufilt(vconfig(criteria), resources::filter_con);
BOOST_FOREACH(const unit &u, units)
{
if (protect_only_own_unit_ && u.side() != get_side()) {
continue;
}
//TODO: we will protect hidden units, by not testing for invisibility to current side
if (ufilt(u)) {
DBG_AI_GOAL << "side " << get_side() << ": in " << goal_type << ": " << u.get_location() << " should be protected\n";
@ -325,17 +318,13 @@ void protect_goal::add_targets(std::back_insert_iterator< std::vector< target >
}
protect_goal::protect_goal(readonly_context &context, const config &cfg, bool protect_only_own_unit, bool protect_unit)
protect_goal::protect_goal(readonly_context &context, const config &cfg, bool protect_unit)
: goal(context,cfg)
, filter_ptr_()
, protect_only_own_unit_(protect_only_own_unit)
, protect_unit_(protect_unit)
, radius_(20) //this default radius is taken from old code
, value_(1.0) //this default value taken from old code
{
if(protect_only_own_unit_) {
lg::wml_error() << deprecate_wml_key_warning("protect_my_unit", "1.13.0") << "\n";
}
}
lua_goal::lua_goal(readonly_context &context, const config &cfg)

View file

@ -127,7 +127,7 @@ private:
class protect_goal : public goal {
public:
protect_goal(readonly_context &context, const config &cfg, bool protect_only_own_unit, bool protect_unit);
protect_goal(readonly_context &context, const config &cfg, bool protect_unit);
virtual void add_targets(std::back_insert_iterator< std::vector< target > > target_list);
@ -143,7 +143,6 @@ private:
}
boost::shared_ptr<terrain_filter> filter_ptr_;
bool protect_only_own_unit_;
bool protect_unit_;
int radius_;
double value_;
@ -153,7 +152,7 @@ private:
class protect_location_goal : public protect_goal {
public:
protect_location_goal(readonly_context &context, const config &cfg)
: protect_goal(context,cfg,false,false)
: protect_goal(context,cfg,false)
{
}
};
@ -162,16 +161,7 @@ public:
class protect_unit_goal : public protect_goal {
public:
protect_unit_goal(readonly_context &context, const config &cfg)
: protect_goal(context,cfg,false,true)
{
}
};
class protect_my_unit_goal : public protect_goal {
public:
protect_my_unit_goal(readonly_context &context, const config &cfg)
: protect_goal(context,cfg,true,true)
: protect_goal(context,cfg,true)
{
}
};

View file

@ -230,10 +230,6 @@ static register_goal_factory<protect_location_goal>
goal_factory_protect_location("protect_location");
static register_goal_factory<protect_my_unit_goal>
goal_factory_protect_my_unit("protect_my_unit");
static register_goal_factory<protect_unit_goal>
goal_factory_protect_unit("protect_unit");