Skip to content

Commit

Permalink
Engine: fix Room.NearestWalkableArea, use room->mask coord conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-mogilko committed Feb 1, 2025
1 parent 22feff5 commit 53c6319
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Engine/ac/room.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,11 @@ ScriptUserObject *Room_NearestWalkableArea(int x, int y)
{
if (displayed_room < 0)
quit("!Room.NearestWalkableArea: no room is currently loaded");
data_to_game_coords(&x, &y);
Point found_pt;
if (Pathfinding::FindNearestWalkablePoint(thisroom.WalkAreaMask.get(), Point(x, y), found_pt))
if (Pathfinding::FindNearestWalkablePoint(thisroom.WalkAreaMask.get(),
Point(room_to_mask_coord(x), room_to_mask_coord(y)), found_pt))
{
game_to_data_coords(found_pt.X, found_pt.Y);
return ScriptStructHelpers::CreatePoint(found_pt.X, found_pt.Y);
return ScriptStructHelpers::CreatePoint(mask_to_room_coord(found_pt.X), mask_to_room_coord(found_pt.Y));
}
return nullptr;
}
Expand Down

0 comments on commit 53c6319

Please sign in to comment.