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/hudtargetstatus.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/hudtargetstatus.cc')
-rw-r--r--src/client/hudtargetstatus.cc25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/client/hudtargetstatus.cc b/src/client/hudtargetstatus.cc
index 893d816..77fb60d 100644
--- a/src/client/hudtargetstatus.cc
+++ b/src/client/hudtargetstatus.cc
@@ -38,26 +38,39 @@ void HUDTargetStatus::draw()
pos[1] += padding;
math::Vector2f s(width() - 2.0f * padding, height() - 2.0f * padding);
-
+
+ // reputation color
+ std::string label_color;
+ const float reputation = core::localplayer()->reputation(target->faction());
+
+ if (reputation >= core::range::reputation_friendly) {
+ // friendly
+ label_color.assign("^2");
+ } else if (reputation <= core::range::reputation_hostile) {
+ // hostile
+ label_color.assign("^1");
+ } else {
+ label_color.assign("^B");
+ }
std::ostringstream targetinfostr;
if (target->type() == core::Entity::Controlable) {
const core::EntityControlable *target_controlable = static_cast<const core::EntityControlable *>(target);
if (target_controlable->owner()) {
- targetinfostr << "^B" << target_controlable->owner()->name() << "\n";
+ targetinfostr << label_color << target_controlable->owner()->name() << "\n";
} else {
- targetinfostr << "^B" << target->name() << "\n";
+ targetinfostr << label_color << target->name() << "\n";
}
if (target->info()) {
- targetinfostr << "^B" << target->info()->name() << "\n";
+ targetinfostr << "^N" << target->info()->name() << "\n";
} else {
targetinfostr << "\n";
}
} else {
- targetinfostr << "^B" << target->name() << "\n";
+ targetinfostr << label_color << target->name() << "\n";
if (target->info()) {
core::game()->request_info(target->info()->id());
- targetinfostr << "^B" << target->info()->name() << "\n";
+ targetinfostr << "^N" << target->info()->name() << "\n";
} else {
targetinfostr << "\n";
}