forked from rosebudai/OpenRCT2-Web
Handle mixed install object loading more gracefully
This commit is contained in:
1 parent
7e7947fe8b
commit
2916daa29d
3 files changed
+18
-44
No files matched your search
@@ -27,6 +27,7 @@
|
||||
#include "../localisation/Localisation.h"
|
||||
#include "../localisation/LocalisationService.h"
|
||||
#include "../object/Object.h"
|
||||
#include "../park/Legacy.h"
|
||||
#include "../platform/platform.h"
|
||||
#include "../rct12/SawyerChunkReader.h"
|
||||
#include "../rct12/SawyerChunkWriter.h"
|
||||
@@ -420,6 +421,12 @@ private:
|
||||
|
||||
bool AddItem(const ObjectRepositoryItem& item)
|
||||
{
|
||||
const auto newIdent = MapToNewObjectIdentifier(item.Identifier);
|
||||
if (!newIdent.empty())
|
||||
{
|
||||
Console::Error::WriteLine("Mixed install detected. Not loading: '%s'", item.Identifier.c_str());
|
||||
return false;
|
||||
}
|
||||
const ObjectRepositoryItem* conflict{};
|
||||
if (item.ObjectEntry.name[0] != '\0')
|
||||
{
|
||||
|
||||
@@ -30,8 +30,6 @@ static std::map<std::string_view, std::string_view> oldObjectIds = {
|
||||
{ "openrct2.railings.invisible", "openrct2.footpath_railings.invisible" },
|
||||
{ "official.zpanda", "rct2dlc.ride.zpanda" },
|
||||
{ "openrct2.surface.void", "openrct2.terrain_surface.void" },
|
||||
{ "openrct2.station.noentrance", "openrct2.station.noentrance" },
|
||||
{ "openrct2.station.noplatformnoentrance", "openrct2.station.noplatformnoentrance" },
|
||||
{ "rct2.sct", "rct2.scenery_large.sct" },
|
||||
{ "rct2.soh3", "rct2.scenery_large.soh3" },
|
||||
{ "rct2.scln", "rct2.scenery_large.scln" },
|
||||
@@ -109,38 +107,7 @@ static std::map<std::string_view, std::string_view> oldObjectIds = {
|
||||
{ "rct2.scgindus", "rct2.scenery_group.scgindus" },
|
||||
{ "rct2.scgjungl", "rct2.scenery_group.scgjungl" },
|
||||
{ "rct2.scgmedie", "rct2.scenery_group.scgmedie" },
|
||||
{ "rct2.music.rock1", "rct2.music.rock1" },
|
||||
{ "rct2.music.toyland", "rct2.music.toyland" },
|
||||
{ "rct2.music.fantasy", "rct2.music.fantasy" },
|
||||
{ "rct2.music.custom2", "rct2.music.custom2" },
|
||||
{ "rct2.music.candy", "rct2.music.candy" },
|
||||
{ "rct2.music.egyptian", "rct2.music.egyptian" },
|
||||
{ "rct2.music.pirate", "rct2.music.pirate" },
|
||||
{ "rct2.music.ice", "rct2.music.ice" },
|
||||
{ "rct2.music.techno", "rct2.music.techno" },
|
||||
{ "rct2.music.jurassic", "rct2.music.jurassic" },
|
||||
{ "rct2.music.medieval", "rct2.music.medieval" },
|
||||
{ "rct2.music.rock2", "rct2.music.rock2" },
|
||||
{ "rct2.music.modern", "rct2.music.modern" },
|
||||
{ "rct2.music.ragtime", "rct2.music.ragtime" },
|
||||
{ "rct2.music.fairground", "rct2.music.fairground" },
|
||||
{ "rct2.music.jungle", "rct2.music.jungle" },
|
||||
{ "rct2.music.dodgems", "rct2.music.dodgems" },
|
||||
{ "rct2.music.gentle", "rct2.music.gentle" },
|
||||
{ "rct2.music.summer", "rct2.music.summer" },
|
||||
{ "rct2.music.oriental", "rct2.music.oriental" },
|
||||
{ "rct2.music.wildwest", "rct2.music.wildwest" },
|
||||
{ "rct2.music.space", "rct2.music.space" },
|
||||
{ "rct2.music.horror", "rct2.music.horror" },
|
||||
{ "rct2.music.custom1", "rct2.music.custom1" },
|
||||
{ "rct2.music.snow", "rct2.music.snow" },
|
||||
{ "rct2.music.rock3", "rct2.music.rock3" },
|
||||
{ "rct2.music.organ", "rct2.music.organ" },
|
||||
{ "rct2.music.mechanical", "rct2.music.mechanical" },
|
||||
{ "rct2.music", "rct2.music.water" },
|
||||
{ "rct2.music.urban", "rct2.music.urban" },
|
||||
{ "rct2.music.martian", "rct2.music.martian" },
|
||||
{ "rct2.music.roman", "rct2.music.roman" },
|
||||
{ "rct2.bn1", "rct2.footpath_banner.bn1" },
|
||||
{ "rct2.bn3", "rct2.footpath_banner.bn3" },
|
||||
{ "rct2.bn7", "rct2.footpath_banner.bn7" },
|
||||
@@ -822,17 +789,8 @@ static std::map<std::string_view, std::string_view> oldObjectIds = {
|
||||
{ "rct2.surface.chequerboard", "rct2.terrain_surface.chequerboard" },
|
||||
{ "rct2.surface.gridpurple", "rct2.terrain_surface.grid_purple" },
|
||||
{ "rct2.station.castlegrey", "rct2.station.castle_grey" },
|
||||
{ "rct2.station.space", "rct2.station.space" },
|
||||
{ "rct2.station.plain", "rct2.station.plain" },
|
||||
{ "rct2.station.log", "rct2.station.log" },
|
||||
{ "rct2.station.jungle", "rct2.station.jungle" },
|
||||
{ "rct2.station.snow", "rct2.station.snow" },
|
||||
{ "rct2.station.castlebrown", "rct2.station.castle_brown" },
|
||||
{ "rct2.station.abstract", "rct2.station.abstract" },
|
||||
{ "rct2.station.pagoda", "rct2.station.pagoda" },
|
||||
{ "rct2.station.classical", "rct2.station.classical" },
|
||||
{ "rct2.station.canvastent", "rct2.station.canvas_tent" },
|
||||
{ "rct2.station.wooden", "rct2.station.wooden" },
|
||||
{ "rct2.edge.rock", "rct2.terrain_edge.rock" },
|
||||
{ "rct2.edge.woodred", "rct2.terrain_edge.wood_red" },
|
||||
{ "rct2.edge.ice", "rct2.terrain_edge.ice" },
|
||||
@@ -2219,7 +2177,7 @@ std::string_view MapToNewObjectIdentifier(std::string_view s)
|
||||
{
|
||||
return it->second;
|
||||
}
|
||||
return s;
|
||||
return "";
|
||||
}
|
||||
|
||||
static std::map<std::string_view, std::string_view> DATPathNames = {
|
||||
|
||||
@@ -299,7 +299,16 @@ namespace OpenRCT2
|
||||
{
|
||||
ObjectEntryDescriptor desc;
|
||||
desc.Type = objectType;
|
||||
desc.Identifier = MapToNewObjectIdentifier(cs.Read<std::string>());
|
||||
auto identifier = cs.Read<std::string>();
|
||||
if (version <= 2)
|
||||
{
|
||||
auto newIdentifier = MapToNewObjectIdentifier(identifier);
|
||||
if (!newIdentifier.empty())
|
||||
{
|
||||
identifier = newIdentifier;
|
||||
}
|
||||
}
|
||||
desc.Identifier = identifier;
|
||||
desc.Version = cs.Read<std::string>();
|
||||
|
||||
if (version <= 2)
|
||||
|
||||
Reference in new issue
Block a user