Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2013-11-10 01:45:26 +0000
committerStijn Buys <ingar@osirion.org>2013-11-10 01:45:26 +0000
commit1a1842473c826f4cf327d336b30a1f874e0e470b (patch)
tree4eda8bdcbdd72f373a27e8c709822ae732dad2dd /src/client/targets.cc
parent1f67a3bb216aa5bd49c0c93a1f2868f34b7e623d (diff)
Do not target far away ships with func_target_controlable.
Diffstat (limited to 'src/client/targets.cc')
-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;