Skip to content

Commit

Permalink
Remove deprecated [goal]name=protect_my_unit
Browse files Browse the repository at this point in the history
  • Loading branch information
CelticMinstrel authored and mattsc committed Mar 22, 2016
1 parent bcbba6d commit f545fbc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 30 deletions.
15 changes: 2 additions & 13 deletions src/ai/composite/goal.cpp
Expand Up @@ -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";
}
Expand All @@ -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";
Expand Down Expand Up @@ -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)
Expand Down
16 changes: 3 additions & 13 deletions src/ai/composite/goal.hpp
Expand Up @@ -127,7 +127,7 @@ class target_location_goal : public goal {

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);
Expand All @@ -143,7 +143,6 @@ class protect_goal : public goal {
}

boost::shared_ptr<terrain_filter> filter_ptr_;
bool protect_only_own_unit_;
bool protect_unit_;
int radius_;
double value_;
Expand All @@ -153,7 +152,7 @@ class protect_goal : public goal {
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)
{
}
};
Expand All @@ -162,16 +161,7 @@ class protect_location_goal : public protect_goal {
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)
{
}
};
Expand Down
4 changes: 0 additions & 4 deletions src/ai/registry.cpp
Expand Up @@ -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");

Expand Down

0 comments on commit f545fbc

Please sign in to comment.