mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-16 03:23:15 +01:00
The track design was recognised as a Corkscrew RC, not as a Hypercoaster. Moved the conversion code from the track design repository to the TD6Importer (where it should have been, really). This also fixes the issue that Hypercoasters, Monster Trucks, Classic Mini Roller Coasters, Spinning Wild Mouses and Hyper-Twisters placed from a track design have the wrong ride type.
This commit is contained in:
committed by
GitHub
parent
0ae86d0558
commit
e5ec74feaf
@@ -21,14 +21,12 @@
|
||||
#include "../core/String.hpp"
|
||||
#include "../localisation/LocalisationService.h"
|
||||
#include "../object/ObjectRepository.h"
|
||||
#include "../object/RideObject.h"
|
||||
#include "../ride/RideData.h"
|
||||
#include "../util/Util.h"
|
||||
#include "TrackDesign.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
using namespace OpenRCT2;
|
||||
@@ -55,8 +53,6 @@ std::string GetNameFromTrackPath(const std::string& path)
|
||||
return name;
|
||||
}
|
||||
|
||||
static std::mutex _objectLookupMutex;
|
||||
|
||||
class TrackDesignFileIndex final : public FileIndex<TrackRepositoryItem>
|
||||
{
|
||||
private:
|
||||
@@ -82,27 +78,10 @@ public:
|
||||
auto td6 = track_design_open(path.c_str());
|
||||
if (td6 != nullptr)
|
||||
{
|
||||
ObjectEntryIndex rideType = td6->type;
|
||||
if (RCT2RideTypeNeedsConversion(td6->type))
|
||||
{
|
||||
std::scoped_lock<std::mutex> lock(_objectLookupMutex);
|
||||
auto* rawObject = object_repository_load_object(&td6->vehicle_object);
|
||||
if (rawObject != nullptr)
|
||||
{
|
||||
const auto* rideEntry = static_cast<const rct_ride_entry*>(
|
||||
static_cast<RideObject*>(rawObject)->GetLegacyData());
|
||||
if (rideEntry != nullptr)
|
||||
{
|
||||
rideType = RCT2RideTypeToOpenRCT2RideType(td6->type, rideEntry);
|
||||
}
|
||||
object_delete(rawObject);
|
||||
}
|
||||
}
|
||||
|
||||
TrackRepositoryItem item;
|
||||
item.Name = GetNameFromTrackPath(path);
|
||||
item.Path = path;
|
||||
item.RideType = rideType;
|
||||
item.RideType = td6->type;
|
||||
item.ObjectEntry = std::string(td6->vehicle_object.name, 8);
|
||||
item.Flags = 0;
|
||||
if (IsTrackReadOnly(path))
|
||||
|
||||
Reference in New Issue
Block a user