summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-03-10 23:17:38 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-03-10 23:17:38 +0000
commitdbd66d7d64361e76e3e366d919001a5b7ecd77c9 (patch)
treefa3c29fa5ffc8a978b64ddc385cd283ae4c9906e /src
parent627d4d27d594fb7356c3d4e9f4cb45eff77c1e48 (diff)
downloadmana-client-dbd66d7d64361e76e3e366d919001a5b7ecd77c9.tar.gz
mana-client-dbd66d7d64361e76e3e366d919001a5b7ecd77c9.tar.bz2
mana-client-dbd66d7d64361e76e3e366d919001a5b7ecd77c9.tar.xz
mana-client-dbd66d7d64361e76e3e366d919001a5b7ecd77c9.zip
Experimental mouse walk command and fixed one instability issue.
Diffstat (limited to 'src')
-rw-r--r--src/being.cpp2
-rw-r--r--src/game.cpp13
2 files changed, 10 insertions, 5 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 8de5125c..c3add140 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -183,7 +183,7 @@ bool Being::hasPath()
void Being::nextStep()
{
- if (path->next) {
+ if (path && path->next) {
int old_x, old_y, new_x, new_y;
old_x = path->x;
old_y = path->y;
diff --git a/src/game.cpp b/src/game.cpp
index 416e1a92..cb6d3615 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -330,13 +330,14 @@ void do_input()
if (event.type == SDL_MOUSEBUTTONDOWN)
{
+ int mx = event.button.x / 32 + camera_x;
+ int my = event.button.y / 32 + camera_y;
+
if (event.button.button == 3)
{
// We click the right button
// NPC Call
- int npc_x = event.button.x / 32 + camera_x;
- int npc_y = event.button.y / 32 + camera_y;
- int id = find_npc(npc_x, npc_y);
+ int id = find_npc(mx, my);
if (id != 0)
{
// Check if no conflicting npc window is open
@@ -350,6 +351,11 @@ void do_input()
}
}
}
+ else if (event.button.button == 1)
+ {
+ // Experimental mouse walk command
+ walk(mx, my, 0);
+ }
}
// Push input to GUI when not used
@@ -454,7 +460,6 @@ int get_packet_length(short id) {
void do_parse() {
unsigned short id;
char *temp;
- char direction;
Being *being = NULL;
FloorItem *floorItem = NULL;
int len, n_items;