diff --git a/distribution/changelog.txt b/distribution/changelog.txt
index bf0bb67fb1..3779404d92 100644
--- a/distribution/changelog.txt
+++ b/distribution/changelog.txt
@@ -23,6 +23,7 @@
- Fix: [#23960] Corner path fences can draw over adjacent sloped land (original bug).
- Fix: [#23961] Lamps and queue line tvs draw incorrectly on paths with fences.
- Fix: [#23983] Ordering files by size does not work and occasionally crashes the game.
+- Fix: [#24009] [Plugin] The object manager API does not identify recently introduced object types.
0.4.20 (2025-02-25)
------------------------------------------------------------------------
diff --git a/distribution/openrct2.d.ts b/distribution/openrct2.d.ts
index e9e4241336..e20c702ef0 100644
--- a/distribution/openrct2.d.ts
+++ b/distribution/openrct2.d.ts
@@ -620,12 +620,17 @@ declare global {
"scenery_group" |
"park_entrance" |
"water" |
+ "scenario_text" |
"terrain_surface" |
"terrain_edge" |
"station" |
"music" |
"footpath_surface" |
- "footpath_railings";
+ "footpath_railings" |
+ "audio" |
+ "peep_names" |
+ "peep_animations" |
+ "climate";
type HookType =
"action.execute" |
@@ -5362,7 +5367,6 @@ declare global {
getObject(type: "footpath_addition", index: number): FootpathAdditionObject;
getObject(type: "banner", index: number): BannerObject;
getObject(type: "scenery_group", index: number): SceneryGroupObject;
- getObject(type: "music", index: number): LoadedObject;
/**
* Gets all the currently loaded objects for a given object type.
@@ -5376,7 +5380,6 @@ declare global {
getAllObjects(type: "footpath_addition"): FootpathAdditionObject[];
getAllObjects(type: "banner"): BannerObject[];
getAllObjects(type: "scenery_group"): SceneryGroupObject[];
- getAllObjects(type: "music"): LoadedObject[];
}
/**
diff --git a/src/openrct2/libopenrct2.vcxproj b/src/openrct2/libopenrct2.vcxproj
index 0cc1a5d7a6..ca356e22bb 100644
--- a/src/openrct2/libopenrct2.vcxproj
+++ b/src/openrct2/libopenrct2.vcxproj
@@ -560,45 +560,45 @@
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1095,6 +1095,7 @@
+
@@ -1152,4 +1153,4 @@
-
\ No newline at end of file
+
diff --git a/src/openrct2/object/ObjectFactory.cpp b/src/openrct2/object/ObjectFactory.cpp
index 627c3e901e..46f9b10e2b 100644
--- a/src/openrct2/object/ObjectFactory.cpp
+++ b/src/openrct2/object/ObjectFactory.cpp
@@ -15,6 +15,7 @@
#include "../PlatformEnvironment.h"
#include "../audio/Audio.h"
#include "../core/Console.hpp"
+#include "../core/EnumMap.hpp"
#include "../core/File.h"
#include "../core/FileStream.h"
#include "../core/Json.hpp"
@@ -404,50 +405,29 @@ namespace OpenRCT2::ObjectFactory
return result;
}
- static ObjectType ParseObjectType(const std::string& s)
- {
- if (s == "ride")
- return ObjectType::ride;
- if (s == "footpath_banner")
- return ObjectType::banners;
- if (s == "footpath_item")
- return ObjectType::pathAdditions;
- if (s == "scenery_small")
- return ObjectType::smallScenery;
- if (s == "scenery_large")
- return ObjectType::largeScenery;
- if (s == "scenery_wall")
- return ObjectType::walls;
- if (s == "scenery_group")
- return ObjectType::sceneryGroup;
- if (s == "park_entrance")
- return ObjectType::parkEntrance;
- if (s == "water")
- return ObjectType::water;
- if (s == "scenario_text")
- return ObjectType::scenarioText;
- if (s == "terrain_surface")
- return ObjectType::terrainSurface;
- if (s == "terrain_edge")
- return ObjectType::terrainEdge;
- if (s == "station")
- return ObjectType::station;
- if (s == "music")
- return ObjectType::music;
- if (s == "footpath_surface")
- return ObjectType::footpathSurface;
- if (s == "footpath_railings")
- return ObjectType::footpathRailings;
- if (s == "audio")
- return ObjectType::audio;
- if (s == "peep_names")
- return ObjectType::peepNames;
- if (s == "peep_animations")
- return ObjectType::peepAnimations;
- if (s == "climate")
- return ObjectType::climate;
- return ObjectType::none;
- }
+ static const EnumMap kObjectTypeMap = {
+ { "ride", ObjectType::ride },
+ { "scenery_small", ObjectType::smallScenery },
+ { "scenery_large", ObjectType::largeScenery },
+ { "scenery_wall", ObjectType::walls },
+ { "footpath_banner", ObjectType::banners },
+ { "footpath_legacy", ObjectType::paths },
+ { "footpath_item", ObjectType::pathAdditions },
+ { "scenery_group", ObjectType::sceneryGroup },
+ { "park_entrance", ObjectType::parkEntrance },
+ { "water", ObjectType::water },
+ { "scenario_text", ObjectType::scenarioText },
+ { "terrain_surface", ObjectType::terrainSurface },
+ { "terrain_edge", ObjectType::terrainEdge },
+ { "station", ObjectType::station },
+ { "music", ObjectType::music },
+ { "footpath_surface", ObjectType::footpathSurface },
+ { "footpath_railings", ObjectType::footpathRailings },
+ { "audio", ObjectType::audio },
+ { "peep_names", ObjectType::peepNames },
+ { "peep_animations", ObjectType::peepAnimations },
+ { "climate", ObjectType::climate },
+ };
std::unique_ptr