Fix crash when ScPark::generateGuest fails to generate a guest (#26681)

This commit is contained in:
mrmbernardi authored and GitHub committed 2026-06-16 20:24:53 +02:00
1 parent 321b715e21
commit a64f0eff6c
4 files changed
+7 -3

No files matched your search

+1
View File
@@ -5,6 +5,7 @@
- Change: [#26689] A clear scenario editor can now be opened directly from the command line.
- Fix: [#26494] The limits for where walls on the path side of the first tile block the view of rides/scenery are wrong (original bug).
- Fix: [#26504] The boosts/penalties to excitement and nausea that air time provides are calculated wrong.
- Fix: [#26545] Game crashes when plugin API function generateGuest fails to generate a guest.
0.5.2 (2026-06-07)
------------------------------------------------------------------------
+3 -2
View File
@@ -4282,10 +4282,11 @@ declare global {
readonly guestGenerationProbability: number;
/**
* Spawns a new guest at a random peep spawn point.
* Spawns a new guest at a random peep spawn point, or null if a guest could not
* spawn due to entity limits or no spawn points.
* Note: The "guest.generation" hook will be called before this function returns.
*/
generateGuest(): Guest;
generateGuest(): Guest | null;
/**
* The average amount of cash guests will spawn with.
+1 -1
View File
@@ -43,7 +43,7 @@ namespace OpenRCT2
namespace OpenRCT2::Scripting
{
// Grepped from CI (.github/workflows/publish-plugin-types.yml); keep the format `kPluginApiVersion = N`.
static constexpr int32_t kPluginApiVersion = 114;
static constexpr int32_t kPluginApiVersion = 115;
// Versions marking breaking changes.
static constexpr int32_t kApiVersionPeepDeprecation = 33;
@@ -161,6 +161,8 @@ namespace OpenRCT2::Scripting
{
JS_THROW_IF_GAME_STATE_NOT_MUTABLE();
auto guest = Park::GenerateGuest();
if (guest == nullptr)
return JS_NULL;
return ScGuest::New(ctx, guest->id);
}