MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / Create

Method Create

src/openrct2/ride/TrackDesignRepository.cpp:75–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73
74public:
75 std::optional<TrackRepositoryItem> Create(int32_t, const std::string& path) const override
76 {
77 auto td = TrackDesignImport(path.c_str());
78 if (td != nullptr)
79 {
80 TrackRepositoryItem item{};
81 item.Name = GetNameFromTrackPath(path);
82 item.Path = path;
83 item.RideType = td->trackAndVehicle.rtdIndex;
84 item.ObjectEntry = std::string(td->trackAndVehicle.vehicleObject.Entry.name, 8);
85 if (IsTrackReadOnly(path))
86 {
87 item.flags.set(TrackRepoItemFlag::readOnly);
88 }
89 return item;
90 }
91
92 return std::nullopt;
93 }
94
95protected:
96 void Serialise(DataSerialiser& ds, const TrackRepositoryItem& item) const override

Callers 1

InstallMethod · 0.45

Calls 3

TrackDesignImportFunction · 0.85
GetNameFromTrackPathFunction · 0.85
setMethod · 0.65

Tested by

no test coverage detected