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/input.cc2
-rw-r--r--src/client/targets.cc5
-rw-r--r--src/client/targets.h5
3 files changed, 10 insertions, 2 deletions
diff --git a/src/client/input.cc b/src/client/input.cc
index 6306fc8..29226cb 100644
--- a/src/client/input.cc
+++ b/src/client/input.cc
@@ -410,7 +410,7 @@ void key_pressed(Key *key)
} else if (core::application()->connected() && core::localcontrol()) {
- if ((key->sym() == 512 + SDL_BUTTON_LEFT) && targets::hover()) {
+ if ((key->sym() == 512 + SDL_BUTTON_LEFT) && targets::hover() && (targets::current_id() != targets::hover())) {
// hovering target selected
targets::select_target(targets::hover());
diff --git a/src/client/targets.cc b/src/client/targets.cc
index d1bed10..5b8e9ab 100644
--- a/src/client/targets.cc
+++ b/src/client/targets.cc
@@ -51,6 +51,11 @@ core::Entity* current()
return current_target;
}
+unsigned int current_id()
+{
+ return current_target_id;
+}
+
unsigned int hover()
{
return current_hover;
diff --git a/src/client/targets.h b/src/client/targets.h
index c1f78c7..fc2d861 100644
--- a/src/client/targets.h
+++ b/src/client/targets.h
@@ -31,9 +31,12 @@ void render_listener_sound();
/// render the sound for one entity
void render_entity_sound(core::Entity *Entity);
-/// current selected target, 0 if there is no current targer
+/// currently selected target, 0 if there is none
core::Entity *current();
+/// id of the currently selected target, 0 if there is none
+unsigned int current_id();
+
/// id if target the mouse is currently hovering, 0 if none
unsigned int hover();