more intuitive GetWorld function

This commit is contained in:
gymnast86
2026-05-21 05:52:48 -07:00
parent 650b56beee
commit fd523a7e4d
4 changed files with 20 additions and 5 deletions
+3 -3
View File
@@ -234,7 +234,7 @@ namespace dusk {
}
if (randomizer_IsActive()) {
auto currentItems = getSaveItemPool(trackerRando->GetWorlds()[0].get());
auto currentItems = getSaveItemPool(trackerRando->GetWorld());
m_currentSearch = randomizer::logic::search::Search::AccessibleNoStartingInventory(&trackerRando->GetWorlds(), currentItems);
}
m_currentSearch.SearchWorlds();
@@ -252,7 +252,7 @@ namespace dusk {
ImGui::InputText("Location Filter", m_locationFilter, 100);
// Show total number of available locations
auto locations = trackerRando->GetWorlds()[0]->GetAllLocations();
auto locations = trackerRando->GetWorld()->GetAllLocations();
auto numProgressionLocations = std::ranges::count_if(locations, [](auto* location) {return location->IsProgression();});
auto numAvailableLocations = m_currentSearch._visitedLocations.size();
ImGui::Text("Locations Available: %zu / %zu", numAvailableLocations, numProgressionLocations);
@@ -318,7 +318,7 @@ namespace dusk {
void ImGuiMenuRandomizer::generateLocationInfo() {
auto trackerRando = getTrackerRando();
auto locations = trackerRando->GetWorlds()[0]->GetAllLocations();
auto locations = trackerRando->GetWorld()->GetAllLocations();
m_LocationInfo.clear();
@@ -915,7 +915,7 @@ void parseObjPatchData(stage_tgsc_data_class& object, const YAML::Node& patchNod
}
}
RandomizerContext WriteSeedData(const std::unique_ptr<randomizer::logic::world::World>& world) {
RandomizerContext WriteSeedData(randomizer::logic::world::World* world) {
RandomizerContext randoData{};
// Settings we need to check ingame
@@ -1248,7 +1248,7 @@ void GenerateAndWriteSeed(std::string& generationStatusMsg) {
return;
}
const auto& world = r.GetWorlds()[0];
const auto world = r.GetWorld();
RandomizerContext randoData{};
try {
randoData = WriteSeedData(world);
@@ -19,6 +19,15 @@
namespace randomizer
{
logic::world::World* Randomizer::GetWorld(int worldId /*= 1*/) {
auto worldIndex = worldId - 1;
if (worldIndex < this->_worlds.size()) {
return this->_worlds.at(worldIndex).get();
}
return nullptr;
}
std::optional<std::string> Randomizer::Generate()
{
try
@@ -23,6 +23,12 @@ namespace randomizer
auto& GetConfig() { return this->_config; }
auto& GetWorlds() { return this->_worlds; }
/**
* @param worldId
* @return The world with the specified Id. If no Id is specified, the first world will
* be returned. If a world with the Id does not exist, a nullptr will be returned.
*/
logic::world::World* GetWorld(int worldId = 1);
int GetNewEventID() { return ++(this->_eventIdCounter); }
int GetNewAreaID() { return ++(this->_areaIdCounter); }