diff options
author | Stijn Buys <ingar@osirion.org> | 2013-11-10 01:45:26 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2013-11-10 01:45:26 +0000 |
commit | 1a1842473c826f4cf327d336b30a1f874e0e470b (patch) | |
tree | 4eda8bdcbdd72f373a27e8c709822ae732dad2dd | |
parent | 1f67a3bb216aa5bd49c0c93a1f2868f34b7e623d (diff) |
Do not target far away ships with func_target_controlable.
-rw-r--r-- | src/client/targets.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/client/targets.cc b/src/client/targets.cc index 1f8b8a1..3c3b2b8 100644 --- a/src/client/targets.cc +++ b/src/client/targets.cc @@ -268,7 +268,12 @@ void func_target_controlable_next(std::string const &args) if (it == zone->content().end()) { it = zone->content().begin(); } - while (!( ((*it)->type() == core::Entity::Controlable) && is_valid_hud_target((*it))) ) { + while ( + !( + is_valid_hud_target((*it)) && + ((*it)->type() == core::Entity::Controlable) && + ((static_cast<core::EntityControlable *>((*it))->owner() || (math::distancesquared(core::localcontrol()->location(), (*it)->location()) < core::range::fxdistance * core::range::fxdistance))) + )) { it++; if (it == zone->content().end()) it = zone->content().begin(); @@ -280,7 +285,11 @@ void func_target_controlable_next(std::string const &args) } } - if ((it != zone->content().end()) && ((*it)->type() == core::Entity::Controlable) && is_valid_hud_target((*it))) { + if ((it != zone->content().end()) && + is_valid_hud_target((*it)) && + ((*it)->type() == core::Entity::Controlable) && + ((static_cast<core::EntityControlable *>((*it))->owner() || (math::distancesquared(core::localcontrol()->location(), (*it)->location()) < core::range::fxdistance * core::range::fxdistance))) + ) { set_target((*it)); } else { current_target = 0; |