[Scummvm-git-logs] scummvm master -> 09e8ef68d9c68ba54267e5e731cfb4cb6f5f3a52
mduggan
noreply at scummvm.org
Sun Aug 4 23:07:18 UTC 2024
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
6a24076501 ULTIMA: NUVIE: Fix copy-paste error in AStarPath
09e8ef68d9 ULTIMA: NUVIE: Fix pathfinding not detecting some doors
Commit: 6a24076501b8b8dc735d97558e12c17834a61e98
https://github.com/scummvm/scummvm/commit/6a24076501b8b8dc735d97558e12c17834a61e98
Author: PushmePullyu (127053144+PushmePullyu at users.noreply.github.com)
Date: 2024-08-05T09:07:13+10:00
Commit Message:
ULTIMA: NUVIE: Fix copy-paste error in AStarPath
Fix regression introduced in
4493bdcf5c08e040cb7f5afda029fb748d915cd4
"ULTIMA: NUVIE: Use foreach style loops for cleaner code"
Changed paths:
engines/ultima/nuvie/pathfinder/astar_path.cpp
diff --git a/engines/ultima/nuvie/pathfinder/astar_path.cpp b/engines/ultima/nuvie/pathfinder/astar_path.cpp
index a37a469d855..783cfdee06c 100644
--- a/engines/ultima/nuvie/pathfinder/astar_path.cpp
+++ b/engines/ultima/nuvie/pathfinder/astar_path.cpp
@@ -149,13 +149,13 @@ sint32 AStarPath::step_cost(const MapCoord &c1, const MapCoord &c2) {
/* Return an item in the list of closed nodes whose location matches `ncmp'.
*/
astar_node *AStarPath::find_closed_node(astar_node *ncmp) {
- for (astar_node *n : open_nodes)
+ for (astar_node *n : closed_nodes)
if (n->loc == ncmp->loc)
return n;
return nullptr;
}
-/* Return an item in the list of closed nodes whose location matches `ncmp'.
+/* Return an item in the list of open nodes whose location matches `ncmp'.
*/
astar_node *AStarPath::find_open_node(astar_node *ncmp) {
for (astar_node *n : open_nodes)
Commit: 09e8ef68d9c68ba54267e5e731cfb4cb6f5f3a52
https://github.com/scummvm/scummvm/commit/09e8ef68d9c68ba54267e5e731cfb4cb6f5f3a52
Author: PushmePullyu (127053144+PushmePullyu at users.noreply.github.com)
Date: 2024-08-05T09:07:13+10:00
Commit Message:
ULTIMA: NUVIE: Fix pathfinding not detecting some doors
U6 NPCs following their schedule can open doors in the way.
However, E/W facing doors would not be detected if an object was
directly S of them, causing pathing to fail in some cases.
Fix and simplify door detection.
Closes #15308
Changed paths:
engines/ultima/nuvie/pathfinder/u6_astar_path.cpp
diff --git a/engines/ultima/nuvie/pathfinder/u6_astar_path.cpp b/engines/ultima/nuvie/pathfinder/u6_astar_path.cpp
index aa170af5cbc..cdadeee1c45 100644
--- a/engines/ultima/nuvie/pathfinder/u6_astar_path.cpp
+++ b/engines/ultima/nuvie/pathfinder/u6_astar_path.cpp
@@ -41,14 +41,13 @@ sint32 U6AStarPath::step_cost(const MapCoord &c1, const MapCoord &c2) {
return -1;
if (!pf->check_loc(c2.x, c2.y, c2.z)) {
// check for door
- Obj *block = game->get_obj_manager()->get_obj(c2.x, c2.y, c2.z);
- // HACK: check the neighboring tiles for the "real" door
- Obj *real = game->get_obj_manager()->get_obj(c2.x + 1, c2.y, c2.z);
- if (!real || !game->get_usecode()->is_unlocked_door(real))
- real = game->get_obj_manager()->get_obj(c2.x, c2.y + 1, c2.z);
- if (!block || !game->get_usecode()->is_unlocked_door(block) || real)
+ // Door objects consist of a wall and the actual door tile.
+ // We use get_objBasedAt() here since we are only interested in the latter.
+ Obj *block = game->get_obj_manager()->get_objBasedAt(c2.x, c2.y, c2.z, true, false);
+ if (block && game->get_usecode()->is_unlocked_door(block))
+ c += 2; // cost for opening door
+ else
return -1;
- c += 2;
}
// add cost of *original* step
// c += game->get_game_map()->get_impedance(c1.x, c1.y, c1.z);
More information about the Scummvm-git-logs
mailing list