From b78a744b8e15387417e391fbbdffd031c71ebb09 Mon Sep 17 00:00:00 2001 From: Michael Steenbeek Date: Tue, 6 Feb 2018 10:05:48 +0100 Subject: [PATCH] Create footpath_get_edges() --- src/openrct2/peep/Peep.cpp | 4 ++-- src/openrct2/world/Footpath.cpp | 5 +++++ src/openrct2/world/Footpath.h | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index 0f504abc78..4a69b03d5a 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -9856,7 +9856,7 @@ static uint8 peep_pathfind_get_max_number_junctions(rct_peep * peep) */ static bool path_is_thin_junction(rct_tile_element * path, sint16 x, sint16 y, uint8 z) { - uint8 edges = path->properties.path.edges & 0xF; + uint8 edges = footpath_get_edges(path); sint32 test_edge = bitscanforward(edges); if (test_edge == -1) @@ -10119,7 +10119,7 @@ static void peep_pathfind_heuristic_search(sint16 x, sint16 y, uint8 z, rct_peep searchResult = PATH_SEARCH_THIN; - uint8 numEdges = bitcount(tileElement->properties.path.edges & 0x0F); + uint8 numEdges = bitcount(footpath_get_edges(tileElement)); if (numEdges < 2) { diff --git a/src/openrct2/world/Footpath.cpp b/src/openrct2/world/Footpath.cpp index 59847463aa..8fbb13acf1 100644 --- a/src/openrct2/world/Footpath.cpp +++ b/src/openrct2/world/Footpath.cpp @@ -2273,3 +2273,8 @@ rct_footpath_entry *get_footpath_entry(sint32 entryIndex) { return gFootpathEntries[entryIndex]; } + +uint8 footpath_get_edges(const rct_tile_element * element) +{ + return element->properties.path.edges & 0xF; +} diff --git a/src/openrct2/world/Footpath.h b/src/openrct2/world/Footpath.h index 7e2609865c..c86d0524dd 100644 --- a/src/openrct2/world/Footpath.h +++ b/src/openrct2/world/Footpath.h @@ -171,4 +171,6 @@ rct_footpath_entry * get_footpath_entry(sint32 entryIndex); void footpath_queue_chain_reset(); void footpath_queue_chain_push(uint8 rideIndex); +uint8 footpath_get_edges(const rct_tile_element * element); + #endif