Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/targets.cc13
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;