Skip to content

Commit

Permalink
Fix issue with move-to-attacked-creature for NPCs.
Browse files Browse the repository at this point in the history
Always clear the last stored attack coords for a new click.
  • Loading branch information
pjbroad committed Nov 24, 2024
1 parent a9c5522 commit 6c7c3eb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions gamewin.c
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,9 @@ static int click_game_handler(window_info *win, int mx, int my, Uint32 flags)
locked_list_ptr actors_list;
actor *me;

// clear any previously stored destination to prevent unexpects walk-to
last_attack_actor_coord_x = last_attack_actor_coord_y = -1;

#ifdef ANDROID
int cur_timestamp;
int time_now = SDL_GetTicks();
Expand Down Expand Up @@ -1125,8 +1128,11 @@ static int click_game_handler(window_info *win, int mx, int my, Uint32 flags)
{
add_highlight(this_actor->x_tile_pos,this_actor->y_tile_pos,
HIGHLIGHT_TYPE_ATTACK_TARGET);
last_attack_actor_coord_x = (short)this_actor->x_tile_pos;
last_attack_actor_coord_y = (short)this_actor->y_tile_pos;
if (thing_under_the_mouse == UNDER_MOUSE_ANIMAL)
{
last_attack_actor_coord_x = (short)this_actor->x_tile_pos;
last_attack_actor_coord_y = (short)this_actor->y_tile_pos;
}
release_locked_actors_list_and_invalidate(actors_list, &me);
}
}
Expand Down

0 comments on commit 6c7c3eb

Please sign in to comment.