diff --git a/src/ai/composite/goal.cpp b/src/ai/composite/goal.cpp index 329f5efa28a5..5da4662fb692 100644 --- a/src/ai/composite/goal.cpp +++ b/src/ai/composite/goal.cpp @@ -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) diff --git a/src/ai/composite/goal.hpp b/src/ai/composite/goal.hpp index 57feed936d7a..7964011c1bbc 100644 --- a/src/ai/composite/goal.hpp +++ b/src/ai/composite/goal.hpp @@ -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); @@ -143,7 +143,6 @@ class protect_goal : public goal { } boost::shared_ptr filter_ptr_; - bool protect_only_own_unit_; bool protect_unit_; int radius_; double value_; @@ -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) { } }; @@ -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) { } }; diff --git a/src/ai/registry.cpp b/src/ai/registry.cpp index 2da48282d5a0..ebfea9a4c882 100644 --- a/src/ai/registry.cpp +++ b/src/ai/registry.cpp @@ -230,10 +230,6 @@ static register_goal_factory goal_factory_protect_location("protect_location"); -static register_goal_factory - goal_factory_protect_my_unit("protect_my_unit"); - - static register_goal_factory goal_factory_protect_unit("protect_unit");