mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-15 11:03:00 +01:00
@@ -7,6 +7,7 @@
|
||||
- Fix: [#9625] Show correct cost in scenery selection.
|
||||
- Fix: [#9669] The tile inspector shortcut key does not work with debugging tools disabled.
|
||||
- Fix: [#9717] Scroll bars do not render correctly when using OpenGL renderer.
|
||||
- Fix: [#9729] Peeps do not take into account height difference when deciding to pathfind to a ride entrance. (original bug)
|
||||
- Improved: [#9466] Add the rain weather effect to the OpenGL renderer.
|
||||
|
||||
0.2.3 (2019-07-10)
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
// This string specifies which version of network stream current build uses.
|
||||
// It is used for making sure only compatible builds get connected, even within
|
||||
// single OpenRCT2 version.
|
||||
#define NETWORK_STREAM_VERSION "3"
|
||||
#define NETWORK_STREAM_VERSION "4"
|
||||
#define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION
|
||||
|
||||
static Peep* _pickup_peep = nullptr;
|
||||
|
||||
@@ -505,6 +505,20 @@ static bool path_is_thin_junction(TileElement* path, TileCoordsXYZ loc)
|
||||
return thin_junction;
|
||||
}
|
||||
|
||||
static int32_t CalculateHeuristicPathingScore(TileCoordsXYZ loc1, TileCoordsXYZ loc2)
|
||||
{
|
||||
auto xDelta = abs(loc1.x - loc2.x) * 32;
|
||||
auto yDelta = abs(loc1.y - loc2.y) * 32;
|
||||
auto zDelta = abs(loc1.z - loc2.z) * 2;
|
||||
|
||||
if (xDelta < yDelta)
|
||||
xDelta >>= 4;
|
||||
else
|
||||
yDelta >>= 4;
|
||||
|
||||
return xDelta + yDelta + zDelta;
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches for the tile with the best heuristic score within the search limits
|
||||
* starting from the given tile x,y,z and going in the given direction test_edge.
|
||||
@@ -784,16 +798,7 @@ static void peep_pathfind_heuristic_search(
|
||||
* Ignore for now. */
|
||||
|
||||
// Calculate the heuristic score of this map element.
|
||||
uint16_t x_delta = abs(gPeepPathFindGoalPosition.x - loc.x) * 32;
|
||||
uint16_t y_delta = abs(gPeepPathFindGoalPosition.y - loc.y) * 32;
|
||||
if (x_delta < y_delta)
|
||||
x_delta >>= 4;
|
||||
else
|
||||
y_delta >>= 4;
|
||||
uint16_t new_score = x_delta + y_delta;
|
||||
uint16_t z_delta = abs(gPeepPathFindGoalPosition.z - loc.z);
|
||||
z_delta <<= 1;
|
||||
new_score += z_delta;
|
||||
uint16_t new_score = CalculateHeuristicPathingScore(loc, gPeepPathFindGoalPosition);
|
||||
|
||||
/* If this map element is the search goal the current search path ends here. */
|
||||
if (new_score == 0)
|
||||
@@ -2054,7 +2059,7 @@ int32_t guest_path_finding(Guest* peep)
|
||||
/* Find the ride's closest entrance station to the peep.
|
||||
* At the same time, count how many entrance stations there are and
|
||||
* which stations are entrance stations. */
|
||||
uint16_t closestDist = 0xFFFF;
|
||||
auto bestScore = std::numeric_limits<int32_t>::max();
|
||||
uint8_t closestStationNum = 0;
|
||||
|
||||
int32_t numEntranceStations = 0;
|
||||
@@ -2070,14 +2075,12 @@ int32_t guest_path_finding(Guest* peep)
|
||||
entranceStations |= (1 << stationNum);
|
||||
|
||||
TileCoordsXYZD entranceLocation = ride_get_entrance_location(ride, stationNum);
|
||||
|
||||
int16_t stationX = (int16_t)(entranceLocation.x * 32);
|
||||
int16_t stationY = (int16_t)(entranceLocation.y * 32);
|
||||
uint16_t dist = abs(stationX - peep->next_x) + abs(stationY - peep->next_y);
|
||||
|
||||
if (dist < closestDist)
|
||||
auto score = CalculateHeuristicPathingScore(
|
||||
{ entranceLocation.x, entranceLocation.y, entranceLocation.z },
|
||||
{ peep->next_x / 32, peep->next_y / 32, peep->next_z });
|
||||
if (score < bestScore)
|
||||
{
|
||||
closestDist = dist;
|
||||
bestScore = score;
|
||||
closestStationNum = stationNum;
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user