From dbd66d7d64361e76e3e366d919001a5b7ecd77c9 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Thu, 10 Mar 2005 23:17:38 +0000 Subject: Experimental mouse walk command and fixed one instability issue. --- src/being.cpp | 2 +- src/game.cpp | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'src') 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; -- cgit v1.2.3-70-g09d2