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 15:11:49 +0000
committerStijn Buys <ingar@osirion.org>2013-11-10 15:11:49 +0000
commit82f0ac05f5da2d89c4a544ca22ff47e116e6dd97 (patch)
treeae48728db2c85aa68387b942f49055a416d09464 /src/client/targets.cc
parent4db4ba29453ef17022ab71d99e1029c32687c6da (diff)
Introduced global variables for reputation hostile/friendly thresholds,
do not allow players to dock at hostile bases, indicate target reputation in the hud target info widget.
Diffstat (limited to 'src/client/targets.cc')
-rw-r--r--src/client/targets.cc37
1 files changed, 29 insertions, 8 deletions
diff --git a/src/client/targets.cc b/src/client/targets.cc
index 3c3b2b8..088d334 100644
--- a/src/client/targets.cc
+++ b/src/client/targets.cc
@@ -243,7 +243,13 @@ void func_target_controlable_next(std::string const &args)
if (!current_target_id) {
// first entity
it = zone->content().begin();
- while ((it != zone->content().end()) && (((*it)->type() != core::Entity::Controlable) || !is_valid_hud_target((*it)))) {
+ while (
+ (it != zone->content().end()) && (
+ ((*it)->type() != core::Entity::Controlable) ||
+ (math::distancesquared(core::localcontrol()->location(), (*it)->location()) > core::range::fxdistance * core::range::fxdistance) ||
+ !is_valid_hud_target((*it))
+ )
+ ) {
++it;
}
@@ -268,12 +274,12 @@ void func_target_controlable_next(std::string const &args)
if (it == zone->content().end()) {
it = zone->content().begin();
}
- while (
- !(
- 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();
@@ -315,7 +321,13 @@ void func_target_controlable_prev(std::string const &args)
if (!current_target_id) {
// last entity
rit = zone->content().rbegin();
- while ((rit != zone->content().rend()) && (((*rit)->type() != core::Entity::Controlable) || !is_valid_hud_target((*rit)))) {
+ while (
+ (rit != zone->content().rend()) && (
+ ((*rit)->type() != core::Entity::Controlable) ||
+ (math::distancesquared(core::localcontrol()->location(), (*rit)->location()) > core::range::fxdistance * core::range::fxdistance) ||
+ !is_valid_hud_target((*rit))
+ )
+ ) {
++rit;
}
@@ -340,7 +352,12 @@ void func_target_controlable_prev(std::string const &args)
if (rit == zone->content().rend()) {
rit = zone->content().rbegin();
}
- while (!(((*rit)->type() == core::Entity::Controlable) && is_valid_hud_target((*rit))) ) {
+ while (!(
+ is_valid_hud_target((*rit)) &&
+ ((*rit)->type() == core::Entity::Controlable) &&
+ ((static_cast<core::EntityControlable *>((*rit))->owner() || (math::distancesquared(core::localcontrol()->location(), (*rit)->location()) < core::range::fxdistance * core::range::fxdistance)))
+ )
+ ) {
++rit;
if (rit == zone->content().rend())
rit = zone->content().rbegin();
@@ -352,7 +369,11 @@ void func_target_controlable_prev(std::string const &args)
}
}
- if ((rit != zone->content().rend()) && ((*rit)->type() == core::Entity::Controlable) && is_valid_hud_target((*rit))) {
+ if ((rit != zone->content().rend()) &&
+ is_valid_hud_target((*rit)) &&
+ ((*rit)->type() == core::Entity::Controlable) &&
+ ((static_cast<core::EntityControlable *>((*rit))->owner() || (math::distancesquared(core::localcontrol()->location(), (*rit)->location()) < core::range::fxdistance * core::range::fxdistance)))
+ ) {
set_target((*rit));
} else {
current_target = 0;