1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-23 15:52:55 +01:00

Use memset() to initialise _peepPathFindHistory.

This commit is contained in:
zaxcav
2016-08-21 11:50:37 +02:00
parent b1da59d25a
commit c3dee036a7

View File

@@ -8533,18 +8533,15 @@ int peep_pathfind_choose_direction(sint16 x, sint16 y, uint8 z, rct_peep *peep)
_peepPathFindQueueRideIndex = false;
_peepPathFindNumJunctions = maxNumJunctions;
/* Initialise _peepPathFindHistory.
* The pathfinding will only use elements
// Initialise _peepPathFindHistory.
memset(_peepPathFindHistory, 0xFF, sizeof(_peepPathFindHistory));
/* The pathfinding will only use elements
* 1..maxNumJunctions, so the starting point is
* placed in element 0 */
_peepPathFindHistory[0].x = (uint8)(x >> 5);
_peepPathFindHistory[0].y = (uint8)(y >> 5);
_peepPathFindHistory[0].z = (uint8)z;
for (int junctionIndex = 1; junctionIndex < 16; junctionIndex++) {
_peepPathFindHistory[junctionIndex].x = 0xFF;
_peepPathFindHistory[junctionIndex].y = 0xFF;
_peepPathFindHistory[junctionIndex].z = 0xFF;
}
uint16 score = peep_pathfind_heuristic_search(x, y, height, 0, 0xFFFF, test_edge);
#if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1