mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-27 08:45:00 +01:00
This commit is contained in:
@@ -866,32 +866,42 @@ bool Staff::IsMechanicHeadingToFixRideBlockingPath()
|
||||
*/
|
||||
void Staff::EntertainerUpdateNearbyPeeps() const
|
||||
{
|
||||
for (auto guest : EntityList<Guest>())
|
||||
// Iterate over tiles within a 3-tile radius (96 units)
|
||||
constexpr auto kTileRadius = 3;
|
||||
constexpr auto kLookupRadius = kCoordsXYStep * kTileRadius;
|
||||
|
||||
for (int32_t tileX = x - kLookupRadius; tileX <= x + kLookupRadius; tileX += kCoordsXYStep)
|
||||
{
|
||||
if (guest->x == kLocationNull)
|
||||
continue;
|
||||
|
||||
int16_t z_dist = abs(z - guest->z);
|
||||
if (z_dist > 48)
|
||||
continue;
|
||||
|
||||
int16_t x_dist = abs(x - guest->x);
|
||||
int16_t y_dist = abs(y - guest->y);
|
||||
|
||||
if (x_dist > 96)
|
||||
continue;
|
||||
|
||||
if (y_dist > 96)
|
||||
continue;
|
||||
|
||||
if (guest->State == PeepState::Walking)
|
||||
for (int32_t tileY = y - kLookupRadius; tileY <= y + kLookupRadius; tileY += kCoordsXYStep)
|
||||
{
|
||||
guest->HappinessTarget = std::min(guest->HappinessTarget + 4, kPeepMaxHappiness);
|
||||
}
|
||||
else if (guest->State == PeepState::Queuing)
|
||||
{
|
||||
guest->TimeInQueue = std::max(0, guest->TimeInQueue - 200);
|
||||
guest->HappinessTarget = std::min(guest->HappinessTarget + 3, kPeepMaxHappiness);
|
||||
for (auto* guest : EntityTileList<Guest>({ tileX, tileY }))
|
||||
{
|
||||
if (guest->x == kLocationNull)
|
||||
continue;
|
||||
|
||||
int16_t z_dist = std::abs(z - guest->z);
|
||||
if (z_dist > 48)
|
||||
continue;
|
||||
|
||||
int16_t x_dist = std::abs(x - guest->x);
|
||||
int16_t y_dist = std::abs(y - guest->y);
|
||||
|
||||
if (x_dist > kLookupRadius)
|
||||
continue;
|
||||
|
||||
if (y_dist > kLookupRadius)
|
||||
continue;
|
||||
|
||||
if (guest->State == PeepState::Walking)
|
||||
{
|
||||
guest->HappinessTarget = std::min(guest->HappinessTarget + 4, kPeepMaxHappiness);
|
||||
}
|
||||
else if (guest->State == PeepState::Queuing)
|
||||
{
|
||||
guest->TimeInQueue = std::max(0, guest->TimeInQueue - 200);
|
||||
guest->HappinessTarget = std::min(guest->HappinessTarget + 3, kPeepMaxHappiness);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user