summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;