From 3213f41daeed034c8aa9b8be9e86796737a38a78 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Sat, 2 Sep 2006 12:50:40 +0000 Subject: Applied patch by Bernard Lidicky, adding targetting nearest monster with either keyboard or mouse. Also made clicking beings in general a bit easier (patch applied by Bjørn Lindeijer). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/gui/gui.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index a0548e9c..6c46d636 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -280,7 +280,7 @@ Gui::mousePress(int mx, int my, int button) FloorItem *item; // Interact with some being - if ((being = beingManager->findBeing(tilex, tiley))) + if ((being = beingManager->findNearestLivingBeing(tilex, tiley, 1))) { switch (being->getType()) { @@ -317,6 +317,20 @@ Gui::mousePress(int mx, int my, int button) } } } + + if (button == gcn::MouseInput::MIDDLE) + { + // Find the being nearest to the clicked position + Being *target = beingManager->findNearestLivingBeing( + player_node->mX, + player_node->mY, + 20, Being::MONSTER); + + if (target) + { + player_node->setTarget(target); + } + } } void -- cgit v1.2.3-70-g09d2