summaryrefslogtreecommitdiff
path: root/src/engine/Cup.cpp
diff options
context:
space:
mode:
authorMegaMech <MegaMech@users.noreply.github.com>2025-12-13 11:50:28 -0700
committerGitHub <noreply@github.com>2025-12-13 11:50:28 -0700
commitb934e98fc34964970ab5efacb2fb7c3372ae0b1a (patch)
treecd96e5fabec7fdcc098d0de33b3b7e2754fb6cd5 /src/engine/Cup.cpp
parente6acb59ef4797ce27ddc9e21982c3f4e40824b52 (diff)
Refactor Track Class To Instantiate On Track Load (#587)
* Initial Commit * First compilation of Registry template * Further changes * wip changes * Impl TrackBrowser and Registry Info * Remove const from TInfo * Prep GetWorld * Name refactor * Refactor gWorldInstance to GetWorld() * wip * Should work now * Data menu work again * Fix editor staying open after program close * Rename LoadLevel to LoadTrackDataFromJson * More changes * Add statue * Add search to content browser using tags * Fix statue pos and register tags * Fix actor loading * Fix delete all bug which deleted cameras * reduce some boiler plate in actor and object * Remove unused rulesets * Search bar for all tabs * fix data screen * fix actor spawning * temp editor fix * Clean up * improve extra mode transformation * fix podium crash * Fix editor clicking * Fix editor clicking 2 * fix extra in custom track * Fix FI for three actors * Fix divide by zero error * Ids managed by Registry * Add scary comment --------- Co-authored-by: MegaMech <7255464+MegaMech@users.noreply.github.com> Co-authored-by: coco875 <pereira.jannin@gmail.com>
Diffstat (limited to 'src/engine/Cup.cpp')
-rw-r--r--src/engine/Cup.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/engine/Cup.cpp b/src/engine/Cup.cpp
index 0bbaff851..cc85ebca8 100644
--- a/src/engine/Cup.cpp
+++ b/src/engine/Cup.cpp
@@ -1,18 +1,19 @@
#include "Cup.h"
#include "tracks/Track.h"
+#include "port/Game.h"
-Cup::Cup(std::string id, const char* name, std::vector<std::shared_ptr<Track>> courses) {
+Cup::Cup(std::string id, const char* name, std::vector<std::string> tracks) {
Id = id;
Name = name;
- Courses = courses;
+ mTracks = tracks;
- if (Courses.size() != 4) {
- throw std::invalid_argument("A cup must contain exactly 4 courses.");
+ if (mTracks.size() != 4) {
+ throw std::invalid_argument("A cup must contain exactly 4 tracks.");
}
}
void Cup::Next() {
- if (CursorPosition < Courses.size() - 1) {
+ if (CursorPosition < mTracks.size() - 1) {
CursorPosition++;
}
}
@@ -24,23 +25,23 @@ void Cup::Previous() {
}
void Cup::SetTrack(size_t position) {
- if ((position < 0) || (position >= Courses.size())) {
+ if ((position < 0) || (position >= mTracks.size())) {
throw std::invalid_argument("Invalid track index.");
}
CursorPosition = position;
}
-std::shared_ptr<Track> Cup::GetTrack() {
- return Courses[CursorPosition];
+std::string Cup::GetTrack() {
+ return mTracks[CursorPosition];
}
size_t Cup::GetSize() {
- return Courses.size();
+ return mTracks.size();
}
-// Function to shuffle the courses randomly
-void Cup::ShuffleCourses() {
+// Function to shuffle the tracks randomly
+void Cup::ShuffleTracks() {
// std::random_device rd;
// std::mt19937 g(rd());
- //std::shuffle(Courses.begin(), Courses.end(), g);
+ //std::shuffle(mTracks.begin(), mTracks.end(), g);
}