mirror of
https://github.com/HarbourMasters/SpaghettiKart
synced 2026-07-07 14:13:58 -04:00
correct use of pointer and fix mistake (#394)
* correct use of pointer and fix mistake * remove CM_WeirdLength * Update Game.cpp * Update Game.cpp --------- Co-authored-by: MegaMech <MegaMech@users.noreply.github.com>
This commit is contained in:
+2
-2
@@ -1,7 +1,7 @@
|
||||
#include "Cup.h"
|
||||
#include "courses/Course.h"
|
||||
|
||||
Cup::Cup(std::string id, const char* name, std::vector<Course*> courses) {
|
||||
Cup::Cup(std::string id, const char* name, std::vector<std::shared_ptr<Course>> courses) {
|
||||
Id = id;
|
||||
Name = name;
|
||||
Courses = courses;
|
||||
@@ -30,7 +30,7 @@ void Cup::SetCourse(size_t position) {
|
||||
CursorPosition = position;
|
||||
}
|
||||
|
||||
Course* Cup::GetCourse() {
|
||||
std::shared_ptr<Course> Cup::GetCourse() {
|
||||
return Courses[CursorPosition];
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -13,15 +13,15 @@ public:
|
||||
const char* Name;
|
||||
u8 *Thumbnail;
|
||||
size_t CursorPosition = 0; // Course index in cup
|
||||
std::vector<Course*> Courses;
|
||||
std::vector<std::shared_ptr<Course>> Courses;
|
||||
|
||||
explicit Cup(std::string id, const char* name, std::vector<Course*> courses);
|
||||
explicit Cup(std::string id, const char* name, std::vector<std::shared_ptr<Course>> courses);
|
||||
|
||||
virtual void ShuffleCourses();
|
||||
|
||||
virtual void Next();
|
||||
virtual void Previous();
|
||||
virtual void SetCourse(size_t position);
|
||||
virtual Course* GetCourse();
|
||||
virtual std::shared_ptr<Course> GetCourse();
|
||||
virtual size_t GetSize();
|
||||
};
|
||||
@@ -18,7 +18,7 @@ void ModelLoader::Load() {
|
||||
_hasRan = true;
|
||||
|
||||
// Set to track processed courses
|
||||
std::unordered_set<Course*> processedCourses;
|
||||
std::unordered_set<std::shared_ptr<Course>> processedCourses;
|
||||
|
||||
for (auto& list : _deferredList) {
|
||||
// Check if the course has already been processed
|
||||
@@ -34,8 +34,8 @@ void ModelLoader::Load() {
|
||||
}
|
||||
}
|
||||
|
||||
void ModelLoader::Extract(Course* course) {
|
||||
Course* saveCourse = gWorldInstance.CurrentCourse;
|
||||
void ModelLoader::Extract(std::shared_ptr<Course> course) {
|
||||
std::shared_ptr<Course> saveCourse = gWorldInstance.CurrentCourse;
|
||||
gWorldInstance.CurrentCourse = course; // Quick hack so that `get_texture` will find the right textures.
|
||||
|
||||
size_t vtxSize = (ResourceGetSizeByName(course->vtx) / sizeof(CourseVtx)) * sizeof(Vtx);
|
||||
|
||||
@@ -37,7 +37,7 @@ class ModelLoader {
|
||||
|
||||
public:
|
||||
struct LoadModelList {
|
||||
Course* course;
|
||||
std::shared_ptr<Course> course;
|
||||
|
||||
Gfx* gfxBuffer; // buffer for output gfx
|
||||
size_t gfxBufferSize;
|
||||
@@ -55,7 +55,7 @@ private:
|
||||
|
||||
};
|
||||
|
||||
void Extract(Course* course);
|
||||
void Extract(std::shared_ptr<Course> course);
|
||||
void UpdateVtx(LoadModelList list);
|
||||
|
||||
std::vector<LoadModelList> _deferredList;
|
||||
|
||||
@@ -26,13 +26,12 @@ World::~World() {
|
||||
CM_CleanWorld();
|
||||
}
|
||||
|
||||
Course* CurrentCourse;
|
||||
std::shared_ptr<Course> CurrentCourse;
|
||||
Cup* CurrentCup;
|
||||
|
||||
Course* World::AddCourse(std::unique_ptr<Course> course) {
|
||||
Course* ptr = course.get();
|
||||
gWorldInstance.Courses.push_back(std::move(course));
|
||||
return ptr;
|
||||
std::shared_ptr<Course> World::AddCourse(std::shared_ptr<Course> course) {
|
||||
gWorldInstance.Courses.push_back(course);
|
||||
return course;
|
||||
}
|
||||
|
||||
void World::AddCup(Cup* cup) {
|
||||
@@ -99,7 +98,7 @@ void World::SetCourse(const char* name) {
|
||||
//! @todo Use content dictionary instead
|
||||
for (size_t i = 0; i < Courses.size(); i++) {
|
||||
if (strcmp(Courses[i]->Props.Name, name) == 0) {
|
||||
CurrentCourse = Courses[i].get();
|
||||
CurrentCourse = Courses[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -112,7 +111,7 @@ void World::NextCourse() {
|
||||
} else {
|
||||
CourseIndex = 0;
|
||||
}
|
||||
gWorldInstance.CurrentCourse = Courses[CourseIndex].get();
|
||||
gWorldInstance.CurrentCourse = Courses[CourseIndex];
|
||||
}
|
||||
|
||||
void World::PreviousCourse() {
|
||||
@@ -121,7 +120,7 @@ void World::PreviousCourse() {
|
||||
} else {
|
||||
CourseIndex = Courses.size() - 1;
|
||||
}
|
||||
gWorldInstance.CurrentCourse = Courses[CourseIndex].get();
|
||||
gWorldInstance.CurrentCourse = Courses[CourseIndex];
|
||||
}
|
||||
|
||||
AActor* World::AddActor(AActor* actor) {
|
||||
|
||||
+4
-4
@@ -54,7 +54,7 @@ public:
|
||||
explicit World();
|
||||
~World();
|
||||
|
||||
Course* AddCourse(std::unique_ptr<Course> course);
|
||||
std::shared_ptr<Course> AddCourse(std::shared_ptr<Course> course);
|
||||
|
||||
AActor* AddActor(AActor* actor);
|
||||
struct Actor* AddBaseActor();
|
||||
@@ -100,7 +100,7 @@ public:
|
||||
void SetCourseByType() {
|
||||
for (const auto& course : Courses) {
|
||||
if (dynamic_cast<T*>(course.get())) {
|
||||
CurrentCourse = course.get();
|
||||
CurrentCourse = course;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -112,7 +112,7 @@ public:
|
||||
Matrix Mtx;
|
||||
|
||||
|
||||
Course* CurrentCourse;
|
||||
std::shared_ptr<Course> CurrentCourse;
|
||||
Cup* CurrentCup;
|
||||
|
||||
std::vector<Cup*> Cups;
|
||||
@@ -132,7 +132,7 @@ public:
|
||||
std::vector<std::shared_ptr<TrainCrossing>> Crossings;
|
||||
|
||||
// Holds all available courses
|
||||
std::vector<std::unique_ptr<Course>> Courses;
|
||||
std::vector<std::shared_ptr<Course>> Courses;
|
||||
size_t CourseIndex = 0; // For browsing courses.
|
||||
private:
|
||||
|
||||
|
||||
+49
-49
@@ -73,7 +73,7 @@ extern "C" void Timer_Update();
|
||||
// Create the world instance
|
||||
World gWorldInstance;
|
||||
|
||||
std::unique_ptr<PodiumCeremony> gPodiumCeremony;
|
||||
std::shared_ptr<PodiumCeremony> gPodiumCeremony;
|
||||
|
||||
Cup* gMushroomCup;
|
||||
Cup* gFlowerCup;
|
||||
@@ -91,28 +91,28 @@ s32 gTrophyIndex = NULL;
|
||||
|
||||
void CustomEngineInit() {
|
||||
/* Add all courses to the global course list */
|
||||
Course* mario = gWorldInstance.AddCourse(std::make_unique<MarioRaceway>());
|
||||
Course* choco = gWorldInstance.AddCourse(std::make_unique<ChocoMountain>());
|
||||
Course* bowser = gWorldInstance.AddCourse(std::make_unique<BowsersCastle>());
|
||||
Course* banshee = gWorldInstance.AddCourse(std::make_unique<BansheeBoardwalk>());
|
||||
Course* yoshi = gWorldInstance.AddCourse(std::make_unique<YoshiValley>());
|
||||
Course* frappe = gWorldInstance.AddCourse(std::make_unique<FrappeSnowland>());
|
||||
Course* koopa = gWorldInstance.AddCourse(std::make_unique<KoopaTroopaBeach>());
|
||||
Course* royal = gWorldInstance.AddCourse(std::make_unique<RoyalRaceway>());
|
||||
Course* luigi = gWorldInstance.AddCourse(std::make_unique<LuigiRaceway>());
|
||||
Course* mooMoo = gWorldInstance.AddCourse(std::make_unique<MooMooFarm>());
|
||||
Course* toads = gWorldInstance.AddCourse(std::make_unique<ToadsTurnpike>());
|
||||
Course* kalimari = gWorldInstance.AddCourse(std::make_unique<KalimariDesert>());
|
||||
Course* sherbet = gWorldInstance.AddCourse(std::make_unique<SherbetLand>());
|
||||
Course* rainbow = gWorldInstance.AddCourse(std::make_unique<RainbowRoad>());
|
||||
Course* wario = gWorldInstance.AddCourse(std::make_unique<WarioStadium>());
|
||||
Course* block = gWorldInstance.AddCourse(std::make_unique<BlockFort>());
|
||||
Course* skyscraper = gWorldInstance.AddCourse(std::make_unique<Skyscraper>());
|
||||
Course* doubleDeck = gWorldInstance.AddCourse(std::make_unique<DoubleDeck>());
|
||||
Course* dkJungle = gWorldInstance.AddCourse(std::make_unique<DKJungle>());
|
||||
Course* bigDonut = gWorldInstance.AddCourse(std::make_unique<BigDonut>());
|
||||
// Course* harbour = gWorldInstance.AddCourse(std::make_unique<Harbour>());
|
||||
Course* testCourse = gWorldInstance.AddCourse(std::make_unique<TestCourse>());
|
||||
std::shared_ptr<Course> mario = gWorldInstance.AddCourse(std::make_shared<MarioRaceway>());
|
||||
std::shared_ptr<Course> choco = gWorldInstance.AddCourse(std::make_shared<ChocoMountain>());
|
||||
std::shared_ptr<Course> bowser = gWorldInstance.AddCourse(std::make_shared<BowsersCastle>());
|
||||
std::shared_ptr<Course> banshee = gWorldInstance.AddCourse(std::make_shared<BansheeBoardwalk>());
|
||||
std::shared_ptr<Course> yoshi = gWorldInstance.AddCourse(std::make_shared<YoshiValley>());
|
||||
std::shared_ptr<Course> frappe = gWorldInstance.AddCourse(std::make_shared<FrappeSnowland>());
|
||||
std::shared_ptr<Course> koopa = gWorldInstance.AddCourse(std::make_shared<KoopaTroopaBeach>());
|
||||
std::shared_ptr<Course> royal = gWorldInstance.AddCourse(std::make_shared<RoyalRaceway>());
|
||||
std::shared_ptr<Course> luigi = gWorldInstance.AddCourse(std::make_shared<LuigiRaceway>());
|
||||
std::shared_ptr<Course> mooMoo = gWorldInstance.AddCourse(std::make_shared<MooMooFarm>());
|
||||
std::shared_ptr<Course> toads = gWorldInstance.AddCourse(std::make_shared<ToadsTurnpike>());
|
||||
std::shared_ptr<Course> kalimari = gWorldInstance.AddCourse(std::make_shared<KalimariDesert>());
|
||||
std::shared_ptr<Course> sherbet = gWorldInstance.AddCourse(std::make_shared<SherbetLand>());
|
||||
std::shared_ptr<Course> rainbow = gWorldInstance.AddCourse(std::make_shared<RainbowRoad>());
|
||||
std::shared_ptr<Course> wario = gWorldInstance.AddCourse(std::make_shared<WarioStadium>());
|
||||
std::shared_ptr<Course> block = gWorldInstance.AddCourse(std::make_shared<BlockFort>());
|
||||
std::shared_ptr<Course> skyscraper = gWorldInstance.AddCourse(std::make_shared<Skyscraper>());
|
||||
std::shared_ptr<Course> doubleDeck = gWorldInstance.AddCourse(std::make_shared<DoubleDeck>());
|
||||
std::shared_ptr<Course> dkJungle = gWorldInstance.AddCourse(std::make_shared<DKJungle>());
|
||||
std::shared_ptr<Course> bigDonut = gWorldInstance.AddCourse(std::make_shared<BigDonut>());
|
||||
// std::shared_ptr<Course> harbour = gWorldInstance.AddCourse(std::make_shared<Harbour>());
|
||||
std::shared_ptr<Course> testCourse = gWorldInstance.AddCourse(std::make_shared<TestCourse>());
|
||||
|
||||
gPodiumCeremony = std::make_unique<PodiumCeremony>();
|
||||
|
||||
@@ -257,7 +257,7 @@ void SetCourseById(s32 course) {
|
||||
return;
|
||||
}
|
||||
gWorldInstance.CourseIndex = course;
|
||||
gWorldInstance.CurrentCourse = gWorldInstance.Courses[gWorldInstance.CourseIndex].get();
|
||||
gWorldInstance.CurrentCourse = gWorldInstance.Courses[gWorldInstance.CourseIndex];
|
||||
}
|
||||
|
||||
void CM_VehicleCollision(s32 playerId, Player* player) {
|
||||
@@ -372,7 +372,7 @@ void CM_DrawStaticMeshActors() {
|
||||
}
|
||||
|
||||
void CM_BeginPlay() {
|
||||
Course* course = gWorldInstance.CurrentCourse;
|
||||
auto course = gWorldInstance.CurrentCourse;
|
||||
|
||||
if (course) {
|
||||
// Do not spawn finishline in credits or battle mode. And if bSpawnFinishline.
|
||||
@@ -603,7 +603,7 @@ void SetCourseFromCup() {
|
||||
}
|
||||
|
||||
void* GetCourse(void) {
|
||||
return gWorldInstance.CurrentCourse;
|
||||
return gWorldInstance.CurrentCourse.get();
|
||||
}
|
||||
|
||||
struct Actor* CM_GetActor(size_t index) {
|
||||
@@ -658,7 +658,7 @@ void CM_CleanWorld(void) {
|
||||
delete actor;
|
||||
}
|
||||
|
||||
for (int i = 0; i < NUM_PLAYERS; i++) {
|
||||
for (int i = 0; i < ARRAY_COUNT(gWorldInstance.playerBombKart); i++) {
|
||||
gWorldInstance.playerBombKart[i].state = PlayerBombKart::PlayerBombKartState::DISABLED;
|
||||
gWorldInstance.playerBombKart[i]._primAlpha = 0;
|
||||
}
|
||||
@@ -708,27 +708,27 @@ f32 CM_GetWaterLevel(Vec3f pos, Collision* collision) {
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
bool IsMarioRaceway() { return dynamic_cast<MarioRaceway*>(gWorldInstance.CurrentCourse) != nullptr; }
|
||||
bool IsLuigiRaceway() { return dynamic_cast<LuigiRaceway*>(gWorldInstance.CurrentCourse) != nullptr; }
|
||||
bool IsChocoMountain() { return dynamic_cast<ChocoMountain*>(gWorldInstance.CurrentCourse) != nullptr; }
|
||||
bool IsBowsersCastle() { return dynamic_cast<BowsersCastle*>(gWorldInstance.CurrentCourse) != nullptr; }
|
||||
bool IsBansheeBoardwalk() { return dynamic_cast<BansheeBoardwalk*>(gWorldInstance.CurrentCourse) != nullptr; }
|
||||
bool IsYoshiValley() { return dynamic_cast<YoshiValley*>(gWorldInstance.CurrentCourse) != nullptr; }
|
||||
bool IsFrappeSnowland() { return dynamic_cast<FrappeSnowland*>(gWorldInstance.CurrentCourse) != nullptr; }
|
||||
bool IsKoopaTroopaBeach() { return dynamic_cast<KoopaTroopaBeach*>(gWorldInstance.CurrentCourse) != nullptr; }
|
||||
bool IsRoyalRaceway() { return dynamic_cast<RoyalRaceway*>(gWorldInstance.CurrentCourse) != nullptr; }
|
||||
bool IsMooMooFarm() { return dynamic_cast<MooMooFarm*>(gWorldInstance.CurrentCourse) != nullptr; }
|
||||
bool IsToadsTurnpike() { return dynamic_cast<ToadsTurnpike*>(gWorldInstance.CurrentCourse) != nullptr; }
|
||||
bool IsKalimariDesert() { return dynamic_cast<KalimariDesert*>(gWorldInstance.CurrentCourse) != nullptr; }
|
||||
bool IsSherbetLand() { return dynamic_cast<SherbetLand*>(gWorldInstance.CurrentCourse) != nullptr; }
|
||||
bool IsRainbowRoad() { return dynamic_cast<RainbowRoad*>(gWorldInstance.CurrentCourse) != nullptr; }
|
||||
bool IsWarioStadium() { return dynamic_cast<WarioStadium*>(gWorldInstance.CurrentCourse) != nullptr; }
|
||||
bool IsBlockFort() { return dynamic_cast<BlockFort*>(gWorldInstance.CurrentCourse) != nullptr; }
|
||||
bool IsSkyscraper() { return dynamic_cast<Skyscraper*>(gWorldInstance.CurrentCourse) != nullptr; }
|
||||
bool IsDoubleDeck() { return dynamic_cast<DoubleDeck*>(gWorldInstance.CurrentCourse) != nullptr; }
|
||||
bool IsDkJungle() { return dynamic_cast<DKJungle*>(gWorldInstance.CurrentCourse) != nullptr; }
|
||||
bool IsBigDonut() { return dynamic_cast<BigDonut*>(gWorldInstance.CurrentCourse) != nullptr; }
|
||||
bool IsPodiumCeremony() { return dynamic_cast<PodiumCeremony*>(gWorldInstance.CurrentCourse) != nullptr; }
|
||||
bool IsMarioRaceway() { return dynamic_cast<MarioRaceway*>(gWorldInstance.CurrentCourse.get()) != nullptr; }
|
||||
bool IsLuigiRaceway() { return dynamic_cast<LuigiRaceway*>(gWorldInstance.CurrentCourse.get()) != nullptr; }
|
||||
bool IsChocoMountain() { return dynamic_cast<ChocoMountain*>(gWorldInstance.CurrentCourse.get()) != nullptr; }
|
||||
bool IsBowsersCastle() { return dynamic_cast<BowsersCastle*>(gWorldInstance.CurrentCourse.get()) != nullptr; }
|
||||
bool IsBansheeBoardwalk() { return dynamic_cast<BansheeBoardwalk*>(gWorldInstance.CurrentCourse.get()) != nullptr; }
|
||||
bool IsYoshiValley() { return dynamic_cast<YoshiValley*>(gWorldInstance.CurrentCourse.get()) != nullptr; }
|
||||
bool IsFrappeSnowland() { return dynamic_cast<FrappeSnowland*>(gWorldInstance.CurrentCourse.get()) != nullptr; }
|
||||
bool IsKoopaTroopaBeach() { return dynamic_cast<KoopaTroopaBeach*>(gWorldInstance.CurrentCourse.get()) != nullptr; }
|
||||
bool IsRoyalRaceway() { return dynamic_cast<RoyalRaceway*>(gWorldInstance.CurrentCourse.get()) != nullptr; }
|
||||
bool IsMooMooFarm() { return dynamic_cast<MooMooFarm*>(gWorldInstance.CurrentCourse.get()) != nullptr; }
|
||||
bool IsToadsTurnpike() { return dynamic_cast<ToadsTurnpike*>(gWorldInstance.CurrentCourse.get()) != nullptr; }
|
||||
bool IsKalimariDesert() { return dynamic_cast<KalimariDesert*>(gWorldInstance.CurrentCourse.get()) != nullptr; }
|
||||
bool IsSherbetLand() { return dynamic_cast<SherbetLand*>(gWorldInstance.CurrentCourse.get()) != nullptr; }
|
||||
bool IsRainbowRoad() { return dynamic_cast<RainbowRoad*>(gWorldInstance.CurrentCourse.get()) != nullptr; }
|
||||
bool IsWarioStadium() { return dynamic_cast<WarioStadium*>(gWorldInstance.CurrentCourse.get()) != nullptr; }
|
||||
bool IsBlockFort() { return dynamic_cast<BlockFort*>(gWorldInstance.CurrentCourse.get()) != nullptr; }
|
||||
bool IsSkyscraper() { return dynamic_cast<Skyscraper*>(gWorldInstance.CurrentCourse.get()) != nullptr; }
|
||||
bool IsDoubleDeck() { return dynamic_cast<DoubleDeck*>(gWorldInstance.CurrentCourse.get()) != nullptr; }
|
||||
bool IsDkJungle() { return dynamic_cast<DKJungle*>(gWorldInstance.CurrentCourse.get()) != nullptr; }
|
||||
bool IsBigDonut() { return dynamic_cast<BigDonut*>(gWorldInstance.CurrentCourse.get()) != nullptr; }
|
||||
bool IsPodiumCeremony() { return dynamic_cast<PodiumCeremony*>(gWorldInstance.CurrentCourse.get()) != nullptr; }
|
||||
|
||||
void SelectMarioRaceway() { gWorldInstance.SetCourseByType<MarioRaceway>(); }
|
||||
void SelectLuigiRaceway() { gWorldInstance.SetCourseByType<LuigiRaceway>(); }
|
||||
@@ -750,7 +750,7 @@ void SelectSkyscraper() { gWorldInstance.SetCourseByType<Skyscraper>();
|
||||
void SelectDoubleDeck() { gWorldInstance.SetCourseByType<DoubleDeck>(); }
|
||||
void SelectDkJungle() { gWorldInstance.SetCourseByType<DKJungle>(); }
|
||||
void SelectBigDonut() { gWorldInstance.SetCourseByType<BigDonut>(); }
|
||||
void SelectPodiumCeremony() { gWorldInstance.CurrentCourse = gPodiumCeremony.get(); }
|
||||
void SelectPodiumCeremony() { gWorldInstance.CurrentCourse = gPodiumCeremony; }
|
||||
// clang-format on
|
||||
|
||||
void* GetMushroomCup(void) {
|
||||
|
||||
@@ -136,7 +136,7 @@ namespace Editor {
|
||||
std::string label = fmt::format("{} {}", ICON_FA_EXCLAMATION_TRIANGLE, track.Name);
|
||||
if (ImGui::Button(label.c_str())) {
|
||||
track.SceneFile = track.Dir + "/scene.json";
|
||||
gWorldInstance.CurrentCourse = track.invalidTrack.get();
|
||||
gWorldInstance.CurrentCourse = track.invalidTrack;
|
||||
SetSceneFile(track.Archive, track.SceneFile);
|
||||
SaveLevel();
|
||||
Refresh = true;
|
||||
@@ -153,7 +153,7 @@ namespace Editor {
|
||||
for (auto& track : Tracks) {
|
||||
auto it = gWorldInstance.Courses.begin();
|
||||
while (it != gWorldInstance.Courses.end()) {
|
||||
if (track.course == it->get()) {
|
||||
if (track.course.get() == it->get()) {
|
||||
it = gWorldInstance.Courses.erase(it);
|
||||
} else {
|
||||
++it;
|
||||
@@ -238,11 +238,11 @@ namespace Editor {
|
||||
if (manager->HasFile(sceneFile)) {
|
||||
auto archive = manager->GetArchiveFromFile(sceneFile);
|
||||
|
||||
auto course = std::make_unique<Course>();
|
||||
auto course = std::make_shared<Course>();
|
||||
course->LoadO2R(dir);
|
||||
LoadLevel(archive, course.get(), sceneFile);
|
||||
LoadMinimap(archive, course.get(), minimapFile);
|
||||
Tracks.push_back({nullptr, course.get(), sceneFile, name, dir, archive});
|
||||
Tracks.push_back({nullptr, course, sceneFile, name, dir, archive});
|
||||
gWorldInstance.Courses.push_back(std::move(course));
|
||||
} else { // The track does not have a valid scene file
|
||||
const std::string file = dir + "/data_track_sections";
|
||||
@@ -252,12 +252,12 @@ namespace Editor {
|
||||
// So lets add it as an uninitialized track.
|
||||
if (manager->HasFile(file)) {
|
||||
|
||||
auto course = std::make_unique<Course>();
|
||||
auto course = std::make_shared<Course>();
|
||||
course->Id = (std::string("mods:") + name).c_str();
|
||||
course->Props.SetText(course->Props.Name, name.c_str(), sizeof(course->Props.Name));
|
||||
course->Props.SetText(course->Props.DebugName, name.c_str(), sizeof(course->Props.Name));
|
||||
auto archive = manager->GetArchiveFromFile(file);
|
||||
Tracks.push_back({std::move(course), nullptr, "", name, dir, archive});
|
||||
Tracks.push_back({course, nullptr, "", name, dir, archive});
|
||||
} else {
|
||||
printf("ContentBrowser.cpp: Track '%s' missing required track files. Cannot add to game\n Missing %s/data_track_sections file\n", name.c_str(), dir.c_str());
|
||||
}
|
||||
|
||||
@@ -10,8 +10,8 @@ public:
|
||||
~ContentBrowserWindow();
|
||||
|
||||
struct Tracks {
|
||||
std::unique_ptr<Course> invalidTrack; // If not nullptr, user needs to create a scene file for this track.
|
||||
Course* course; // A valid custom track. Used to reset the Courses array on a file system refresh.
|
||||
std::shared_ptr<Course> invalidTrack; // If not nullptr, user needs to create a scene file for this track.
|
||||
std::shared_ptr<Course> course; // A valid custom track. Used to reset the Courses array on a file system refresh.
|
||||
std::string SceneFile;
|
||||
std::string Name;
|
||||
std::string Dir; // Directory
|
||||
|
||||
Reference in New Issue
Block a user