mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-05-29 08:12:52 -04:00
remove redundant specifiers
This commit is contained in:
@@ -11,19 +11,19 @@
|
||||
namespace randomizer::logic::area
|
||||
{
|
||||
|
||||
LocationAccess::LocationAccess(randomizer::logic::location::Location* loc,
|
||||
const randomizer::logic::requirement::Requirement& req,
|
||||
LocationAccess::LocationAccess(location::Location* loc,
|
||||
const requirement::Requirement& req,
|
||||
Area* area):
|
||||
_loc(loc), _req(std::move(req)), _area(area)
|
||||
{
|
||||
this->_id = area->GetWorld()->GetRandomizer()->GetNewLocAccID();
|
||||
}
|
||||
|
||||
randomizer::logic::location::Location* LocationAccess::GetLocation() const
|
||||
location::Location* LocationAccess::GetLocation() const
|
||||
{
|
||||
return this->_loc;
|
||||
}
|
||||
const randomizer::logic::requirement::Requirement& LocationAccess::GetRequirement()
|
||||
const requirement::Requirement& LocationAccess::GetRequirement()
|
||||
{
|
||||
return this->_req;
|
||||
}
|
||||
@@ -36,12 +36,12 @@ namespace randomizer::logic::area
|
||||
return this->_id;
|
||||
}
|
||||
|
||||
EventAccess::EventAccess(const randomizer::logic::requirement::Requirement& req, Area* area, const int& eventIndex):
|
||||
EventAccess::EventAccess(const requirement::Requirement& req, Area* area, const int& eventIndex):
|
||||
_req(std::move(req)), _area(area), _eventIndex(eventIndex)
|
||||
{
|
||||
}
|
||||
|
||||
const randomizer::logic::requirement::Requirement& EventAccess::GetRequirement()
|
||||
const requirement::Requirement& EventAccess::GetRequirement()
|
||||
{
|
||||
return this->_req;
|
||||
}
|
||||
@@ -59,7 +59,7 @@ namespace randomizer::logic::area
|
||||
return this->_area->GetWorld()->GetEventName(this->_eventIndex);
|
||||
}
|
||||
|
||||
Area::Area(const std::string& name, randomizer::logic::world::World* world): _name(name), _world(world)
|
||||
Area::Area(const std::string& name, world::World* world): _name(name), _world(world)
|
||||
{
|
||||
this->_id = world->GetRandomizer()->GetNewAreaID();
|
||||
}
|
||||
@@ -106,14 +106,14 @@ namespace randomizer::logic::area
|
||||
return locations;
|
||||
}
|
||||
|
||||
void Area::SetExits(std::list<std::unique_ptr<randomizer::logic::entrance::Entrance>>& exits)
|
||||
void Area::SetExits(std::list<std::unique_ptr<entrance::Entrance>>& exits)
|
||||
{
|
||||
this->_exits = std::move(exits);
|
||||
}
|
||||
|
||||
std::list<randomizer::logic::entrance::Entrance*> Area::GetExits() const
|
||||
std::list<entrance::Entrance*> Area::GetExits() const
|
||||
{
|
||||
std::list<randomizer::logic::entrance::Entrance*> exits;
|
||||
std::list<entrance::Entrance*> exits;
|
||||
for (const auto& exit : this->_exits)
|
||||
{
|
||||
exits.emplace_back(exit.get());
|
||||
@@ -121,33 +121,33 @@ namespace randomizer::logic::area
|
||||
return exits;
|
||||
}
|
||||
|
||||
void Area::AddExit(std::unique_ptr<randomizer::logic::entrance::Entrance>& exit)
|
||||
void Area::AddExit(std::unique_ptr<entrance::Entrance>& exit)
|
||||
{
|
||||
this->_exits.push_back(std::move(exit));
|
||||
}
|
||||
|
||||
void Area::RemoveExit(randomizer::logic::entrance::Entrance* exit)
|
||||
void Area::RemoveExit(entrance::Entrance* exit)
|
||||
{
|
||||
auto removed = std::remove_if(this->_exits.begin(), this->_exits.end(), [&](const auto& e) { return e.get() == exit; });
|
||||
this->_exits.erase(removed, this->_exits.end());
|
||||
}
|
||||
|
||||
void Area::AddEntrance(randomizer::logic::entrance::Entrance* entrance)
|
||||
void Area::AddEntrance(entrance::Entrance* entrance)
|
||||
{
|
||||
this->_entrances.emplace_back(entrance);
|
||||
}
|
||||
|
||||
void Area::RemoveEntrance(randomizer::logic::entrance::Entrance* entrance)
|
||||
void Area::RemoveEntrance(entrance::Entrance* entrance)
|
||||
{
|
||||
auto removed = std::remove(this->_entrances.begin(), this->_entrances.end(), entrance);
|
||||
this->_entrances.erase(removed, this->_entrances.end());
|
||||
}
|
||||
|
||||
std::list<randomizer::logic::entrance::Entrance*> Area::GetEntrances() const
|
||||
std::list<entrance::Entrance*> Area::GetEntrances() const
|
||||
{
|
||||
return this->_entrances;
|
||||
}
|
||||
randomizer::logic::world::World* Area::GetWorld() const
|
||||
world::World* Area::GetWorld() const
|
||||
{
|
||||
return this->_world;
|
||||
}
|
||||
@@ -184,12 +184,12 @@ namespace randomizer::logic::area
|
||||
return this->_twilightCompletedMacroIndex;
|
||||
}
|
||||
|
||||
bool Area::TwilightCleared(randomizer::logic::search::Search* search) const
|
||||
bool Area::TwilightCleared(search::Search* search) const
|
||||
{
|
||||
return this->_twilightCompletedMacroIndex == -1 || randomizer::logic::requirement::EvaluateRequirementAtFormTime(
|
||||
return this->_twilightCompletedMacroIndex == -1 || requirement::EvaluateRequirementAtFormTime(
|
||||
this->GetWorld()->GetMacro(this->_twilightCompletedMacroIndex),
|
||||
search,
|
||||
randomizer::logic::requirement::FormTime::ALL,
|
||||
requirement::FormTime::ALL,
|
||||
this->GetWorld());
|
||||
}
|
||||
|
||||
|
||||
@@ -28,32 +28,32 @@ namespace randomizer::logic::area
|
||||
class LocationAccess
|
||||
{
|
||||
public:
|
||||
LocationAccess(randomizer::logic::location::Location* loc, const randomizer::logic::requirement::Requirement& req, Area* area);
|
||||
LocationAccess(location::Location* loc, const requirement::Requirement& req, Area* area);
|
||||
|
||||
randomizer::logic::location::Location* GetLocation() const;
|
||||
const randomizer::logic::requirement::Requirement& GetRequirement();
|
||||
location::Location* GetLocation() const;
|
||||
const requirement::Requirement& GetRequirement();
|
||||
Area* GetArea() const;
|
||||
int GetID() const;
|
||||
|
||||
private:
|
||||
int _id = -1;
|
||||
randomizer::logic::location::Location* _loc = nullptr;
|
||||
randomizer::logic::requirement::Requirement _req;
|
||||
location::Location* _loc = nullptr;
|
||||
requirement::Requirement _req;
|
||||
Area* _area = nullptr;
|
||||
};
|
||||
|
||||
class EventAccess
|
||||
{
|
||||
public:
|
||||
EventAccess(const randomizer::logic::requirement::Requirement& req, Area* area, const int& eventIndex);
|
||||
EventAccess(const requirement::Requirement& req, Area* area, const int& eventIndex);
|
||||
|
||||
const randomizer::logic::requirement::Requirement& GetRequirement();
|
||||
const requirement::Requirement& GetRequirement();
|
||||
Area* GetArea() const;
|
||||
int GetEventIndex() const;
|
||||
std::string GetName() const;
|
||||
|
||||
private:
|
||||
randomizer::logic::requirement::Requirement _req;
|
||||
requirement::Requirement _req;
|
||||
Area* _area = nullptr;
|
||||
int _eventIndex = -1;
|
||||
};
|
||||
@@ -61,7 +61,7 @@ namespace randomizer::logic::area
|
||||
class Area
|
||||
{
|
||||
public:
|
||||
Area(const std::string& name, randomizer::logic::world::World* world);
|
||||
Area(const std::string& name, world::World* world);
|
||||
|
||||
std::string GetName() const;
|
||||
void SetHardAssignedRegion(const std::string& _hardAssignedRegion);
|
||||
@@ -70,14 +70,14 @@ namespace randomizer::logic::area
|
||||
std::list<EventAccess*> GetEvents() const;
|
||||
void SetLocations(std::list<std::unique_ptr<LocationAccess>>& locations);
|
||||
std::list<LocationAccess*> GetLocations() const;
|
||||
void SetExits(std::list<std::unique_ptr<randomizer::logic::entrance::Entrance>>& exits);
|
||||
std::list<randomizer::logic::entrance::Entrance*> GetExits() const;
|
||||
void AddExit(std::unique_ptr<randomizer::logic::entrance::Entrance>& exit);
|
||||
void RemoveExit(randomizer::logic::entrance::Entrance* exit);
|
||||
void AddEntrance(randomizer::logic::entrance::Entrance* entrance);
|
||||
void RemoveEntrance(randomizer::logic::entrance::Entrance* entrance);
|
||||
std::list<randomizer::logic::entrance::Entrance*> GetEntrances() const;
|
||||
randomizer::logic::world::World* GetWorld() const;
|
||||
void SetExits(std::list<std::unique_ptr<entrance::Entrance>>& exits);
|
||||
std::list<entrance::Entrance*> GetExits() const;
|
||||
void AddExit(std::unique_ptr<entrance::Entrance>& exit);
|
||||
void RemoveExit(entrance::Entrance* exit);
|
||||
void AddEntrance(entrance::Entrance* entrance);
|
||||
void RemoveEntrance(entrance::Entrance* entrance);
|
||||
std::list<entrance::Entrance*> GetEntrances() const;
|
||||
world::World* GetWorld() const;
|
||||
void SetCanChangeTime(const bool& canChangeTime);
|
||||
bool CanChangeTime() const;
|
||||
void SetCanTransform(const bool& canTransform);
|
||||
@@ -86,7 +86,7 @@ namespace randomizer::logic::area
|
||||
std::set<std::string> GetHintRegions();
|
||||
void SetTwilightCompletedMacroIndex(const int& macroIndex);
|
||||
int GetTwilightCompletedMacroIndex() const;
|
||||
bool TwilightCleared(randomizer::logic::search::Search* search) const;
|
||||
bool TwilightCleared(search::Search* search) const;
|
||||
|
||||
/**
|
||||
* @brief Assigns this area's hint regions(s) as well as assigns any locations within the area to a dungeon if the
|
||||
@@ -101,9 +101,9 @@ namespace randomizer::logic::area
|
||||
std::set<std::string> _hintRegions = {};
|
||||
std::list<std::unique_ptr<EventAccess>> _events = {};
|
||||
std::list<std::unique_ptr<LocationAccess>> _locations = {};
|
||||
std::list<std::unique_ptr<randomizer::logic::entrance::Entrance>> _exits = {};
|
||||
std::list<randomizer::logic::entrance::Entrance*> _entrances = {};
|
||||
randomizer::logic::world::World* _world;
|
||||
std::list<std::unique_ptr<entrance::Entrance>> _exits = {};
|
||||
std::list<entrance::Entrance*> _entrances = {};
|
||||
world::World* _world;
|
||||
bool _canChangeTime = false;
|
||||
bool _canTransform = false;
|
||||
int _twilightCompletedMacroIndex = -1;
|
||||
|
||||
@@ -10,100 +10,100 @@
|
||||
|
||||
namespace randomizer::logic::dungeon
|
||||
{
|
||||
Dungeon::Dungeon(const std::string& name, randomizer::logic::world::World* world): _name(name), _world(world) {}
|
||||
Dungeon::Dungeon(const std::string& name, world::World* world): _name(name), _world(world) {}
|
||||
|
||||
std::string Dungeon::GetName() const
|
||||
{
|
||||
return this->_name;
|
||||
}
|
||||
|
||||
void Dungeon::SetSmallKey(randomizer::logic::item::Item* item)
|
||||
void Dungeon::SetSmallKey(item::Item* item)
|
||||
{
|
||||
this->_smallKey = item;
|
||||
LOG_TO_DEBUG("Set \"" + item->GetName() + "\" as small key for dungeon " + this->_name);
|
||||
}
|
||||
|
||||
randomizer::logic::item::Item* Dungeon::GetSmallKey() const
|
||||
item::Item* Dungeon::GetSmallKey() const
|
||||
{
|
||||
return this->_smallKey;
|
||||
}
|
||||
|
||||
void Dungeon::SetBigKey(randomizer::logic::item::Item* item)
|
||||
void Dungeon::SetBigKey(item::Item* item)
|
||||
{
|
||||
this->_bigKey = item;
|
||||
LOG_TO_DEBUG("Set \"" + item->GetName() + "\" as big key for dungeon " + this->_name);
|
||||
}
|
||||
|
||||
randomizer::logic::item::Item* Dungeon::GetBigKey() const
|
||||
item::Item* Dungeon::GetBigKey() const
|
||||
{
|
||||
return this->_bigKey;
|
||||
}
|
||||
|
||||
void Dungeon::SetCompass(randomizer::logic::item::Item* item)
|
||||
void Dungeon::SetCompass(item::Item* item)
|
||||
{
|
||||
this->_compass = item;
|
||||
LOG_TO_DEBUG("Set \"" + item->GetName() + "\" as compass for dungeon " + this->_name);
|
||||
}
|
||||
|
||||
randomizer::logic::item::Item* Dungeon::GetCompass() const
|
||||
item::Item* Dungeon::GetCompass() const
|
||||
{
|
||||
return this->_compass;
|
||||
}
|
||||
|
||||
void Dungeon::SetDungeonMap(randomizer::logic::item::Item* item)
|
||||
void Dungeon::SetDungeonMap(item::Item* item)
|
||||
{
|
||||
this->_dungeonMap = item;
|
||||
LOG_TO_DEBUG("Set \"" + item->GetName() + "\" as dungeon map for dungeon " + this->_name);
|
||||
}
|
||||
|
||||
randomizer::logic::item::Item* Dungeon::GetDungeonMap() const
|
||||
item::Item* Dungeon::GetDungeonMap() const
|
||||
{
|
||||
return this->_dungeonMap;
|
||||
}
|
||||
|
||||
void Dungeon::SetStartingArea(randomizer::logic::area::Area* startingArea)
|
||||
void Dungeon::SetStartingArea(area::Area* startingArea)
|
||||
{
|
||||
this->_startingArea = startingArea;
|
||||
LOG_TO_DEBUG("Set \"" + startingArea->GetName() + "\" as starting area for dungeon " + this->_name)
|
||||
}
|
||||
|
||||
randomizer::logic::area::Area* Dungeon::GetStartingAreas()
|
||||
area::Area* Dungeon::GetStartingAreas()
|
||||
{
|
||||
return this->_startingArea;
|
||||
}
|
||||
|
||||
void Dungeon::AddStartingEntrance(randomizer::logic::entrance::Entrance* startingEntrance)
|
||||
void Dungeon::AddStartingEntrance(entrance::Entrance* startingEntrance)
|
||||
{
|
||||
this->_startingEntrances.insert(startingEntrance);
|
||||
LOG_TO_DEBUG("Added \"" + startingEntrance->GetOriginalName() + "\" as starting entrance for dungeon " + this->_name)
|
||||
}
|
||||
|
||||
std::unordered_set<randomizer::logic::entrance::Entrance*> Dungeon::GetStartingEntrances() const
|
||||
std::unordered_set<entrance::Entrance*> Dungeon::GetStartingEntrances() const
|
||||
{
|
||||
return this->_startingEntrances;
|
||||
};
|
||||
|
||||
void Dungeon::AddLocation(randomizer::logic::location::Location* location)
|
||||
void Dungeon::AddLocation(location::Location* location)
|
||||
{
|
||||
if (!randomizer::utility::container::ElementInContainer(this->_locations, location))
|
||||
if (!utility::container::ElementInContainer(this->_locations, location))
|
||||
{
|
||||
this->_locations.push_back(location);
|
||||
LOG_TO_DEBUG(location->GetName() + " has been assigned to dungeon " + this->_name);
|
||||
}
|
||||
}
|
||||
|
||||
randomizer::logic::location::LocationPool Dungeon::GetLocations()
|
||||
location::LocationPool Dungeon::GetLocations()
|
||||
{
|
||||
return this->_locations;
|
||||
}
|
||||
|
||||
void Dungeon::SetGoalLocation(randomizer::logic::location::Location* goalLocation)
|
||||
void Dungeon::SetGoalLocation(location::Location* goalLocation)
|
||||
{
|
||||
this->_goalLocation = goalLocation;
|
||||
LOG_TO_DEBUG(goalLocation->GetName() + " has been assigned as goal location to dungeon " + this->_name);
|
||||
}
|
||||
|
||||
randomizer::logic::location::Location* Dungeon::GetGoalLocation()
|
||||
location::Location* Dungeon::GetGoalLocation()
|
||||
{
|
||||
return this->_goalLocation;
|
||||
}
|
||||
|
||||
@@ -32,25 +32,25 @@ namespace randomizer::logic::dungeon
|
||||
class Dungeon
|
||||
{
|
||||
public:
|
||||
Dungeon(const std::string& name, randomizer::logic::world::World* world);
|
||||
Dungeon(const std::string& name, world::World* world);
|
||||
|
||||
std::string GetName() const;
|
||||
void SetSmallKey(randomizer::logic::item::Item* item);
|
||||
randomizer::logic::item::Item* GetSmallKey() const;
|
||||
void SetBigKey(randomizer::logic::item::Item* item);
|
||||
randomizer::logic::item::Item* GetBigKey() const;
|
||||
void SetCompass(randomizer::logic::item::Item* item);
|
||||
randomizer::logic::item::Item* GetCompass() const;
|
||||
void SetDungeonMap(randomizer::logic::item::Item* item);
|
||||
randomizer::logic::item::Item* GetDungeonMap() const;
|
||||
void SetStartingArea(randomizer::logic::area::Area* startingArea);
|
||||
randomizer::logic::area::Area* GetStartingAreas();
|
||||
void AddStartingEntrance(randomizer::logic::entrance::Entrance* startingEntrance);
|
||||
std::unordered_set<randomizer::logic::entrance::Entrance*> GetStartingEntrances() const;
|
||||
void AddLocation(randomizer::logic::location::Location* location);
|
||||
randomizer::logic::location::LocationPool GetLocations();
|
||||
void SetGoalLocation(randomizer::logic::location::Location* goalLocation);
|
||||
randomizer::logic::location::Location* GetGoalLocation();
|
||||
void SetSmallKey(item::Item* item);
|
||||
item::Item* GetSmallKey() const;
|
||||
void SetBigKey(item::Item* item);
|
||||
item::Item* GetBigKey() const;
|
||||
void SetCompass(item::Item* item);
|
||||
item::Item* GetCompass() const;
|
||||
void SetDungeonMap(item::Item* item);
|
||||
item::Item* GetDungeonMap() const;
|
||||
void SetStartingArea(area::Area* startingArea);
|
||||
area::Area* GetStartingAreas();
|
||||
void AddStartingEntrance(entrance::Entrance* startingEntrance);
|
||||
std::unordered_set<entrance::Entrance*> GetStartingEntrances() const;
|
||||
void AddLocation(location::Location* location);
|
||||
location::LocationPool GetLocations();
|
||||
void SetGoalLocation(location::Location* goalLocation);
|
||||
location::Location* GetGoalLocation();
|
||||
void SetRequired(const bool& required);
|
||||
bool IsRequired() const;
|
||||
|
||||
@@ -62,15 +62,15 @@ namespace randomizer::logic::dungeon
|
||||
|
||||
private:
|
||||
std::string _name = "";
|
||||
randomizer::logic::world::World* _world;
|
||||
randomizer::logic::item::Item* _smallKey;
|
||||
randomizer::logic::item::Item* _bigKey;
|
||||
randomizer::logic::item::Item* _compass;
|
||||
randomizer::logic::item::Item* _dungeonMap;
|
||||
randomizer::logic::area::Area* _startingArea;
|
||||
std::unordered_set<randomizer::logic::entrance::Entrance*> _startingEntrances;
|
||||
randomizer::logic::location::Location* _goalLocation;
|
||||
randomizer::logic::location::LocationPool _locations = {};
|
||||
world::World* _world;
|
||||
item::Item* _smallKey;
|
||||
item::Item* _bigKey;
|
||||
item::Item* _compass;
|
||||
item::Item* _dungeonMap;
|
||||
area::Area* _startingArea;
|
||||
std::unordered_set<entrance::Entrance*> _startingEntrances;
|
||||
location::Location* _goalLocation;
|
||||
location::LocationPool _locations = {};
|
||||
bool _required = false;
|
||||
};
|
||||
} // namespace randomizer::logic::dungeon
|
||||
|
||||
@@ -85,10 +85,10 @@ namespace randomizer::logic::entrance
|
||||
return reverse.at(type);
|
||||
}
|
||||
|
||||
Entrance::Entrance(randomizer::logic::area::Area* parentArea,
|
||||
randomizer::logic::area::Area* connectedArea,
|
||||
const randomizer::logic::requirement::Requirement& req,
|
||||
randomizer::logic::world::World* world):
|
||||
Entrance::Entrance(area::Area* parentArea,
|
||||
area::Area* connectedArea,
|
||||
const requirement::Requirement& req,
|
||||
world::World* world):
|
||||
_parentArea(parentArea),
|
||||
_connectedArea(connectedArea),
|
||||
_originalConnectedArea(connectedArea),
|
||||
@@ -96,7 +96,7 @@ namespace randomizer::logic::entrance
|
||||
_world(world)
|
||||
{
|
||||
this->_originalName = this->GetCurrentName();
|
||||
this->_computedRequirement._type = randomizer::logic::requirement::Type::IMPOSSIBLE;
|
||||
this->_computedRequirement._type = requirement::Type::IMPOSSIBLE;
|
||||
}
|
||||
|
||||
void Entrance::SetID(const int& id)
|
||||
@@ -149,17 +149,17 @@ namespace randomizer::logic::entrance
|
||||
randomizer::utility::str::Erase(this->_alias, " North", " South", " East", " West", " Right", " Left");
|
||||
}
|
||||
|
||||
randomizer::logic::area::Area* Entrance::GetParentArea() const
|
||||
area::Area* Entrance::GetParentArea() const
|
||||
{
|
||||
return this->_parentArea;
|
||||
}
|
||||
|
||||
randomizer::logic::area::Area* Entrance::GetConnectedArea() const
|
||||
area::Area* Entrance::GetConnectedArea() const
|
||||
{
|
||||
return this->_connectedArea;
|
||||
}
|
||||
|
||||
randomizer::logic::area::Area* Entrance::GetOriginalConnectedArea() const
|
||||
area::Area* Entrance::GetOriginalConnectedArea() const
|
||||
{
|
||||
return this->_originalConnectedArea;
|
||||
}
|
||||
@@ -183,27 +183,27 @@ namespace randomizer::logic::entrance
|
||||
return this->_originalType;
|
||||
}
|
||||
|
||||
void Entrance::SetRequirement(const randomizer::logic::requirement::Requirement& req)
|
||||
void Entrance::SetRequirement(const requirement::Requirement& req)
|
||||
{
|
||||
this->_req = req;
|
||||
}
|
||||
|
||||
const randomizer::logic::requirement::Requirement& Entrance::GetRequirement()
|
||||
const requirement::Requirement& Entrance::GetRequirement()
|
||||
{
|
||||
return this->_req;
|
||||
}
|
||||
|
||||
void Entrance::SetComputedRequirement(const randomizer::logic::requirement::Requirement& computedRequirement)
|
||||
void Entrance::SetComputedRequirement(const requirement::Requirement& computedRequirement)
|
||||
{
|
||||
this->_computedRequirement = computedRequirement;
|
||||
}
|
||||
|
||||
randomizer::logic::requirement::Requirement Entrance::GetComputedRequirement()
|
||||
requirement::Requirement Entrance::GetComputedRequirement()
|
||||
{
|
||||
return this->_computedRequirement;
|
||||
}
|
||||
|
||||
randomizer::logic::world::World* Entrance::GetWorld() const
|
||||
world::World* Entrance::GetWorld() const
|
||||
{
|
||||
return this->_world;
|
||||
}
|
||||
@@ -290,13 +290,13 @@ namespace randomizer::logic::entrance
|
||||
return this->_assumed;
|
||||
}
|
||||
|
||||
void Entrance::Connect(randomizer::logic::area::Area* newConnectedArea)
|
||||
void Entrance::Connect(area::Area* newConnectedArea)
|
||||
{
|
||||
this->_connectedArea = newConnectedArea;
|
||||
newConnectedArea->AddEntrance(this);
|
||||
}
|
||||
|
||||
randomizer::logic::area::Area* Entrance::Disconnect()
|
||||
area::Area* Entrance::Disconnect()
|
||||
{
|
||||
this->_connectedArea->RemoveEntrance(this);
|
||||
auto previouslyConnected = this->_connectedArea;
|
||||
@@ -314,7 +314,7 @@ namespace randomizer::logic::entrance
|
||||
{
|
||||
auto root = this->_world->GetRootArea();
|
||||
auto targetEntrance =
|
||||
std::make_unique<Entrance>(root, nullptr, randomizer::logic::requirement::NO_REQUIREMENT, this->_world);
|
||||
std::make_unique<Entrance>(root, nullptr, requirement::NO_REQUIREMENT, this->_world);
|
||||
auto target = targetEntrance.get();
|
||||
root->AddExit(targetEntrance); // This moves the variable, so we have to use the pointer for the rest of the function
|
||||
target->Connect(this->_connectedArea);
|
||||
|
||||
@@ -67,10 +67,10 @@ namespace randomizer::logic::entrance
|
||||
class Entrance
|
||||
{
|
||||
public:
|
||||
Entrance(randomizer::logic::area::Area* parentArea,
|
||||
randomizer::logic::area::Area* connectedArea,
|
||||
const randomizer::logic::requirement::Requirement& req,
|
||||
randomizer::logic::world::World* world);
|
||||
Entrance(area::Area* parentArea,
|
||||
area::Area* connectedArea,
|
||||
const requirement::Requirement& req,
|
||||
world::World* world);
|
||||
|
||||
void SetID(const int& id);
|
||||
int GetID() const;
|
||||
@@ -86,17 +86,17 @@ namespace randomizer::logic::entrance
|
||||
* @brief Removes cardinal/direction specifiers from the entrance's name/alias (North, South, East, West, Left, Right)
|
||||
*/
|
||||
void GeneralizeName();
|
||||
randomizer::logic::area::Area* GetParentArea() const;
|
||||
randomizer::logic::area::Area* GetConnectedArea() const;
|
||||
randomizer::logic::area::Area* GetOriginalConnectedArea() const;
|
||||
area::Area* GetParentArea() const;
|
||||
area::Area* GetConnectedArea() const;
|
||||
area::Area* GetOriginalConnectedArea() const;
|
||||
void SetType(const Type& type);
|
||||
Type GetType() const;
|
||||
Type GetOriginalType() const;
|
||||
void SetRequirement(const randomizer::logic::requirement::Requirement& req);
|
||||
const randomizer::logic::requirement::Requirement& GetRequirement();
|
||||
void SetComputedRequirement(const randomizer::logic::requirement::Requirement& computedRequirement);
|
||||
randomizer::logic::requirement::Requirement GetComputedRequirement();
|
||||
randomizer::logic::world::World* GetWorld() const;
|
||||
void SetRequirement(const requirement::Requirement& req);
|
||||
const requirement::Requirement& GetRequirement();
|
||||
void SetComputedRequirement(const requirement::Requirement& computedRequirement);
|
||||
requirement::Requirement GetComputedRequirement();
|
||||
world::World* GetWorld() const;
|
||||
bool CanStartAt() const;
|
||||
void SetShuffled(const bool& shuffled);
|
||||
bool IsShuffled() const;
|
||||
@@ -121,7 +121,7 @@ namespace randomizer::logic::entrance
|
||||
*
|
||||
* @param newConnectedArea The area to connect this entrance to
|
||||
*/
|
||||
void Connect(randomizer::logic::area::Area* newConnectedArea);
|
||||
void Connect(area::Area* newConnectedArea);
|
||||
|
||||
/**
|
||||
* @brief Disconnect this entrance from the area it leads to. Will also remove this entrance from it's connected area's
|
||||
@@ -129,7 +129,7 @@ namespace randomizer::logic::entrance
|
||||
*
|
||||
* @return The area this entrance was previously connected to
|
||||
*/
|
||||
randomizer::logic::area::Area* Disconnect();
|
||||
area::Area* Disconnect();
|
||||
|
||||
/**
|
||||
* @brief Links two entrances by setting them as each others' reverse entrance
|
||||
@@ -150,25 +150,25 @@ namespace randomizer::logic::entrance
|
||||
|
||||
private:
|
||||
int _id = -1;
|
||||
randomizer::logic::area::Area* _parentArea = nullptr;
|
||||
randomizer::logic::area::Area* _connectedArea = nullptr;
|
||||
randomizer::logic::area::Area* _originalConnectedArea = nullptr;
|
||||
area::Area* _parentArea = nullptr;
|
||||
area::Area* _connectedArea = nullptr;
|
||||
area::Area* _originalConnectedArea = nullptr;
|
||||
Type _type = Type::INVALID;
|
||||
Type _originalType = Type::INVALID;
|
||||
std::string _originalName = "";
|
||||
std::string _alias = "";
|
||||
randomizer::logic::world::World* _world = nullptr;
|
||||
world::World* _world = nullptr;
|
||||
|
||||
/**
|
||||
* @brief The local requirement for this entrance assuming we have access to its parent area.
|
||||
*/
|
||||
randomizer::logic::requirement::Requirement _req;
|
||||
requirement::Requirement _req;
|
||||
|
||||
/**
|
||||
* @brief The flattened requirement which includes everything necessary to reach this entrance from the root of the
|
||||
* world graph.
|
||||
*/
|
||||
randomizer::logic::requirement::Requirement _computedRequirement;
|
||||
requirement::Requirement _computedRequirement;
|
||||
|
||||
// Variables used for entrance shuffling
|
||||
bool _canStartAt = false;
|
||||
|
||||
@@ -11,7 +11,7 @@ using namespace randomizer::logic::entrance;
|
||||
|
||||
namespace randomizer::logic::entrance_shuffle
|
||||
{
|
||||
void ShuffleWorldEntrances(randomizer::logic::world::World* world, randomizer::logic::world::WorldPool& worlds)
|
||||
void ShuffleWorldEntrances(world::World* world, world::WorldPool& worlds)
|
||||
{
|
||||
SetAllEntrancesData(world);
|
||||
|
||||
@@ -31,17 +31,17 @@ namespace randomizer::logic::entrance_shuffle
|
||||
}
|
||||
|
||||
// Validate the world one last time to ensure everything worked
|
||||
auto completeItemPool = randomizer::logic::item_pool::GetCompleteItemPool(worlds);
|
||||
auto completeItemPool = item_pool::GetCompleteItemPool(worlds);
|
||||
ValidateWorld(world, worlds, nullptr, completeItemPool);
|
||||
}
|
||||
|
||||
void SetAllEntrancesData(randomizer::logic::world::World* world)
|
||||
void SetAllEntrancesData(world::World* world)
|
||||
{
|
||||
auto filepath = RANDO_DATA_PATH "entrance_shuffle_data.yaml";
|
||||
randomizer::utility::file::Verify(filepath);
|
||||
utility::file::Verify(filepath);
|
||||
|
||||
// Keep track of which double door entrances are together
|
||||
std::unordered_map<std::string, std::list<randomizer::logic::entrance::Entrance*>> coupledDoors = {};
|
||||
std::unordered_map<std::string, std::list<entrance::Entrance*>> coupledDoors = {};
|
||||
|
||||
auto entranceDataTree = LoadYAML(filepath);
|
||||
for (const auto& entranceDataNode : entranceDataTree)
|
||||
@@ -50,8 +50,8 @@ namespace randomizer::logic::entrance_shuffle
|
||||
YAMLVerifyFields(entranceDataNode, "Type", "Forward");
|
||||
|
||||
auto typeStr = entranceDataNode["Type"].as<std::string>();
|
||||
auto type = randomizer::logic::entrance::TypeFromStr(typeStr);
|
||||
if (type == randomizer::logic::entrance::Type::INVALID)
|
||||
auto type = entrance::TypeFromStr(typeStr);
|
||||
if (type == entrance::Type::INVALID)
|
||||
{
|
||||
throw std::runtime_error("Unknown entrance type \"" + typeStr + "\" in entrance shuffle node:\n" +
|
||||
YAML::Dump(entranceDataNode));
|
||||
@@ -127,7 +127,7 @@ namespace randomizer::logic::entrance_shuffle
|
||||
}
|
||||
}
|
||||
|
||||
EntrancePools CreateEntrancePools(randomizer::logic::world::World* world)
|
||||
EntrancePools CreateEntrancePools(world::World* world)
|
||||
{
|
||||
EntrancePools entrancePools = {};
|
||||
|
||||
@@ -321,7 +321,7 @@ namespace randomizer::logic::entrance_shuffle
|
||||
|
||||
// Don't assume we have access to random spawn targets. We're only connecting to one of them
|
||||
// so assuming we have access to all of them would be erroneous.
|
||||
newTarget->SetRequirement(randomizer::logic::requirement::IMPOSSIBLE_REQUIREMENT);
|
||||
newTarget->SetRequirement(requirement::IMPOSSIBLE_REQUIREMENT);
|
||||
}
|
||||
}
|
||||
targetEntrancePools[type] = spawnPool;
|
||||
@@ -354,13 +354,13 @@ namespace randomizer::logic::entrance_shuffle
|
||||
return assumedPool;
|
||||
}
|
||||
|
||||
void SetPlandomizedEntrances(randomizer::logic::world::World* world,
|
||||
randomizer::logic::world::WorldPool& worlds,
|
||||
void SetPlandomizedEntrances(world::World* world,
|
||||
world::WorldPool& worlds,
|
||||
EntrancePools& entrancePools,
|
||||
EntrancePools& targetEntrancePools)
|
||||
{
|
||||
LOG_TO_DEBUG("Now placing plandomizer entrances");
|
||||
auto itemPool = randomizer::logic::item_pool::GetCompleteItemPool(worlds);
|
||||
auto itemPool = item_pool::GetCompleteItemPool(worlds);
|
||||
|
||||
for (auto& [plandoEntrance, plandoTarget] : world->GetPlandomizerEntrances())
|
||||
{
|
||||
@@ -456,12 +456,12 @@ namespace randomizer::logic::entrance_shuffle
|
||||
LOG_TO_DEBUG("All plandomized entrances have been placed.");
|
||||
}
|
||||
|
||||
void ShuffleNonAssumedEntrancesPools(randomizer::logic::world::World* world,
|
||||
randomizer::logic::world::WorldPool& worlds,
|
||||
void ShuffleNonAssumedEntrancesPools(world::World* world,
|
||||
world::WorldPool& worlds,
|
||||
EntrancePools& entrancePools,
|
||||
EntrancePools& targetEntrancePools)
|
||||
{
|
||||
auto completeItemPool = randomizer::logic::item_pool::GetCompleteItemPool(worlds);
|
||||
auto completeItemPool = item_pool::GetCompleteItemPool(worlds);
|
||||
|
||||
// The idea here is we want to try shuffling all the non-assumed entrances
|
||||
// at the same time since we can't validate the world after each one individually
|
||||
@@ -551,8 +551,8 @@ namespace randomizer::logic::entrance_shuffle
|
||||
}
|
||||
}
|
||||
|
||||
void ShuffleEntrancePool(randomizer::logic::world::World* world,
|
||||
randomizer::logic::world::WorldPool& worlds,
|
||||
void ShuffleEntrancePool(world::World* world,
|
||||
world::WorldPool& worlds,
|
||||
EntrancePool& entrancePool,
|
||||
EntrancePool& targetEntrancePool,
|
||||
int retries /* = 20*/)
|
||||
@@ -587,12 +587,12 @@ namespace randomizer::logic::entrance_shuffle
|
||||
"generate successfully.");
|
||||
}
|
||||
|
||||
void ShuffleEntrances(randomizer::logic::world::WorldPool& worlds,
|
||||
void ShuffleEntrances(world::WorldPool& worlds,
|
||||
EntrancePool& entrancePool,
|
||||
EntrancePool& targetEntrancePool,
|
||||
std::unordered_map<Entrance*, Entrance*>& rollbacks)
|
||||
{
|
||||
auto completeItemPool = randomizer::logic::item_pool::GetCompleteItemPool(worlds);
|
||||
auto completeItemPool = item_pool::GetCompleteItemPool(worlds);
|
||||
randomizer::utility::random::ShufflePool(entrancePool);
|
||||
|
||||
for (auto& entrance : entrancePool)
|
||||
@@ -642,11 +642,11 @@ namespace randomizer::logic::entrance_shuffle
|
||||
}
|
||||
}
|
||||
|
||||
bool ReplaceEntrance(randomizer::logic::world::WorldPool& worlds,
|
||||
bool ReplaceEntrance(world::WorldPool& worlds,
|
||||
Entrance* entrance,
|
||||
Entrance* target,
|
||||
std::unordered_map<Entrance*, Entrance*>& rollbacks,
|
||||
const randomizer::logic::item_pool::ItemPool& completeItemPool)
|
||||
const item_pool::ItemPool& completeItemPool)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -727,20 +727,20 @@ namespace randomizer::logic::entrance_shuffle
|
||||
}
|
||||
}
|
||||
|
||||
void ValidateWorld(randomizer::logic::world::World* world,
|
||||
randomizer::logic::world::WorldPool& worlds,
|
||||
void ValidateWorld(world::World* world,
|
||||
world::WorldPool& worlds,
|
||||
Entrance* entrance,
|
||||
const randomizer::logic::item_pool::ItemPool& completeItemPool)
|
||||
const item_pool::ItemPool& completeItemPool)
|
||||
{
|
||||
// Validate that all logic is still satisfied
|
||||
auto verifyLogicError = randomizer::logic::search::VerifyLogic(&worlds, completeItemPool);
|
||||
auto verifyLogicError = search::VerifyLogic(&worlds, completeItemPool);
|
||||
if (verifyLogicError.has_value())
|
||||
{
|
||||
throw EntranceShuffleError("Not all logic is satisfied! Reason:\n" + verifyLogicError.value());
|
||||
}
|
||||
|
||||
// Check to make sure there's at least 1 sphere zero location available
|
||||
auto sphereZeroSearch = randomizer::logic::search::Search::SphereZero(&worlds);
|
||||
auto sphereZeroSearch = search::Search::SphereZero(&worlds);
|
||||
sphereZeroSearch.SearchWorlds();
|
||||
const auto& foundLocations = sphereZeroSearch._visitedLocations;
|
||||
auto numSphereZeroLocations = std::count_if(foundLocations.begin(),
|
||||
|
||||
@@ -5,46 +5,46 @@
|
||||
|
||||
namespace randomizer::logic::entrance_shuffle
|
||||
{
|
||||
void ShuffleWorldEntrances(randomizer::logic::world::World* world, randomizer::logic::world::WorldPool& worlds);
|
||||
void SetAllEntrancesData(randomizer::logic::world::World* world);
|
||||
randomizer::logic::entrance::EntrancePools CreateEntrancePools(randomizer::logic::world::World* world);
|
||||
randomizer::logic::entrance::EntrancePools CreateTargetPools(randomizer::logic::entrance::EntrancePools& entrancePools);
|
||||
randomizer::logic::entrance::EntrancePool AssumeEntrancePool(randomizer::logic::entrance::EntrancePool& entrancePool);
|
||||
void SetPlandomizedEntrances(randomizer::logic::world::World* world,
|
||||
randomizer::logic::world::WorldPool& worlds,
|
||||
randomizer::logic::entrance::EntrancePools& entrancePools,
|
||||
randomizer::logic::entrance::EntrancePools& targetEntrancePools);
|
||||
void ShuffleNonAssumedEntrancesPools(randomizer::logic::world::World* world,
|
||||
randomizer::logic::world::WorldPool& worlds,
|
||||
randomizer::logic::entrance::EntrancePools& entrancePools,
|
||||
randomizer::logic::entrance::EntrancePools& targetEntrancePools);
|
||||
void ShuffleEntrancePool(randomizer::logic::world::World* world,
|
||||
randomizer::logic::world::WorldPool& worlds,
|
||||
randomizer::logic::entrance::EntrancePool& entrancePool,
|
||||
randomizer::logic::entrance::EntrancePool& targetEntrancePool,
|
||||
void ShuffleWorldEntrances(world::World* world, world::WorldPool& worlds);
|
||||
void SetAllEntrancesData(world::World* world);
|
||||
entrance::EntrancePools CreateEntrancePools(world::World* world);
|
||||
entrance::EntrancePools CreateTargetPools(entrance::EntrancePools& entrancePools);
|
||||
entrance::EntrancePool AssumeEntrancePool(entrance::EntrancePool& entrancePool);
|
||||
void SetPlandomizedEntrances(world::World* world,
|
||||
world::WorldPool& worlds,
|
||||
entrance::EntrancePools& entrancePools,
|
||||
entrance::EntrancePools& targetEntrancePools);
|
||||
void ShuffleNonAssumedEntrancesPools(world::World* world,
|
||||
world::WorldPool& worlds,
|
||||
entrance::EntrancePools& entrancePools,
|
||||
entrance::EntrancePools& targetEntrancePools);
|
||||
void ShuffleEntrancePool(world::World* world,
|
||||
world::WorldPool& worlds,
|
||||
entrance::EntrancePool& entrancePool,
|
||||
entrance::EntrancePool& targetEntrancePool,
|
||||
int retries = 20);
|
||||
void ShuffleEntrances(randomizer::logic::world::WorldPool& worlds,
|
||||
randomizer::logic::entrance::EntrancePool& entrancePool,
|
||||
randomizer::logic::entrance::EntrancePool& targetEntrancePool,
|
||||
std::unordered_map<randomizer::logic::entrance::Entrance*, randomizer::logic::entrance::Entrance*>& rollbacks);
|
||||
bool ReplaceEntrance(randomizer::logic::world::WorldPool& worlds,
|
||||
randomizer::logic::entrance::Entrance* entrance,
|
||||
randomizer::logic::entrance::Entrance* target,
|
||||
std::unordered_map<randomizer::logic::entrance::Entrance*, randomizer::logic::entrance::Entrance*>& rollbacks,
|
||||
const randomizer::logic::item_pool::ItemPool& completeItemPool);
|
||||
void ShuffleEntrances(world::WorldPool& worlds,
|
||||
entrance::EntrancePool& entrancePool,
|
||||
entrance::EntrancePool& targetEntrancePool,
|
||||
std::unordered_map<entrance::Entrance*, entrance::Entrance*>& rollbacks);
|
||||
bool ReplaceEntrance(world::WorldPool& worlds,
|
||||
entrance::Entrance* entrance,
|
||||
entrance::Entrance* target,
|
||||
std::unordered_map<entrance::Entrance*, entrance::Entrance*>& rollbacks,
|
||||
const item_pool::ItemPool& completeItemPool);
|
||||
|
||||
void CheckEntrancesCompatibility(randomizer::logic::entrance::Entrance* entrance, randomizer::logic::entrance::Entrance* target);
|
||||
void ChangeConnections(randomizer::logic::entrance::Entrance* entrance, randomizer::logic::entrance::Entrance* target);
|
||||
void RestoreConnections(randomizer::logic::entrance::Entrance* entrance, randomizer::logic::entrance::Entrance* target);
|
||||
void ConfirmReplacement(randomizer::logic::entrance::Entrance* entrance, randomizer::logic::entrance::Entrance* target);
|
||||
void DeleteTargetEntrance(randomizer::logic::entrance::Entrance* target);
|
||||
void ValidateWorld(randomizer::logic::world::World* world,
|
||||
randomizer::logic::world::WorldPool& worlds,
|
||||
randomizer::logic::entrance::Entrance* entrance,
|
||||
const randomizer::logic::item_pool::ItemPool& completeItemPool);
|
||||
void CheckEntrancesCompatibility(entrance::Entrance* entrance, entrance::Entrance* target);
|
||||
void ChangeConnections(entrance::Entrance* entrance, entrance::Entrance* target);
|
||||
void RestoreConnections(entrance::Entrance* entrance, entrance::Entrance* target);
|
||||
void ConfirmReplacement(entrance::Entrance* entrance, entrance::Entrance* target);
|
||||
void DeleteTargetEntrance(entrance::Entrance* target);
|
||||
void ValidateWorld(world::World* world,
|
||||
world::WorldPool& worlds,
|
||||
entrance::Entrance* entrance,
|
||||
const item_pool::ItemPool& completeItemPool);
|
||||
|
||||
void SetShuffledEntrances(randomizer::logic::entrance::EntrancePools& entrancePools);
|
||||
randomizer::logic::entrance::EntrancePool GetReverseEntrances(const randomizer::logic::entrance::EntrancePool& entrances);
|
||||
void SetShuffledEntrances(entrance::EntrancePools& entrancePools);
|
||||
entrance::EntrancePool GetReverseEntrances(const entrance::EntrancePool& entrances);
|
||||
|
||||
class EntranceShuffleError: public std::runtime_error
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
namespace randomizer::logic::fill
|
||||
{
|
||||
void FillWorlds(randomizer::logic::world::WorldPool& worlds)
|
||||
void FillWorlds(world::WorldPool& worlds)
|
||||
{
|
||||
// Place each world's restricted items first
|
||||
for (auto& world : worlds)
|
||||
@@ -19,8 +19,8 @@ namespace randomizer::logic::fill
|
||||
PlaceRestrictedItems(world, worlds);
|
||||
}
|
||||
|
||||
randomizer::logic::item_pool::ItemPool itemPool = {};
|
||||
randomizer::logic::location::LocationPool locationPool = {};
|
||||
item_pool::ItemPool itemPool = {};
|
||||
location::LocationPool locationPool = {};
|
||||
|
||||
// Combine all worlds' item pools and location pools
|
||||
for (const auto& world : worlds)
|
||||
@@ -58,17 +58,17 @@ namespace randomizer::logic::fill
|
||||
FastFill(itemPool, locationPool);
|
||||
|
||||
// Verify that all logic is satisfied
|
||||
auto verifyLogicError = randomizer::logic::search::VerifyLogic(&worlds);
|
||||
auto verifyLogicError = search::VerifyLogic(&worlds);
|
||||
if (verifyLogicError.has_value())
|
||||
{
|
||||
throw std::runtime_error("Not all logic satisfied! Reason:\n" + verifyLogicError.value());
|
||||
}
|
||||
}
|
||||
|
||||
void AssumedFill(randomizer::logic::world::WorldPool& worlds,
|
||||
randomizer::logic::item_pool::ItemPool& itemsToPlacePool,
|
||||
const randomizer::logic::item_pool::ItemPool& itemsNotYetPlaced,
|
||||
randomizer::logic::location::LocationPool allowedLocations,
|
||||
void AssumedFill(world::WorldPool& worlds,
|
||||
item_pool::ItemPool& itemsToPlacePool,
|
||||
const item_pool::ItemPool& itemsNotYetPlaced,
|
||||
location::LocationPool allowedLocations,
|
||||
const int& worldToFill /* = -1 */)
|
||||
{
|
||||
// Assumed Fill may sometimes place items in such a way that accidentally locks out being able to place specific items
|
||||
@@ -101,7 +101,7 @@ namespace randomizer::logic::fill
|
||||
|
||||
randomizer::utility::random::ShufflePool(itemsToPlacePool);
|
||||
auto itemsToPlace = itemsToPlacePool;
|
||||
randomizer::logic::location::LocationPool rollbacks = {};
|
||||
location::LocationPool rollbacks = {};
|
||||
|
||||
while (!itemsToPlace.empty())
|
||||
{
|
||||
@@ -110,12 +110,12 @@ namespace randomizer::logic::fill
|
||||
itemsToPlace.pop_back();
|
||||
|
||||
randomizer::utility::random::ShufflePool(allowedLocations);
|
||||
randomizer::logic::location::Location* spotToFill = nullptr;
|
||||
location::Location* spotToFill = nullptr;
|
||||
|
||||
// Assume we have all the items which haven't been played yet, except the one we're about to place
|
||||
auto assumedItems = itemsNotYetPlaced;
|
||||
assumedItems.insert(assumedItems.end(), itemsToPlace.begin(), itemsToPlace.end());
|
||||
auto search = randomizer::logic::search::Search::Accessible(&worlds, assumedItems, worldToFill);
|
||||
auto search = search::Search::Accessible(&worlds, assumedItems, worldToFill);
|
||||
search.SearchWorlds();
|
||||
// search.DumpWorldGraph();
|
||||
// return 1;
|
||||
@@ -130,7 +130,7 @@ namespace randomizer::logic::fill
|
||||
for (const auto& location : allowedLocations)
|
||||
{
|
||||
// Get all reachable LocationAccess spots for this location
|
||||
std::list<randomizer::logic::area::LocationAccess*> locAccList;
|
||||
std::list<area::LocationAccess*> locAccList;
|
||||
for (const auto& locAcc : location->GetAccessList())
|
||||
{
|
||||
if (canChooseAnyLocation || search._visitedAreas.contains(locAcc->GetArea()))
|
||||
@@ -152,8 +152,8 @@ namespace randomizer::logic::fill
|
||||
[&](const auto& la)
|
||||
{
|
||||
return canChooseAnyLocation ||
|
||||
randomizer::logic::requirement::EvaluateLocationRequirement(&search, la) ==
|
||||
randomizer::logic::requirement::EvalSuccess::COMPLETE;
|
||||
requirement::EvaluateLocationRequirement(&search, la) ==
|
||||
requirement::EvalSuccess::COMPLETE;
|
||||
}))
|
||||
{
|
||||
spotToFill = location;
|
||||
@@ -188,7 +188,7 @@ namespace randomizer::logic::fill
|
||||
}
|
||||
}
|
||||
|
||||
void FastFill(randomizer::logic::item_pool::ItemPool& itemsToPlace, randomizer::logic::location::LocationPool allowedLocations)
|
||||
void FastFill(item_pool::ItemPool& itemsToPlace, location::LocationPool allowedLocations)
|
||||
{
|
||||
auto emptyLocations =
|
||||
randomizer::utility::container::FilterFromVector(allowedLocations,
|
||||
@@ -211,7 +211,7 @@ namespace randomizer::logic::fill
|
||||
}
|
||||
}
|
||||
|
||||
void PlaceRestrictedItems(std::unique_ptr<randomizer::logic::world::World>& world, randomizer::logic::world::WorldPool& worlds)
|
||||
void PlaceRestrictedItems(std::unique_ptr<world::World>& world, world::WorldPool& worlds)
|
||||
{
|
||||
PlaceGoalLocationItems(world, worlds);
|
||||
PlaceOwnDungeonItems(world, worlds);
|
||||
@@ -225,7 +225,7 @@ namespace randomizer::logic::fill
|
||||
PlaceOverworldItems(world, worlds);
|
||||
}
|
||||
|
||||
void PlacePrologueItems(std::unique_ptr<randomizer::logic::world::World>& world, randomizer::logic::world::WorldPool& worlds)
|
||||
void PlacePrologueItems(std::unique_ptr<world::World>& world, world::WorldPool& worlds)
|
||||
{
|
||||
if (world->Setting("Skip Prologue") == "Off")
|
||||
{
|
||||
@@ -241,12 +241,12 @@ namespace randomizer::logic::fill
|
||||
item->GetName() == "Lantern" || item->GetName() == "Progressive Fishing Rod" ||
|
||||
item->IsShadowCrystal();
|
||||
});
|
||||
auto completeItemPool = randomizer::logic::item_pool::GetCompleteItemPool(worlds);
|
||||
auto completeItemPool = item_pool::GetCompleteItemPool(worlds);
|
||||
AssumedFill(worlds, prologueItems, completeItemPool, world->GetAllLocations());
|
||||
}
|
||||
}
|
||||
|
||||
void PlaceGoalLocationItems(std::unique_ptr<randomizer::logic::world::World>& world, randomizer::logic::world::WorldPool& worlds)
|
||||
void PlaceGoalLocationItems(std::unique_ptr<world::World>& world, world::WorldPool& worlds)
|
||||
{
|
||||
// If dungeon rewards can be anywhere, then return early and place them later
|
||||
if (world->Setting("Dungeon Rewards Can Be Anywhere") == "On")
|
||||
@@ -255,7 +255,7 @@ namespace randomizer::logic::fill
|
||||
}
|
||||
|
||||
auto allLocations = world->GetAllLocations();
|
||||
randomizer::logic::location::LocationPool goalLocations = {};
|
||||
location::LocationPool goalLocations = {};
|
||||
|
||||
// Filter out goal locations
|
||||
goalLocations = randomizer::utility::container::FilterFromVector(
|
||||
@@ -276,11 +276,11 @@ namespace randomizer::logic::fill
|
||||
}
|
||||
|
||||
// Place goal items at goal locations
|
||||
auto completeItemPool = randomizer::logic::item_pool::GetCompleteItemPool(worlds);
|
||||
auto completeItemPool = item_pool::GetCompleteItemPool(worlds);
|
||||
AssumedFill(worlds, goalItems, completeItemPool, goalLocations);
|
||||
}
|
||||
|
||||
void PlaceOwnDungeonItems(std::unique_ptr<randomizer::logic::world::World>& world, randomizer::logic::world::WorldPool& worlds)
|
||||
void PlaceOwnDungeonItems(std::unique_ptr<world::World>& world, world::WorldPool& worlds)
|
||||
{
|
||||
for (const auto& [dungeonName, dungeon] : world->GetDungeonTable())
|
||||
{
|
||||
@@ -306,7 +306,7 @@ namespace randomizer::logic::fill
|
||||
(dungeonName_ == "Snowpeak Ruins" &&
|
||||
(item->GetName() == "Ordon Pumpkin" || item->GetName() == "Ordon Cheese"));
|
||||
});
|
||||
auto completeItemPool = randomizer::logic::item_pool::GetCompleteItemPool(worlds);
|
||||
auto completeItemPool = item_pool::GetCompleteItemPool(worlds);
|
||||
AssumedFill(worlds, smallKeys, completeItemPool, dungeonLocations);
|
||||
}
|
||||
|
||||
@@ -316,7 +316,7 @@ namespace randomizer::logic::fill
|
||||
auto bigKeys = randomizer::utility::container::FilterAndEraseFromVector(world->GetItemPool(),
|
||||
[&](const auto& item)
|
||||
{ return item == dungeon_->GetBigKey(); });
|
||||
auto completeItemPool = randomizer::logic::item_pool::GetCompleteItemPool(worlds);
|
||||
auto completeItemPool = item_pool::GetCompleteItemPool(worlds);
|
||||
AssumedFill(worlds, bigKeys, completeItemPool, dungeonLocations);
|
||||
}
|
||||
|
||||
@@ -326,13 +326,13 @@ namespace randomizer::logic::fill
|
||||
auto mapsCompasses = randomizer::utility::container::FilterAndEraseFromVector(
|
||||
world->GetItemPool(),
|
||||
[&](const auto& item) { return item == dungeon_->GetCompass() || item == dungeon_->GetDungeonMap(); });
|
||||
auto completeItemPool = randomizer::logic::item_pool::GetCompleteItemPool(worlds);
|
||||
auto completeItemPool = item_pool::GetCompleteItemPool(worlds);
|
||||
FastFill(mapsCompasses, dungeonLocations);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PlaceAnywhereDungeonRewards(std::unique_ptr<randomizer::logic::world::World>& world, randomizer::logic::world::WorldPool& worlds)
|
||||
void PlaceAnywhereDungeonRewards(std::unique_ptr<world::World>& world, world::WorldPool& worlds)
|
||||
{
|
||||
// If dungeon rewards can't be anywhere, then return early as we placed them earlier
|
||||
if (world->Setting("Dungeon Rewards Can Be Anywhere") == "Off")
|
||||
@@ -350,20 +350,20 @@ namespace randomizer::logic::fill
|
||||
[&](const auto& item) { return goalItemNames.contains(item->GetName()); });
|
||||
|
||||
// Place the items
|
||||
auto completeItemPool = randomizer::logic::item_pool::GetCompleteItemPool(worlds);
|
||||
auto completeItemPool = item_pool::GetCompleteItemPool(worlds);
|
||||
AssumedFill(worlds, goalItems, completeItemPool, allLocations);
|
||||
}
|
||||
|
||||
void PlaceAnyDungeonItems(std::unique_ptr<randomizer::logic::world::World>& world, randomizer::logic::world::WorldPool& worlds)
|
||||
void PlaceAnyDungeonItems(std::unique_ptr<world::World>& world, world::WorldPool& worlds)
|
||||
{
|
||||
randomizer::logic::item_pool::ItemPool anyDungeonItems = {};
|
||||
randomizer::logic::location::LocationPool anyDungeonLocations = {};
|
||||
item_pool::ItemPool anyDungeonItems = {};
|
||||
location::LocationPool anyDungeonLocations = {};
|
||||
|
||||
// Split the placement of any dungeon items into two pools. Dungeon items from dungeons which should be barren
|
||||
// will only be distributed among barren dungeons, where as items from nonbarren dungeons will be distributed
|
||||
// among nonbarren dungeons
|
||||
std::list<randomizer::logic::dungeon::Dungeon*> nonBarrenDungeons = {};
|
||||
std::list<randomizer::logic::dungeon::Dungeon*> barrenDungeons = {};
|
||||
std::list<dungeon::Dungeon*> nonBarrenDungeons = {};
|
||||
std::list<dungeon::Dungeon*> barrenDungeons = {};
|
||||
for (const auto& [dungeonName, dungeon] : world->GetDungeonTable())
|
||||
{
|
||||
if (dungeon->ShouldBeBarren())
|
||||
@@ -429,15 +429,15 @@ namespace randomizer::logic::fill
|
||||
}
|
||||
|
||||
// Place the dungeon items in the appropriate dungeon locations
|
||||
auto completeItemPool = randomizer::logic::item_pool::GetCompleteItemPool(worlds);
|
||||
auto completeItemPool = item_pool::GetCompleteItemPool(worlds);
|
||||
AssumedFill(worlds, anyDungeonItems, completeItemPool, anyDungeonLocations);
|
||||
}
|
||||
}
|
||||
|
||||
void PlaceOverworldItems(std::unique_ptr<randomizer::logic::world::World>& world, randomizer::logic::world::WorldPool& worlds)
|
||||
void PlaceOverworldItems(std::unique_ptr<world::World>& world, world::WorldPool& worlds)
|
||||
{
|
||||
randomizer::logic::item_pool::ItemPool overworldItems = {};
|
||||
randomizer::logic::location::LocationPool overworldLocations = world->GetAllLocations();
|
||||
item_pool::ItemPool overworldItems = {};
|
||||
location::LocationPool overworldLocations = world->GetAllLocations();
|
||||
// Filter out any nonprogress locations
|
||||
randomizer::utility::container::FilterAndEraseFromVector(overworldLocations,
|
||||
[](const auto& location) { return !location->IsProgression(); });
|
||||
@@ -489,14 +489,14 @@ namespace randomizer::logic::fill
|
||||
}
|
||||
|
||||
// Place the dungeon items in the overworld locations
|
||||
auto completeItemPool = randomizer::logic::item_pool::GetCompleteItemPool(worlds);
|
||||
auto completeItemPool = item_pool::GetCompleteItemPool(worlds);
|
||||
AssumedFill(worlds, overworldItems, completeItemPool, overworldLocations);
|
||||
}
|
||||
|
||||
void CacheExitTimeForms(randomizer::logic::world::WorldPool& worlds)
|
||||
void CacheExitTimeForms(world::WorldPool& worlds)
|
||||
{
|
||||
auto completeItemPool = randomizer::logic::item_pool::GetCompleteItemPool(worlds);
|
||||
auto searchWithItems = randomizer::logic::search::Search::AllLocationsReachable(&worlds, completeItemPool);
|
||||
auto completeItemPool = item_pool::GetCompleteItemPool(worlds);
|
||||
auto searchWithItems = search::Search::AllLocationsReachable(&worlds, completeItemPool);
|
||||
searchWithItems.SearchWorlds();
|
||||
|
||||
for (auto& world : worlds)
|
||||
@@ -510,11 +510,11 @@ namespace randomizer::logic::fill
|
||||
for (const auto& exit : area->GetExits())
|
||||
{
|
||||
auto req = exit->GetRequirement();
|
||||
exitTimeFormCache[exit] = randomizer::logic::requirement::FormTime::NONE;
|
||||
for (const auto& formTime : randomizer::logic::requirement::FormTime::ALL_FORM_TIMES)
|
||||
exitTimeFormCache[exit] = requirement::FormTime::NONE;
|
||||
for (const auto& formTime : requirement::FormTime::ALL_FORM_TIMES)
|
||||
{
|
||||
if (formTime & areaFormTimes &&
|
||||
randomizer::logic::requirement::EvaluateRequirementAtFormTime(req,
|
||||
requirement::EvaluateRequirementAtFormTime(req,
|
||||
&searchWithItems,
|
||||
formTime,
|
||||
world.get()))
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
namespace randomizer::logic::fill
|
||||
{
|
||||
|
||||
void FillWorlds(randomizer::logic::world::WorldPool& worlds);
|
||||
void FillWorlds(world::WorldPool& worlds);
|
||||
|
||||
/**
|
||||
* @brief Assumed fill is an algorithm which statistically places items more
|
||||
@@ -22,10 +22,10 @@ namespace randomizer::logic::fill
|
||||
* fill algorithm since we need to assume we have these items.
|
||||
* @param allowedLocations Locations where items in itemsToPlacePool are allowed to be filled.
|
||||
*/
|
||||
void AssumedFill(randomizer::logic::world::WorldPool& worlds,
|
||||
randomizer::logic::item_pool::ItemPool& itemsToPlacePool,
|
||||
const randomizer::logic::item_pool::ItemPool& itemsNotYetPlaced,
|
||||
randomizer::logic::location::LocationPool allowedLocations,
|
||||
void AssumedFill(world::WorldPool& worlds,
|
||||
item_pool::ItemPool& itemsToPlacePool,
|
||||
const item_pool::ItemPool& itemsNotYetPlaced,
|
||||
location::LocationPool allowedLocations,
|
||||
const int& worldToFill = -1);
|
||||
|
||||
/**
|
||||
@@ -34,9 +34,9 @@ namespace randomizer::logic::fill
|
||||
* @param itemsToPlace The pool of items to place
|
||||
* @param allowedLocations The locations where the items can be placed
|
||||
*/
|
||||
void FastFill(randomizer::logic::item_pool::ItemPool& itemsToPlace, randomizer::logic::location::LocationPool allowedLocations);
|
||||
void FastFill(item_pool::ItemPool& itemsToPlace, location::LocationPool allowedLocations);
|
||||
|
||||
void PlaceRestrictedItems(std::unique_ptr<randomizer::logic::world::World>& world, randomizer::logic::world::WorldPool& worlds);
|
||||
void PlaceRestrictedItems(std::unique_ptr<world::World>& world, world::WorldPool& worlds);
|
||||
|
||||
/**
|
||||
* @brief If the prologue is not being skipped, place the sword and slingshot early on to prevent possible placement
|
||||
@@ -45,23 +45,23 @@ namespace randomizer::logic::fill
|
||||
* @param world The world to place the prologue items in
|
||||
* @param worlds All the worlds being generated
|
||||
*/
|
||||
void PlacePrologueItems(std::unique_ptr<randomizer::logic::world::World>& world, randomizer::logic::world::WorldPool& worlds);
|
||||
void PlacePrologueItems(std::unique_ptr<world::World>& world, world::WorldPool& worlds);
|
||||
|
||||
void PlaceGoalLocationItems(std::unique_ptr<randomizer::logic::world::World>& world, randomizer::logic::world::WorldPool& worlds);
|
||||
void PlaceGoalLocationItems(std::unique_ptr<world::World>& world, world::WorldPool& worlds);
|
||||
|
||||
void PlaceOwnDungeonItems(std::unique_ptr<randomizer::logic::world::World>& world, randomizer::logic::world::WorldPool& worlds);
|
||||
void PlaceOwnDungeonItems(std::unique_ptr<world::World>& world, world::WorldPool& worlds);
|
||||
|
||||
void PlaceAnywhereDungeonRewards(std::unique_ptr<randomizer::logic::world::World>& world,
|
||||
randomizer::logic::world::WorldPool& worlds);
|
||||
void PlaceAnywhereDungeonRewards(std::unique_ptr<world::World>& world,
|
||||
world::WorldPool& worlds);
|
||||
|
||||
void PlaceAnyDungeonItems(std::unique_ptr<randomizer::logic::world::World>& world, randomizer::logic::world::WorldPool& worlds);
|
||||
void PlaceAnyDungeonItems(std::unique_ptr<world::World>& world, world::WorldPool& worlds);
|
||||
|
||||
void PlaceOverworldItems(std::unique_ptr<randomizer::logic::world::World>& world, randomizer::logic::world::WorldPool& worlds);
|
||||
void PlaceOverworldItems(std::unique_ptr<world::World>& world, world::WorldPool& worlds);
|
||||
|
||||
/**
|
||||
* @brief Cache all the possible timeforms for each exit. This way, the search algorithm doesn't end up testing for
|
||||
* timeforms that we know ahead of time wouldn't be possible anyway
|
||||
* @param worlds The worlds to calculate and cache the possible timeforms for
|
||||
*/
|
||||
void CacheExitTimeForms(randomizer::logic::world::WorldPool& worlds);
|
||||
void CacheExitTimeForms(world::WorldPool& worlds);
|
||||
} // namespace randomizer::logic::fill
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace randomizer::logic::item
|
||||
|
||||
Item::Item(const int& id,
|
||||
const std::string& name,
|
||||
randomizer::logic::world::World* world,
|
||||
world::World* world,
|
||||
const Importance& importance,
|
||||
const bool& gameWinningItem,
|
||||
const bool& dungeonSmallKey,
|
||||
@@ -73,7 +73,7 @@ namespace randomizer::logic::item
|
||||
return this->_name;
|
||||
}
|
||||
|
||||
randomizer::logic::world::World* Item::GetWorld() const
|
||||
world::World* Item::GetWorld() const
|
||||
{
|
||||
return this->_world;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace randomizer::logic::item
|
||||
Item() = default;
|
||||
Item(const int& id,
|
||||
const std::string& name,
|
||||
randomizer::logic::world::World* world,
|
||||
world::World* world,
|
||||
const Importance& importance,
|
||||
const bool& gameWinningItem,
|
||||
const bool& dungeonSmallKey,
|
||||
@@ -37,7 +37,7 @@ namespace randomizer::logic::item
|
||||
|
||||
int GetID() const;
|
||||
std::string GetName() const;
|
||||
randomizer::logic::world::World* GetWorld() const;
|
||||
world::World* GetWorld() const;
|
||||
Importance GetImportance() const;
|
||||
bool IsMajor() const;
|
||||
bool IsMinor() const;
|
||||
@@ -59,7 +59,7 @@ namespace randomizer::logic::item
|
||||
private:
|
||||
int _id = -1;
|
||||
std::string _name;
|
||||
randomizer::logic::world::World* _world = nullptr;
|
||||
world::World* _world = nullptr;
|
||||
Importance _importance = INVALID;
|
||||
bool _gameWinningItem = false;
|
||||
std::list<Location*> _chainLocations;
|
||||
|
||||
@@ -210,7 +210,7 @@ namespace randomizer::logic::item_pool
|
||||
{"Purple Rupee", 12},
|
||||
};
|
||||
|
||||
void GenerateItemPool(randomizer::logic::world::World* world)
|
||||
void GenerateItemPool(world::World* world)
|
||||
{
|
||||
auto itemPool = minimalItemPool;
|
||||
|
||||
@@ -316,7 +316,7 @@ namespace randomizer::logic::item_pool
|
||||
}
|
||||
}
|
||||
|
||||
void GenerateStartingItemPool(randomizer::logic::world::World* world)
|
||||
void GenerateStartingItemPool(world::World* world)
|
||||
{
|
||||
auto startingItems = world->GetSettings().GetStartingInventory();
|
||||
auto& startingItemPool = world->GetStartingItemPool();
|
||||
@@ -369,7 +369,7 @@ namespace randomizer::logic::item_pool
|
||||
return initialJunkPool;
|
||||
}
|
||||
|
||||
ItemPool GetCompleteItemPool(randomizer::logic::world::WorldPool& worlds)
|
||||
ItemPool GetCompleteItemPool(world::WorldPool& worlds)
|
||||
{
|
||||
ItemPool completeItemPool = {};
|
||||
for (const auto& world : worlds)
|
||||
|
||||
@@ -19,14 +19,14 @@ namespace randomizer::logic::item
|
||||
|
||||
namespace randomizer::logic::item_pool
|
||||
{
|
||||
using ItemPool = std::vector<randomizer::logic::item::Item*>;
|
||||
using ItemPool = std::vector<item::Item*>;
|
||||
|
||||
/**
|
||||
* @brief Generates and sets the item pool of randomized items for a single world.
|
||||
*
|
||||
* @param world The world to generate the item pool for
|
||||
*/
|
||||
void GenerateItemPool(randomizer::logic::world::World* world);
|
||||
void GenerateItemPool(world::World* world);
|
||||
|
||||
/**
|
||||
* @brief Generates and sets the starting item pool for a single world. Starting items will be
|
||||
@@ -34,9 +34,9 @@ namespace randomizer::logic::item_pool
|
||||
*
|
||||
* @param world The world to generate the starting item pool for
|
||||
*/
|
||||
void GenerateStartingItemPool(randomizer::logic::world::World* world);
|
||||
void GenerateStartingItemPool(world::World* world);
|
||||
|
||||
std::map<std::string, int> GetInitialJunkPool();
|
||||
|
||||
ItemPool GetCompleteItemPool(randomizer::logic::world::WorldPool& worlds);
|
||||
ItemPool GetCompleteItemPool(world::WorldPool& worlds);
|
||||
} // namespace randomizer::logic::item_pool
|
||||
|
||||
@@ -8,8 +8,8 @@ namespace randomizer::logic::location
|
||||
Location::Location(const int& id,
|
||||
const std::string& name,
|
||||
std::unordered_set<std::string> categories,
|
||||
randomizer::logic::world::World* world,
|
||||
randomizer::logic::item::Item* originalItem,
|
||||
world::World* world,
|
||||
item::Item* originalItem,
|
||||
const bool& goalLocation,
|
||||
const std::string& hintPriority):
|
||||
_id(id),
|
||||
@@ -20,7 +20,7 @@ namespace randomizer::logic::location
|
||||
_goalLocation(goalLocation),
|
||||
_hintPriority(hintPriority)
|
||||
{
|
||||
this->_computedRequirement._type = randomizer::logic::requirement::Type::IMPOSSIBLE;
|
||||
this->_computedRequirement._type = requirement::Type::IMPOSSIBLE;
|
||||
}
|
||||
|
||||
int Location::GetID() const
|
||||
@@ -33,7 +33,7 @@ namespace randomizer::logic::location
|
||||
return this->_name;
|
||||
}
|
||||
|
||||
randomizer::logic::world::World* Location::GetWorld() const
|
||||
world::World* Location::GetWorld() const
|
||||
{
|
||||
return this->_world;
|
||||
}
|
||||
@@ -43,13 +43,13 @@ namespace randomizer::logic::location
|
||||
return this->_goalLocation;
|
||||
}
|
||||
|
||||
void Location::SetCurrentItem(randomizer::logic::item::Item* item)
|
||||
void Location::SetCurrentItem(item::Item* item)
|
||||
{
|
||||
LOG_TO_DEBUG("Placed " + item->GetName() + " at " + this->GetName());
|
||||
this->_currentItem = item;
|
||||
}
|
||||
|
||||
randomizer::logic::item::Item* Location::GetCurrentItem() const
|
||||
item::Item* Location::GetCurrentItem() const
|
||||
{
|
||||
return this->_currentItem;
|
||||
}
|
||||
@@ -57,20 +57,20 @@ namespace randomizer::logic::location
|
||||
void Location::RemoveCurrentItem()
|
||||
{
|
||||
LOG_TO_DEBUG("Removed " + this->GetCurrentItem()->GetName() + " at " + this->GetName());
|
||||
this->_currentItem = randomizer::logic::item::Nothing.get();
|
||||
this->_currentItem = item::Nothing.get();
|
||||
}
|
||||
|
||||
bool Location::IsEmpty() const
|
||||
{
|
||||
return this->_currentItem == randomizer::logic::item::Nothing.get();
|
||||
return this->_currentItem == item::Nothing.get();
|
||||
}
|
||||
|
||||
randomizer::logic::item::Item* Location::GetOriginalItem() const
|
||||
item::Item* Location::GetOriginalItem() const
|
||||
{
|
||||
return this->_originalItem;
|
||||
}
|
||||
|
||||
randomizer::logic::item::Item* Location::GetTrackedItem() const
|
||||
item::Item* Location::GetTrackedItem() const
|
||||
{
|
||||
return this->_trackedItem;
|
||||
}
|
||||
@@ -106,33 +106,33 @@ namespace randomizer::logic::location
|
||||
return this->_hinted;
|
||||
}
|
||||
|
||||
void Location::AddLocationAccess(randomizer::logic::area::LocationAccess* locAcc)
|
||||
void Location::AddLocationAccess(area::LocationAccess* locAcc)
|
||||
{
|
||||
this->_locationAccessList.push_back(locAcc);
|
||||
}
|
||||
|
||||
std::list<randomizer::logic::area::LocationAccess*> Location::GetAccessList() const
|
||||
std::list<area::LocationAccess*> Location::GetAccessList() const
|
||||
{
|
||||
return this->_locationAccessList;
|
||||
}
|
||||
|
||||
void Location::AddForbiddenItem(randomizer::logic::item::Item* forbiddenItem)
|
||||
void Location::AddForbiddenItem(item::Item* forbiddenItem)
|
||||
{
|
||||
this->_forbiddenItems.insert(forbiddenItem);
|
||||
LOG_TO_DEBUG(forbiddenItem->GetName() + " is forbidden from being placed at " + this->GetName());
|
||||
}
|
||||
|
||||
const std::unordered_set<randomizer::logic::item::Item*>& Location::GetForbiddenItems()
|
||||
const std::unordered_set<item::Item*>& Location::GetForbiddenItems()
|
||||
{
|
||||
return this->_forbiddenItems;
|
||||
}
|
||||
|
||||
void Location::SetComputedRequirement(const randomizer::logic::requirement::Requirement& computedRequirement)
|
||||
void Location::SetComputedRequirement(const requirement::Requirement& computedRequirement)
|
||||
{
|
||||
this->_computedRequirement = computedRequirement;
|
||||
}
|
||||
|
||||
randomizer::logic::requirement::Requirement Location::GetComputedRequirement()
|
||||
requirement::Requirement Location::GetComputedRequirement()
|
||||
{
|
||||
return this->_computedRequirement;
|
||||
}
|
||||
|
||||
@@ -25,33 +25,33 @@ namespace randomizer::logic::location
|
||||
Location(const int& id,
|
||||
const std::string& name,
|
||||
std::unordered_set<std::string> categories,
|
||||
randomizer::logic::world::World* world,
|
||||
randomizer::logic::item::Item* originalItem,
|
||||
world::World* world,
|
||||
item::Item* originalItem,
|
||||
const bool& goalLocation,
|
||||
const std::string& hintPriority);
|
||||
|
||||
int GetID() const;
|
||||
std::string GetName() const;
|
||||
randomizer::logic::world::World* GetWorld() const;
|
||||
world::World* GetWorld() const;
|
||||
bool IsGoalLocation() const;
|
||||
void SetCurrentItem(randomizer::logic::item::Item* currentItem);
|
||||
randomizer::logic::item::Item* GetCurrentItem() const;
|
||||
void SetCurrentItem(item::Item* currentItem);
|
||||
item::Item* GetCurrentItem() const;
|
||||
void RemoveCurrentItem();
|
||||
bool IsEmpty() const;
|
||||
randomizer::logic::item::Item* GetOriginalItem() const;
|
||||
randomizer::logic::item::Item* GetTrackedItem() const;
|
||||
item::Item* GetOriginalItem() const;
|
||||
item::Item* GetTrackedItem() const;
|
||||
void SetKnownVanillaItem(const bool& hasKnownVanillaItem);
|
||||
bool HasKnownVanillaItem() const;
|
||||
void SetProgression(const bool& progression);
|
||||
bool IsProgression() const;
|
||||
void SetHinted(const bool& hinted);
|
||||
bool IsHinted() const;
|
||||
void AddLocationAccess(randomizer::logic::area::LocationAccess* locAcc);
|
||||
std::list<randomizer::logic::area::LocationAccess*> GetAccessList() const;
|
||||
void AddForbiddenItem(randomizer::logic::item::Item* forbiddenItem);
|
||||
const std::unordered_set<randomizer::logic::item::Item*>& GetForbiddenItems();
|
||||
void SetComputedRequirement(const randomizer::logic::requirement::Requirement& computedRequirement);
|
||||
randomizer::logic::requirement::Requirement GetComputedRequirement();
|
||||
void AddLocationAccess(area::LocationAccess* locAcc);
|
||||
std::list<area::LocationAccess*> GetAccessList() const;
|
||||
void AddForbiddenItem(item::Item* forbiddenItem);
|
||||
const std::unordered_set<item::Item*>& GetForbiddenItems();
|
||||
void SetComputedRequirement(const requirement::Requirement& computedRequirement);
|
||||
requirement::Requirement GetComputedRequirement();
|
||||
void SetRegisteredLocationCategories(std::unordered_set<std::string>* registeredLocationCategories);
|
||||
|
||||
/**
|
||||
@@ -83,17 +83,17 @@ namespace randomizer::logic::location
|
||||
int _id = -1;
|
||||
std::string _name = "";
|
||||
std::unordered_set<std::string> _categories = {};
|
||||
randomizer::logic::world::World* _world;
|
||||
randomizer::logic::item::Item* _originalItem = randomizer::logic::item::Nothing.get();
|
||||
world::World* _world;
|
||||
item::Item* _originalItem = item::Nothing.get();
|
||||
bool _goalLocation = false;
|
||||
randomizer::logic::item::Item* _currentItem = randomizer::logic::item::Nothing.get();
|
||||
item::Item* _currentItem = item::Nothing.get();
|
||||
bool _hasKnownVanillaItem = false;
|
||||
std::list<randomizer::logic::area::LocationAccess*> _locationAccessList = {};
|
||||
std::list<area::LocationAccess*> _locationAccessList = {};
|
||||
bool _progression = true; // Set as false later if applicable
|
||||
bool _hinted = false;
|
||||
std::string _hintPriority = "Never";
|
||||
std::unordered_set<randomizer::logic::item::Item*> _forbiddenItems = {};
|
||||
randomizer::logic::requirement::Requirement _computedRequirement;
|
||||
std::unordered_set<item::Item*> _forbiddenItems = {};
|
||||
requirement::Requirement _computedRequirement;
|
||||
/**
|
||||
* @brief _registeredLocationCategories is the set of all categories that are processed after reading locations.yaml.
|
||||
* This structure is held in the World class and every location in that world has a pointer to it.
|
||||
@@ -102,7 +102,7 @@ namespace randomizer::logic::location
|
||||
std::unordered_set<std::string>* _registeredLocationCategories = nullptr;
|
||||
|
||||
// Potential tracker stuff
|
||||
randomizer::logic::item::Item* _trackedItem = randomizer::logic::item::Nothing.get();
|
||||
item::Item* _trackedItem = item::Nothing.get();
|
||||
};
|
||||
|
||||
using LocationPool = std::vector<Location*>;
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
|
||||
namespace randomizer::logic::plandomizer
|
||||
{
|
||||
void LoadPlandomizerData(randomizer::logic::world::WorldPool& worlds, const fspath& filepath, const bool& ignoreErrors /*false*/)
|
||||
void LoadPlandomizerData(world::WorldPool& worlds, const fspath& filepath, const bool& ignoreErrors /*false*/)
|
||||
{
|
||||
// Verify the file exists before trying to open it
|
||||
// TODO: TRY CATCH HERE
|
||||
randomizer::utility::file::Verify(filepath);
|
||||
utility::file::Verify(filepath);
|
||||
|
||||
auto plandoTree = LoadYAML(filepath);
|
||||
|
||||
|
||||
@@ -15,5 +15,5 @@ namespace randomizer::logic::world
|
||||
|
||||
namespace randomizer::logic::plandomizer
|
||||
{
|
||||
void LoadPlandomizerData(randomizer::logic::world::WorldPool& worlds, const fspath& filepath, const bool& ignoreErrors = false);
|
||||
void LoadPlandomizerData(world::WorldPool& worlds, const fspath& filepath, const bool& ignoreErrors = false);
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace randomizer::logic::requirement
|
||||
std::string Requirement::to_string() const
|
||||
{
|
||||
std::string reqStr = "";
|
||||
randomizer::logic::item::Item* item;
|
||||
item::Item* item;
|
||||
Requirement nestedReq;
|
||||
int count;
|
||||
int eventIndex;
|
||||
@@ -102,12 +102,12 @@ namespace randomizer::logic::requirement
|
||||
return reqStr;
|
||||
|
||||
case Type::ITEM:
|
||||
item = std::get<randomizer::logic::item::Item*>(this->_args[0]);
|
||||
item = std::get<item::Item*>(this->_args[0]);
|
||||
return item->GetName();
|
||||
|
||||
case Type::COUNT:
|
||||
count = std::get<int>(this->_args[0]);
|
||||
item = std::get<randomizer::logic::item::Item*>(this->_args[1]);
|
||||
item = std::get<item::Item*>(this->_args[1]);
|
||||
return "count(" + item->GetName() + ", " + std::to_string(count) + ")";
|
||||
|
||||
case Type::EVENT:
|
||||
@@ -152,7 +152,7 @@ namespace randomizer::logic::requirement
|
||||
}
|
||||
|
||||
Requirement ParseRequirementString(const std::string& reqStr,
|
||||
randomizer::logic::world::World* world,
|
||||
world::World* world,
|
||||
const bool& forceLogic /* = false */)
|
||||
{
|
||||
Requirement req;
|
||||
@@ -224,35 +224,35 @@ namespace randomizer::logic::requirement
|
||||
// First, see if we have nothing
|
||||
if (argStr == "Nothing")
|
||||
{
|
||||
req._type = randomizer::logic::requirement::Type::NOTHING;
|
||||
req._type = Type::NOTHING;
|
||||
return req;
|
||||
}
|
||||
|
||||
// Then Human Link...
|
||||
if (argStr == "Human Link")
|
||||
{
|
||||
req._type = randomizer::logic::requirement::Type::HUMAN_LINK;
|
||||
req._type = Type::HUMAN_LINK;
|
||||
return req;
|
||||
}
|
||||
|
||||
// Then Wolf Link...
|
||||
if (argStr == "Wolf Link")
|
||||
{
|
||||
req._type = randomizer::logic::requirement::Type::WOLF_LINK;
|
||||
req._type = Type::WOLF_LINK;
|
||||
return req;
|
||||
}
|
||||
|
||||
// Then Twilight...
|
||||
if (argStr == "Twilight")
|
||||
{
|
||||
req._type = randomizer::logic::requirement::Type::TWILIGHT;
|
||||
req._type = Type::TWILIGHT;
|
||||
return req;
|
||||
}
|
||||
|
||||
// Then an event...
|
||||
if (argStr[0] == '\'')
|
||||
{
|
||||
req._type = randomizer::logic::requirement::Type::EVENT;
|
||||
req._type = Type::EVENT;
|
||||
std::string eventName(argStr.begin() + 1, argStr.end() - 1); // Remove quotes
|
||||
int eventId = world->GetEventIndex(eventName);
|
||||
|
||||
@@ -266,7 +266,7 @@ namespace randomizer::logic::requirement
|
||||
// Then a macro...
|
||||
if (world->GetMacroIndex(argStr) != -1)
|
||||
{
|
||||
req._type = randomizer::logic::requirement::Type::MACRO;
|
||||
req._type = Type::MACRO;
|
||||
req._args.emplace_back(world->GetMacroIndex(argStr));
|
||||
return req;
|
||||
}
|
||||
@@ -275,18 +275,18 @@ namespace randomizer::logic::requirement
|
||||
if (world->GetItem(argStr, true) != nullptr)
|
||||
{
|
||||
auto item = world->GetItem(argStr);
|
||||
req._type = randomizer::logic::requirement::Type::ITEM;
|
||||
req._type = Type::ITEM;
|
||||
req._args.emplace_back(item);
|
||||
return req;
|
||||
}
|
||||
|
||||
// Then a setting...
|
||||
else if (randomizer::utility::str::Contains(argStr, "!=", "==", ">=", "<="))
|
||||
else if (utility::str::Contains(argStr, "!=", "==", ">=", "<="))
|
||||
{
|
||||
bool equalComparison = randomizer::utility::str::Contains(argStr, "==");
|
||||
bool notEqualComparison = randomizer::utility::str::Contains(argStr, "!=");
|
||||
bool gteComparison = randomizer::utility::str::Contains(argStr, ">=");
|
||||
bool lteComparison = randomizer::utility::str::Contains(argStr, "<=");
|
||||
bool equalComparison = utility::str::Contains(argStr, "==");
|
||||
bool notEqualComparison = utility::str::Contains(argStr, "!=");
|
||||
bool gteComparison = utility::str::Contains(argStr, ">=");
|
||||
bool lteComparison = utility::str::Contains(argStr, "<=");
|
||||
|
||||
// Split up the comparison using the second comparison character (which will always be '=')
|
||||
auto compPos = argStr.rfind('=');
|
||||
@@ -314,18 +314,18 @@ namespace randomizer::logic::requirement
|
||||
|
||||
if (result == true)
|
||||
{
|
||||
req._type = randomizer::logic::requirement::Type::NOTHING;
|
||||
req._type = Type::NOTHING;
|
||||
}
|
||||
else
|
||||
{
|
||||
req._type = randomizer::logic::requirement::Type::IMPOSSIBLE;
|
||||
req._type = Type::IMPOSSIBLE;
|
||||
}
|
||||
return req;
|
||||
}
|
||||
// Then a count...
|
||||
else if (argStr.find("count") != std::string::npos)
|
||||
{
|
||||
req._type = randomizer::logic::requirement::Type::COUNT;
|
||||
req._type = Type::COUNT;
|
||||
// Since a count has two arguments (a number and an item), we have
|
||||
// to split up the string in the parenthesis into those arguments.
|
||||
|
||||
@@ -363,21 +363,21 @@ namespace randomizer::logic::requirement
|
||||
// Then Day...
|
||||
if (argStr == "Day")
|
||||
{
|
||||
req._type = randomizer::logic::requirement::Type::DAY;
|
||||
req._type = Type::DAY;
|
||||
return req;
|
||||
}
|
||||
|
||||
// Then Night...
|
||||
if (argStr == "Night")
|
||||
{
|
||||
req._type = randomizer::logic::requirement::Type::NIGHT;
|
||||
req._type = Type::NIGHT;
|
||||
return req;
|
||||
}
|
||||
|
||||
// Then health
|
||||
else if (argStr.find("hearts") != std::string::npos)
|
||||
{
|
||||
req._type = randomizer::logic::requirement::Type::HEARTS;
|
||||
req._type = Type::HEARTS;
|
||||
std::string numHeartsStr(argStr.begin() + argStr.find('(') + 1, argStr.end() - 1);
|
||||
|
||||
// If the string for the count is a setting, use the settings current option instead
|
||||
@@ -394,14 +394,14 @@ namespace randomizer::logic::requirement
|
||||
// Then Impossible...
|
||||
else if (argStr == "Impossible")
|
||||
{
|
||||
req._type = randomizer::logic::requirement::Type::IMPOSSIBLE;
|
||||
req._type = Type::IMPOSSIBLE;
|
||||
return req;
|
||||
}
|
||||
|
||||
// Then golden bugs...
|
||||
else if (argStr.find("golden bugs") != std::string::npos)
|
||||
{
|
||||
req._type = randomizer::logic::requirement::Type::GOLDEN_BUGS;
|
||||
req._type = Type::GOLDEN_BUGS;
|
||||
// Get rid of parenthesis
|
||||
std::string countArg(argStr.begin() + argStr.find('(') + 1, argStr.end() - 1);
|
||||
int count = std::stoi(countArg);
|
||||
@@ -452,11 +452,11 @@ namespace randomizer::logic::requirement
|
||||
// Set the appropriate type
|
||||
if (andType)
|
||||
{
|
||||
req._type = randomizer::logic::requirement::Type::AND;
|
||||
req._type = Type::AND;
|
||||
}
|
||||
else
|
||||
{
|
||||
req._type = randomizer::logic::requirement::Type::OR;
|
||||
req._type = Type::OR;
|
||||
}
|
||||
|
||||
// Once we know the type, we can erase the "and"s or "or"s and are left with just the deeper
|
||||
@@ -478,7 +478,7 @@ namespace randomizer::logic::requirement
|
||||
}
|
||||
}
|
||||
|
||||
if (req._type != randomizer::logic::requirement::Type::INVALID)
|
||||
if (req._type != Type::INVALID)
|
||||
{
|
||||
return req;
|
||||
}
|
||||
@@ -487,11 +487,11 @@ namespace randomizer::logic::requirement
|
||||
return req;
|
||||
}
|
||||
|
||||
bool EvaluateSimpleRequirement(const randomizer::logic::requirement::Requirement& req, randomizer::logic::world::World* world)
|
||||
bool EvaluateSimpleRequirement(const Requirement& req, world::World* world)
|
||||
{
|
||||
randomizer::logic::item::Item* item;
|
||||
randomizer::logic::item::Item* heartPiece;
|
||||
randomizer::logic::item::Item* heartContainer;
|
||||
item::Item* item;
|
||||
item::Item* heartPiece;
|
||||
item::Item* heartContainer;
|
||||
int count;
|
||||
int macroIndex;
|
||||
switch (req._type)
|
||||
@@ -517,12 +517,12 @@ namespace randomizer::logic::requirement
|
||||
{ return EvaluateSimpleRequirement(std::get<Requirement>(arg), world); });
|
||||
|
||||
case Type::ITEM:
|
||||
item = std::get<randomizer::logic::item::Item*>(req._args[0]);
|
||||
item = std::get<item::Item*>(req._args[0]);
|
||||
return randomizer::utility::container::ElementInContainer(world->GetStartingItemPool(), item);
|
||||
|
||||
case Type::COUNT:
|
||||
count = std::get<int>(req._args[0]);
|
||||
item = std::get<randomizer::logic::item::Item*>(req._args[1]);
|
||||
item = std::get<item::Item*>(req._args[1]);
|
||||
return std::ranges::count(world->GetStartingItemPool(), item) >= count;
|
||||
|
||||
case Type::MACRO:
|
||||
@@ -546,14 +546,14 @@ namespace randomizer::logic::requirement
|
||||
return false;
|
||||
}
|
||||
|
||||
bool EvaluateRequirementAtFormTime(const randomizer::logic::requirement::Requirement& req,
|
||||
randomizer::logic::search::Search* search,
|
||||
bool EvaluateRequirementAtFormTime(const Requirement& req,
|
||||
search::Search* search,
|
||||
const int& formTime,
|
||||
randomizer::logic::world::World* world)
|
||||
world::World* world)
|
||||
{
|
||||
randomizer::logic::item::Item* item;
|
||||
randomizer::logic::item::Item* heartPiece;
|
||||
randomizer::logic::item::Item* heartContainer;
|
||||
item::Item* item;
|
||||
item::Item* heartPiece;
|
||||
item::Item* heartContainer;
|
||||
int count;
|
||||
int eventIndex;
|
||||
int macroIndex;
|
||||
@@ -580,12 +580,12 @@ namespace randomizer::logic::requirement
|
||||
{ return EvaluateRequirementAtFormTime(std::get<Requirement>(arg), search, formTime, world); });
|
||||
|
||||
case Type::ITEM:
|
||||
item = std::get<randomizer::logic::item::Item*>(req._args[0]);
|
||||
item = std::get<item::Item*>(req._args[0]);
|
||||
return search->_ownedItems.contains(item);
|
||||
|
||||
case Type::COUNT:
|
||||
count = std::get<int>(req._args[0]);
|
||||
item = std::get<randomizer::logic::item::Item*>(req._args[1]);
|
||||
item = std::get<item::Item*>(req._args[1]);
|
||||
return search->_ownedItems.count(item) >= count;
|
||||
|
||||
case Type::EVENT:
|
||||
@@ -653,7 +653,7 @@ namespace randomizer::logic::requirement
|
||||
return false;
|
||||
}
|
||||
|
||||
EvalSuccess EvaluateEventRequirement(randomizer::logic::search::Search* search, randomizer::logic::area::EventAccess* event)
|
||||
EvalSuccess EvaluateEventRequirement(search::Search* search, area::EventAccess* event)
|
||||
{
|
||||
auto& formTime = search->_areaFormTime[event->GetArea()];
|
||||
if (EvaluateRequirementAtFormTime(event->GetRequirement(), search, formTime, event->GetArea()->GetWorld()))
|
||||
@@ -663,7 +663,7 @@ namespace randomizer::logic::requirement
|
||||
return EvalSuccess::NONE;
|
||||
}
|
||||
|
||||
EvalSuccess EvaluateExitRequirement(randomizer::logic::search::Search* search, randomizer::logic::entrance::Entrance* exit)
|
||||
EvalSuccess EvaluateExitRequirement(search::Search* search, entrance::Entrance* exit)
|
||||
{
|
||||
// Some exits in the middle of entrance shuffling will not have a connected area. Ignore these
|
||||
if (exit->GetConnectedArea() == nullptr)
|
||||
@@ -755,7 +755,7 @@ namespace randomizer::logic::requirement
|
||||
return evalSuccess;
|
||||
}
|
||||
|
||||
EvalSuccess EvaluateDisconnectedExitRequiremrnt(randomizer::logic::search::Search* search, randomizer::logic::entrance::Entrance* exit)
|
||||
EvalSuccess EvaluateDisconnectedExitRequiremrnt(search::Search* search, entrance::Entrance* exit)
|
||||
{
|
||||
// If the exit is currently disabled, don't try it
|
||||
if (exit->IsDisabled())
|
||||
@@ -785,7 +785,7 @@ namespace randomizer::logic::requirement
|
||||
return EvalSuccess::NONE;
|
||||
}
|
||||
|
||||
EvalSuccess EvaluateLocationRequirement(randomizer::logic::search::Search* search, randomizer::logic::area::LocationAccess* locAccess)
|
||||
EvalSuccess EvaluateLocationRequirement(search::Search* search, area::LocationAccess* locAccess)
|
||||
{
|
||||
auto& formTime = search->_areaFormTime[locAccess->GetArea()];
|
||||
if (EvaluateRequirementAtFormTime(locAccess->GetRequirement(), search, formTime, locAccess->GetArea()->GetWorld()))
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace randomizer::logic::requirement
|
||||
struct Requirement;
|
||||
struct Requirement
|
||||
{
|
||||
using Argument = std::variant<int, Requirement, randomizer::logic::item::Item*>;
|
||||
using Argument = std::variant<int, Requirement, item::Item*>;
|
||||
Type _type = Type::INVALID;
|
||||
std::vector<Argument> _args;
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace randomizer::logic::requirement
|
||||
};
|
||||
|
||||
Requirement ParseRequirementString(const std::string& reqStr,
|
||||
randomizer::logic::world::World* world,
|
||||
world::World* world,
|
||||
const bool& forceLogic = false);
|
||||
|
||||
/**
|
||||
@@ -110,17 +110,17 @@ namespace randomizer::logic::requirement
|
||||
* @param req - The simple requirement
|
||||
* @return true if the requirment holds, false otherwise
|
||||
*/
|
||||
bool EvaluateSimpleRequirement(const randomizer::logic::requirement::Requirement& req, randomizer::logic::world::World* world);
|
||||
bool EvaluateSimpleRequirement(const Requirement& req, world::World* world);
|
||||
|
||||
bool EvaluateRequirementAtFormTime(const randomizer::logic::requirement::Requirement& req,
|
||||
randomizer::logic::search::Search* search,
|
||||
bool EvaluateRequirementAtFormTime(const Requirement& req,
|
||||
search::Search* search,
|
||||
const int& formTime,
|
||||
randomizer::logic::world::World*);
|
||||
EvalSuccess EvaluateEventRequirement(randomizer::logic::search::Search* search, randomizer::logic::area::EventAccess* event);
|
||||
EvalSuccess EvaluateExitRequirement(randomizer::logic::search::Search* search, randomizer::logic::entrance::Entrance* exit);
|
||||
EvalSuccess EvaluateDisconnectedExitRequiremrnt(randomizer::logic::search::Search* search, randomizer::logic::entrance::Entrance* exit);
|
||||
EvalSuccess EvaluateLocationRequirement(randomizer::logic::search::Search* search,
|
||||
randomizer::logic::area::LocationAccess* locAccess);
|
||||
world::World*);
|
||||
EvalSuccess EvaluateEventRequirement(search::Search* search, area::EventAccess* event);
|
||||
EvalSuccess EvaluateExitRequirement(search::Search* search, entrance::Entrance* exit);
|
||||
EvalSuccess EvaluateDisconnectedExitRequiremrnt(search::Search* search, entrance::Entrance* exit);
|
||||
EvalSuccess EvaluateLocationRequirement(search::Search* search,
|
||||
area::LocationAccess* locAccess);
|
||||
|
||||
const extern Requirement NO_REQUIREMENT;
|
||||
const extern Requirement IMPOSSIBLE_REQUIREMENT;
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
namespace randomizer::logic::search
|
||||
{
|
||||
Search::Search(const SearchMode& searchMode,
|
||||
randomizer::logic::world::WorldPool* worlds,
|
||||
const randomizer::logic::item_pool::ItemPool& items /* = {} */,
|
||||
world::WorldPool* worlds,
|
||||
const item_pool::ItemPool& items /* = {} */,
|
||||
const int& worldToSearch /* = -1 */):
|
||||
_searchMode(searchMode), _worlds(worlds)
|
||||
{
|
||||
@@ -50,7 +50,7 @@ namespace randomizer::logic::search
|
||||
void Search::SearchWorlds()
|
||||
{
|
||||
// Get all locations which fit criteria to test on each iteration
|
||||
std::list<randomizer::logic::area::LocationAccess*> itemLocations = {};
|
||||
std::list<area::LocationAccess*> itemLocations = {};
|
||||
for (const auto& world : *(this->_worlds))
|
||||
{
|
||||
for (const auto& [areaName, area] : world->GetAreaTable())
|
||||
@@ -59,7 +59,7 @@ namespace randomizer::logic::search
|
||||
{
|
||||
// Only add locations that aren't empty, unless we're searching with one of the modes below
|
||||
if (!locAccess->GetLocation()->IsEmpty() ||
|
||||
randomizer::utility::general::IsAnyOf(this->_searchMode,
|
||||
utility::general::IsAnyOf(this->_searchMode,
|
||||
SearchMode::ACCESSIBLE_LOCATIONS,
|
||||
SearchMode::ALL_LOCATIONS_REACHABLE,
|
||||
SearchMode::SPHERE_ZERO,
|
||||
@@ -78,7 +78,7 @@ namespace randomizer::logic::search
|
||||
while (
|
||||
this->_newThingsFound &&
|
||||
!(this->_isBeatable &&
|
||||
randomizer::utility::general::IsAnyOf(this->_searchMode, SearchMode::GENERATE_PLAYTHROUGH, SearchMode::GAME_BEATABLE)))
|
||||
utility::general::IsAnyOf(this->_searchMode, SearchMode::GENERATE_PLAYTHROUGH, SearchMode::GAME_BEATABLE)))
|
||||
{
|
||||
// Keep track of making logical progress. We want to keep iterating as long as we're finding new things on each
|
||||
// iteration
|
||||
@@ -120,8 +120,8 @@ namespace randomizer::logic::search
|
||||
continue;
|
||||
}
|
||||
|
||||
if (randomizer::logic::requirement::EvaluateEventRequirement(this, event) ==
|
||||
randomizer::logic::requirement::EvalSuccess::COMPLETE)
|
||||
if (requirement::EvaluateEventRequirement(this, event) ==
|
||||
requirement::EvalSuccess::COMPLETE)
|
||||
{
|
||||
this->_newThingsFound = true;
|
||||
this->_ownedEvents.insert(event->GetEventIndex());
|
||||
@@ -141,13 +141,13 @@ namespace randomizer::logic::search
|
||||
}
|
||||
|
||||
// If the exit is successful
|
||||
auto evalSuccess = randomizer::logic::requirement::EvaluateExitRequirement(this, exit);
|
||||
auto evalSuccess = requirement::EvaluateExitRequirement(this, exit);
|
||||
if (randomizer::utility::general::IsAnyOf(evalSuccess,
|
||||
randomizer::logic::requirement::EvalSuccess::COMPLETE,
|
||||
randomizer::logic::requirement::EvalSuccess::PARTIAL))
|
||||
requirement::EvalSuccess::COMPLETE,
|
||||
requirement::EvalSuccess::PARTIAL))
|
||||
{
|
||||
this->AddExitToEntranceSpheres(exit);
|
||||
if (evalSuccess == randomizer::logic::requirement::EvalSuccess::COMPLETE)
|
||||
if (evalSuccess == requirement::EvalSuccess::COMPLETE)
|
||||
{
|
||||
this->_successfulExits.insert(exit);
|
||||
}
|
||||
@@ -163,9 +163,9 @@ namespace randomizer::logic::search
|
||||
}
|
||||
}
|
||||
|
||||
void Search::ProcessLocations(std::list<randomizer::logic::area::LocationAccess*>& itemLocations)
|
||||
void Search::ProcessLocations(std::list<area::LocationAccess*>& itemLocations)
|
||||
{
|
||||
std::list<randomizer::logic::location::Location*> accessibleThisIteration = {};
|
||||
std::list<location::Location*> accessibleThisIteration = {};
|
||||
// Loop through all possible item locations for this search
|
||||
for (const auto& locAccess : itemLocations)
|
||||
{
|
||||
@@ -181,8 +181,8 @@ namespace randomizer::logic::search
|
||||
}
|
||||
|
||||
// If the location's requirement is met
|
||||
if (randomizer::logic::requirement::EvaluateLocationRequirement(this, locAccess) ==
|
||||
randomizer::logic::requirement::EvalSuccess::COMPLETE)
|
||||
if (requirement::EvaluateLocationRequirement(this, locAccess) ==
|
||||
requirement::EvalSuccess::COMPLETE)
|
||||
{
|
||||
this->_visitedLocations.insert(location);
|
||||
this->_newThingsFound = true;
|
||||
@@ -211,7 +211,7 @@ namespace randomizer::logic::search
|
||||
}
|
||||
}
|
||||
|
||||
void Search::ProcessLocation(randomizer::logic::location::Location* location)
|
||||
void Search::ProcessLocation(location::Location* location)
|
||||
{
|
||||
// Don't return if we aren't collecting items
|
||||
if (!this->_collectItems)
|
||||
@@ -272,7 +272,7 @@ namespace randomizer::logic::search
|
||||
}
|
||||
}
|
||||
|
||||
void Search::Explore(randomizer::logic::area::Area* area)
|
||||
void Search::Explore(area::Area* area)
|
||||
{
|
||||
for (const auto& event : area->GetEvents())
|
||||
{
|
||||
@@ -281,10 +281,10 @@ namespace randomizer::logic::search
|
||||
|
||||
for (const auto& exit : area->GetExits())
|
||||
{
|
||||
auto evalSuccess = randomizer::logic::requirement::EvaluateExitRequirement(this, exit);
|
||||
auto evalSuccess = requirement::EvaluateExitRequirement(this, exit);
|
||||
switch (evalSuccess)
|
||||
{
|
||||
case randomizer::logic::requirement::EvalSuccess::COMPLETE:
|
||||
case requirement::EvalSuccess::COMPLETE:
|
||||
this->_successfulExits.insert(exit);
|
||||
this->AddExitToEntranceSpheres(exit);
|
||||
if (!this->_visitedAreas.contains(exit->GetConnectedArea()))
|
||||
@@ -292,7 +292,7 @@ namespace randomizer::logic::search
|
||||
this->_visitedAreas.insert(exit->GetConnectedArea());
|
||||
this->Explore(exit->GetConnectedArea());
|
||||
}
|
||||
case randomizer::logic::requirement::EvalSuccess::PARTIAL:
|
||||
case requirement::EvalSuccess::PARTIAL:
|
||||
this->_exitsToTry.push_back(exit);
|
||||
this->AddExitToEntranceSpheres(exit);
|
||||
if (!this->_visitedAreas.contains(exit->GetConnectedArea()))
|
||||
@@ -300,17 +300,17 @@ namespace randomizer::logic::search
|
||||
this->_visitedAreas.insert(exit->GetConnectedArea());
|
||||
this->Explore(exit->GetConnectedArea());
|
||||
}
|
||||
case randomizer::logic::requirement::EvalSuccess::NONE:
|
||||
case requirement::EvalSuccess::NONE:
|
||||
[[fallthrough]];
|
||||
case randomizer::logic::requirement::EvalSuccess::DISCONNECTED:
|
||||
case requirement::EvalSuccess::DISCONNECTED:
|
||||
this->_exitsToTry.push_back(exit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Search::ExpandFormTimes(randomizer::logic::area::Area* area)
|
||||
void Search::ExpandFormTimes(area::Area* area)
|
||||
{
|
||||
using namespace randomizer::logic::requirement;
|
||||
using namespace requirement;
|
||||
|
||||
auto& areaFormTime = this->_areaFormTime[area];
|
||||
auto twilightCleared = area->TwilightCleared(this);
|
||||
@@ -353,7 +353,7 @@ namespace randomizer::logic::search
|
||||
}
|
||||
}
|
||||
|
||||
void Search::AddExitToEntranceSpheres(randomizer::logic::entrance::Entrance* exit)
|
||||
void Search::AddExitToEntranceSpheres(entrance::Entrance* exit)
|
||||
{
|
||||
if (randomizer::utility::general::IsAnyOf(this->_searchMode,
|
||||
SearchMode::GENERATE_PLAYTHROUGH,
|
||||
@@ -377,7 +377,7 @@ namespace randomizer::logic::search
|
||||
for (const auto& exit : this->_exitsToTry)
|
||||
{
|
||||
if (exit->GetConnectedArea() == nullptr &&
|
||||
randomizer::logic::requirement::EvaluateDisconnectedExitRequiremrnt(this, exit) != requirement::EvalSuccess::NONE)
|
||||
requirement::EvaluateDisconnectedExitRequiremrnt(this, exit) != requirement::EvalSuccess::NONE)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -421,23 +421,23 @@ namespace randomizer::logic::search
|
||||
auto color = this->_visitedAreas.contains(area.get()) ? "black" : "red";
|
||||
std::string formTimeStr = ":<br/>";
|
||||
auto& areaFormTime = this->_areaFormTime[area.get()];
|
||||
if (areaFormTime & randomizer::logic::requirement::FormTime::HUMAN)
|
||||
if (areaFormTime & requirement::FormTime::HUMAN)
|
||||
{
|
||||
formTimeStr += " Human";
|
||||
}
|
||||
if (areaFormTime & randomizer::logic::requirement::FormTime::WOLF)
|
||||
if (areaFormTime & requirement::FormTime::WOLF)
|
||||
{
|
||||
formTimeStr += " Wolf";
|
||||
}
|
||||
if (areaFormTime & randomizer::logic::requirement::FormTime::DAY)
|
||||
if (areaFormTime & requirement::FormTime::DAY)
|
||||
{
|
||||
formTimeStr += " Day";
|
||||
}
|
||||
if (areaFormTime & randomizer::logic::requirement::FormTime::NIGHT)
|
||||
if (areaFormTime & requirement::FormTime::NIGHT)
|
||||
{
|
||||
formTimeStr += " Night";
|
||||
}
|
||||
if (areaFormTime & randomizer::logic::requirement::FormTime::TWILIGHT)
|
||||
if (areaFormTime & requirement::FormTime::TWILIGHT)
|
||||
{
|
||||
formTimeStr += " Twilight";
|
||||
}
|
||||
@@ -482,8 +482,8 @@ namespace randomizer::logic::search
|
||||
worldGraph.close();
|
||||
}
|
||||
|
||||
std::optional<std::string> VerifyLogic(randomizer::logic::world::WorldPool* worlds,
|
||||
const randomizer::logic::item_pool::ItemPool& items /* = {} */)
|
||||
std::optional<std::string> VerifyLogic(world::WorldPool* worlds,
|
||||
const item_pool::ItemPool& items /* = {} */)
|
||||
{
|
||||
// Run an all locations reachable search
|
||||
auto search = Search::AllLocationsReachable(worlds, items);
|
||||
@@ -504,7 +504,7 @@ namespace randomizer::logic::search
|
||||
{
|
||||
std::string errorMsg = "Not all locations reachable! Missing locations:\n";
|
||||
// Gather all the missing locations
|
||||
std::vector<randomizer::logic::location::Location*> unreachedLocations = {};
|
||||
std::vector<location::Location*> unreachedLocations = {};
|
||||
for (const auto& location : allLocations)
|
||||
{
|
||||
if (!search._visitedLocations.contains(location))
|
||||
@@ -541,9 +541,9 @@ namespace randomizer::logic::search
|
||||
auto& playthroughSpheres = playthroughSearch._playthroughSpheres;
|
||||
|
||||
// Keep track of all locations we temporaily take items away from so we can give them back after playthrough calculation
|
||||
std::unordered_map<randomizer::logic::location::Location*, randomizer::logic::item::Item*> tempEmptyLocations = {};
|
||||
std::unordered_map<location::Location*, item::Item*> tempEmptyLocations = {};
|
||||
// Keep track of all the locations that appear in the playthrough
|
||||
std::unordered_set<randomizer::logic::location::Location*> playthroughLocationsSet = {};
|
||||
std::unordered_set<location::Location*> playthroughLocationsSet = {};
|
||||
for (const auto& sphere : playthroughSpheres)
|
||||
{
|
||||
for (const auto& location : sphere)
|
||||
@@ -597,7 +597,7 @@ namespace randomizer::logic::search
|
||||
|
||||
// Now do the same process for entrances to pare down the entrance playthrough
|
||||
auto& entranceSpheres = newSearch._entranceSpheres;
|
||||
std::unordered_map<randomizer::logic::entrance::Entrance*, randomizer::logic::area::Area*> nonRequiredEntrances = {};
|
||||
std::unordered_map<entrance::Entrance*, area::Area*> nonRequiredEntrances = {};
|
||||
|
||||
for (auto& sphere : entranceSpheres)
|
||||
{
|
||||
@@ -651,7 +651,7 @@ namespace randomizer::logic::search
|
||||
randomizer->GetEntranceSpheres() = newSearch._entranceSpheres;
|
||||
}
|
||||
|
||||
bool GameBeatable(randomizer::logic::world::WorldPool* worlds, const randomizer::logic::item_pool::ItemPool& items /* = {} */)
|
||||
bool GameBeatable(world::WorldPool* worlds, const item_pool::ItemPool& items /* = {} */)
|
||||
{
|
||||
auto search = Search::Beatable(worlds, items);
|
||||
search.SearchWorlds();
|
||||
|
||||
@@ -61,40 +61,40 @@ namespace randomizer::logic::search
|
||||
{
|
||||
public:
|
||||
Search(const SearchMode& searchMode,
|
||||
randomizer::logic::world::WorldPool* worlds,
|
||||
const randomizer::logic::item_pool::ItemPool& items = {},
|
||||
world::WorldPool* worlds,
|
||||
const item_pool::ItemPool& items = {},
|
||||
const int& worldToSearch = -1);
|
||||
|
||||
static auto Accessible(randomizer::logic::world::WorldPool* worlds,
|
||||
const randomizer::logic::item_pool::ItemPool& items = {},
|
||||
static auto Accessible(world::WorldPool* worlds,
|
||||
const item_pool::ItemPool& items = {},
|
||||
const int& worldToSearch = -1)
|
||||
{
|
||||
return Search(SearchMode::ACCESSIBLE_LOCATIONS, worlds, items, worldToSearch);
|
||||
}
|
||||
|
||||
static auto AllLocationsReachable(randomizer::logic::world::WorldPool* worlds,
|
||||
const randomizer::logic::item_pool::ItemPool& items = {},
|
||||
static auto AllLocationsReachable(world::WorldPool* worlds,
|
||||
const item_pool::ItemPool& items = {},
|
||||
const int& worldToSearch = -1)
|
||||
{
|
||||
return Search(SearchMode::ALL_LOCATIONS_REACHABLE, worlds, items, worldToSearch);
|
||||
}
|
||||
|
||||
static auto Playthrough(randomizer::logic::world::WorldPool* worlds,
|
||||
const randomizer::logic::item_pool::ItemPool& items = {},
|
||||
static auto Playthrough(world::WorldPool* worlds,
|
||||
const item_pool::ItemPool& items = {},
|
||||
const int& worldToSearch = -1)
|
||||
{
|
||||
return Search(SearchMode::GENERATE_PLAYTHROUGH, worlds, items, worldToSearch);
|
||||
}
|
||||
|
||||
static auto Beatable(randomizer::logic::world::WorldPool* worlds,
|
||||
const randomizer::logic::item_pool::ItemPool& items = {},
|
||||
static auto Beatable(world::WorldPool* worlds,
|
||||
const item_pool::ItemPool& items = {},
|
||||
const int& worldToSearch = -1)
|
||||
{
|
||||
return Search(SearchMode::GAME_BEATABLE, worlds, items, worldToSearch);
|
||||
}
|
||||
|
||||
static auto SphereZero(randomizer::logic::world::WorldPool* worlds,
|
||||
const randomizer::logic::item_pool::ItemPool& items = {},
|
||||
static auto SphereZero(world::WorldPool* worlds,
|
||||
const item_pool::ItemPool& items = {},
|
||||
const int& worldToSearch = -1)
|
||||
{
|
||||
return Search(SearchMode::SPHERE_ZERO, worlds, items, worldToSearch);
|
||||
@@ -109,12 +109,12 @@ namespace randomizer::logic::search
|
||||
*/
|
||||
void ProcessEvents();
|
||||
void ProcessExits();
|
||||
void ProcessLocations(std::list<randomizer::logic::area::LocationAccess*>& itemLocations);
|
||||
void ProcessLocation(randomizer::logic::location::Location* location);
|
||||
void Explore(randomizer::logic::area::Area* area);
|
||||
void ExpandFormTimes(randomizer::logic::area::Area* area);
|
||||
void ProcessLocations(std::list<area::LocationAccess*>& itemLocations);
|
||||
void ProcessLocation(location::Location* location);
|
||||
void Explore(area::Area* area);
|
||||
void ExpandFormTimes(area::Area* area);
|
||||
|
||||
void AddExitToEntranceSpheres(randomizer::logic::entrance::Entrance*);
|
||||
void AddExitToEntranceSpheres(entrance::Entrance*);
|
||||
bool HasAccessibleDisconnectedExit();
|
||||
void RemoveEmptySpheres();
|
||||
|
||||
@@ -127,7 +127,7 @@ namespace randomizer::logic::search
|
||||
void DumpWorldGraph(const int& world = 0);
|
||||
|
||||
SearchMode _searchMode;
|
||||
randomizer::logic::world::WorldPool* _worlds;
|
||||
world::WorldPool* _worlds;
|
||||
int _worldToSearch = -1;
|
||||
|
||||
// Search variables
|
||||
@@ -136,19 +136,19 @@ namespace randomizer::logic::search
|
||||
bool _isBeatable = false;
|
||||
bool _collectItems = true;
|
||||
std::unordered_set<int> _ownedEvents;
|
||||
std::unordered_multiset<randomizer::logic::item::Item*> _ownedItems;
|
||||
std::unordered_multiset<item::Item*> _ownedItems;
|
||||
|
||||
std::list<randomizer::logic::area::EventAccess*> _eventsToTry;
|
||||
std::list<randomizer::logic::entrance::Entrance*> _exitsToTry;
|
||||
std::unordered_set<randomizer::logic::location::Location*> _visitedLocations;
|
||||
std::unordered_set<randomizer::logic::area::Area*> _visitedAreas;
|
||||
std::unordered_set<randomizer::logic::entrance::Entrance*> _successfulExits;
|
||||
std::unordered_set<randomizer::logic::entrance::Entrance*> _playthroughEntrances;
|
||||
std::list<area::EventAccess*> _eventsToTry;
|
||||
std::list<entrance::Entrance*> _exitsToTry;
|
||||
std::unordered_set<location::Location*> _visitedLocations;
|
||||
std::unordered_set<area::Area*> _visitedAreas;
|
||||
std::unordered_set<entrance::Entrance*> _successfulExits;
|
||||
std::unordered_set<entrance::Entrance*> _playthroughEntrances;
|
||||
|
||||
std::list<std::list<randomizer::logic::location::Location*>> _playthroughSpheres;
|
||||
std::list<std::list<randomizer::logic::entrance::Entrance*>> _entranceSpheres;
|
||||
std::list<std::list<location::Location*>> _playthroughSpheres;
|
||||
std::list<std::list<entrance::Entrance*>> _entranceSpheres;
|
||||
|
||||
std::unordered_map<randomizer::logic::area::Area*, int> _areaFormTime;
|
||||
std::unordered_map<area::Area*, int> _areaFormTime;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -159,8 +159,8 @@ namespace randomizer::logic::search
|
||||
*
|
||||
* @return An optional value that holds a string explaining why the logic was not satisfied if validation failed
|
||||
*/
|
||||
std::optional<std::string> VerifyLogic(randomizer::logic::world::WorldPool* worlds,
|
||||
const randomizer::logic::item_pool::ItemPool& items = {});
|
||||
std::optional<std::string> VerifyLogic(world::WorldPool* worlds,
|
||||
const item_pool::ItemPool& items = {});
|
||||
void GeneratePlaythrough(randomizer::Randomizer* randomizer);
|
||||
bool GameBeatable(randomizer::logic::world::WorldPool* worlds, const randomizer::logic::item_pool::ItemPool& items = {});
|
||||
bool GameBeatable(world::WorldPool* worlds, const item_pool::ItemPool& items = {});
|
||||
} // namespace randomizer::logic::search
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
namespace randomizer::logic::spoiler_log
|
||||
{
|
||||
std::string SpoilerFormatLocation(randomizer::logic::location::Location* location, const size_t& longestNameLength)
|
||||
std::string SpoilerFormatLocation(location::Location* location, const size_t& longestNameLength)
|
||||
{
|
||||
auto numSpaces = longestNameLength - location->GetName().length();
|
||||
std::string spaces(numSpaces, ' ');
|
||||
@@ -20,7 +20,7 @@ namespace randomizer::logic::spoiler_log
|
||||
return location->GetName() + ": " + spaces + location->GetCurrentItem()->GetName();
|
||||
}
|
||||
|
||||
std::string SpoilerFormatEntrance(randomizer::logic::entrance::Entrance* entrance, const size_t& longestNameLength)
|
||||
std::string SpoilerFormatEntrance(entrance::Entrance* entrance, const size_t& longestNameLength)
|
||||
{
|
||||
auto numSpaces = longestNameLength - entrance->GetAlias().length();
|
||||
std::string spaces(numSpaces, ' ');
|
||||
@@ -29,7 +29,7 @@ namespace randomizer::logic::spoiler_log
|
||||
return entrance->GetAlias() + ": " + spaces + replacement->GetAliasFrom();
|
||||
}
|
||||
|
||||
void LogBasicInfo(std::ofstream& log, randomizer::Randomizer* randomizer)
|
||||
void LogBasicInfo(std::ofstream& log, Randomizer* randomizer)
|
||||
{
|
||||
log << "Dusk Randomizer Version: " << "1.0.0" << std::endl;
|
||||
log << "Seed: " << randomizer->GetConfig().GetSeed() << std::endl;
|
||||
@@ -39,7 +39,7 @@ namespace randomizer::logic::spoiler_log
|
||||
log << "Hash: " << randomizer->GetConfig().GetHash() << std::endl;
|
||||
}
|
||||
|
||||
void LogSettings(std::ofstream& log, randomizer::Randomizer* randomizer)
|
||||
void LogSettings(std::ofstream& log, Randomizer* randomizer)
|
||||
{
|
||||
log << std::endl << "# Settings" << std::endl;
|
||||
log << YAML::Dump(randomizer->GetConfig().SettingsToYaml()) << std::endl;
|
||||
@@ -65,7 +65,7 @@ namespace randomizer::logic::spoiler_log
|
||||
LogBasicInfo(spoilerLog, randomizer);
|
||||
|
||||
// Gather worlds with starting inventories
|
||||
std::list<randomizer::logic::world::World*> worldswithStartingInventories = {};
|
||||
std::list<world::World*> worldswithStartingInventories = {};
|
||||
for (const auto& world : worlds)
|
||||
{
|
||||
if (!world->GetStartingItemPool().empty())
|
||||
@@ -186,11 +186,11 @@ namespace randomizer::logic::spoiler_log
|
||||
{
|
||||
spoilerLog << " World " << world->GetID() << ":" << std::endl;
|
||||
// Create entrance pools to easily separate the entrances by type
|
||||
auto entrancePools = randomizer::logic::entrance_shuffle::CreateEntrancePools(world.get());
|
||||
auto entrancePools = entrance_shuffle::CreateEntrancePools(world.get());
|
||||
auto mixedPools = world->GetSettings().GetMixedEntrancePools();
|
||||
for (auto& [entranceType, entrancePool] : entrancePools)
|
||||
{
|
||||
auto typeStr = randomizer::logic::entrance::TypeToStr(entranceType);
|
||||
auto typeStr = entrance::TypeToStr(entranceType);
|
||||
// If this is a mixed pool, display the types it mixed
|
||||
if (typeStr.starts_with("Mixed Pool"))
|
||||
{
|
||||
@@ -211,7 +211,7 @@ namespace randomizer::logic::spoiler_log
|
||||
for (const auto& entrance : entrancePool)
|
||||
{
|
||||
// Ignore entrances that are impossible
|
||||
if (entrance->GetRequirement()._type == randomizer::logic::requirement::Type::IMPOSSIBLE)
|
||||
if (entrance->GetRequirement()._type == requirement::Type::IMPOSSIBLE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,6 @@ namespace randomizer
|
||||
|
||||
namespace randomizer::logic::spoiler_log
|
||||
{
|
||||
void GenerateSpoilerLog(randomizer::Randomizer* randomizer);
|
||||
void GenerateAntiSpoilerLog(randomizer::Randomizer* randomizer);
|
||||
void GenerateSpoilerLog(Randomizer* randomizer);
|
||||
void GenerateAntiSpoilerLog(Randomizer* randomizer);
|
||||
} // namespace randomizer::logic::spoiler_log
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
namespace randomizer::logic::world
|
||||
{
|
||||
World::World(const int& id, randomizer::Randomizer* randomizer) :
|
||||
World::World(const int& id, Randomizer* randomizer) :
|
||||
_id(id), _randomizer(randomizer)
|
||||
{}
|
||||
|
||||
@@ -26,11 +26,11 @@ namespace randomizer::logic::world
|
||||
{
|
||||
return this->_id;
|
||||
}
|
||||
void World::SetSettings(const randomizer::seedgen::settings::Settings& settings)
|
||||
void World::SetSettings(const seedgen::settings::Settings& settings)
|
||||
{
|
||||
_settings = settings;
|
||||
}
|
||||
const randomizer::seedgen::settings::Settings& World::GetSettings() const
|
||||
const seedgen::settings::Settings& World::GetSettings() const
|
||||
{
|
||||
return this->_settings;
|
||||
}
|
||||
@@ -103,8 +103,8 @@ namespace randomizer::logic::world
|
||||
auto id = itemNode["Id"].as<int>();
|
||||
auto name = itemNode["Name"].as<std::string>();
|
||||
auto importanceStr = itemNode["Importance"].as<std::string>();
|
||||
auto importance = randomizer::logic::item::ImportanceFromStr(importanceStr);
|
||||
if (importance == randomizer::logic::item::Importance::INVALID)
|
||||
auto importance = item::ImportanceFromStr(importanceStr);
|
||||
if (importance == item::Importance::INVALID)
|
||||
{
|
||||
throw std::runtime_error(std::string("Unknown importance \"") + importanceStr + "\" from item node:\n" +
|
||||
YAML::Dump(itemNode));
|
||||
@@ -120,7 +120,7 @@ namespace randomizer::logic::world
|
||||
auto dungeonMap = itemNode["Dungeon Map"].as<std::string>("");
|
||||
|
||||
// Make the item and insert it into the item table
|
||||
auto item = std::make_unique<randomizer::logic::item::Item>(id,
|
||||
auto item = std::make_unique<item::Item>(id,
|
||||
name,
|
||||
this,
|
||||
importance,
|
||||
@@ -198,7 +198,7 @@ namespace randomizer::logic::world
|
||||
auto goalLocation = locationNode["Goal Location"].as<bool>(false);
|
||||
auto hintPriority = locationNode["Hint Priority"].as<std::string>("Never");
|
||||
|
||||
auto location = std::make_unique<randomizer::logic::location::Location>(locationIdCounter++,
|
||||
auto location = std::make_unique<location::Location>(locationIdCounter++,
|
||||
name,
|
||||
categories,
|
||||
this,
|
||||
@@ -232,7 +232,7 @@ namespace randomizer::logic::world
|
||||
auto macroReqStr = macroNode.second.as<std::string>();
|
||||
|
||||
// Process the macro
|
||||
this->_macros[macroIdCounter] = randomizer::logic::requirement::ParseRequirementString(macroReqStr,
|
||||
this->_macros[macroIdCounter] = requirement::ParseRequirementString(macroReqStr,
|
||||
this,
|
||||
/*forceLogic = */ true);
|
||||
|
||||
@@ -381,19 +381,19 @@ namespace randomizer::logic::world
|
||||
}
|
||||
|
||||
// Lists of events, locations, and exits that we pass along to the area object
|
||||
std::list<std::unique_ptr<randomizer::logic::area::EventAccess>> events = {};
|
||||
std::list<std::unique_ptr<randomizer::logic::area::LocationAccess>> locations = {};
|
||||
std::list<std::unique_ptr<randomizer::logic::entrance::Entrance>> exits = {};
|
||||
std::list<std::unique_ptr<area::EventAccess>> events = {};
|
||||
std::list<std::unique_ptr<area::LocationAccess>> locations = {};
|
||||
std::list<std::unique_ptr<entrance::Entrance>> exits = {};
|
||||
|
||||
// Process events
|
||||
for (const auto& [eventName, eventReqStr] : eventNodes)
|
||||
{
|
||||
// Parse the requirement string
|
||||
auto eventReq = randomizer::logic::requirement::ParseRequirementString(eventReqStr, this);
|
||||
auto eventReq = requirement::ParseRequirementString(eventReqStr, this);
|
||||
|
||||
// Create the EventAccess wrapper and put it into the list of events for this area
|
||||
auto eventIndex = this->GetEventIndex(eventName);
|
||||
auto event = std::make_unique<randomizer::logic::area::EventAccess>(eventReq, area, eventIndex);
|
||||
auto event = std::make_unique<area::EventAccess>(eventReq, area, eventIndex);
|
||||
events.emplace_back(std::move(event));
|
||||
definedEvents.emplace(eventIndex);
|
||||
}
|
||||
@@ -424,11 +424,11 @@ namespace randomizer::logic::world
|
||||
}
|
||||
|
||||
// Parse the requirement string
|
||||
auto locationReq = randomizer::logic::requirement::ParseRequirementString(locationReqStr, this);
|
||||
auto locationReq = requirement::ParseRequirementString(locationReqStr, this);
|
||||
|
||||
// Create the LocationAccess wrapper and put it into the list of locations for this area
|
||||
|
||||
auto locationAccess = std::make_unique<randomizer::logic::area::LocationAccess>(location, locationReq, area);
|
||||
auto locationAccess = std::make_unique<area::LocationAccess>(location, locationReq, area);
|
||||
locations.emplace_back(std::move(locationAccess));
|
||||
|
||||
// Also add this LocationAccess to the locations list of access points
|
||||
@@ -447,11 +447,11 @@ namespace randomizer::logic::world
|
||||
auto connectedArea = this->GetArea(connectedAreaName, /*createIfNotFound = */ true);
|
||||
|
||||
// Parse the requirement string
|
||||
auto entranceReq = randomizer::logic::requirement::ParseRequirementString(entranceReqStr, this);
|
||||
auto entranceReq = requirement::ParseRequirementString(entranceReqStr, this);
|
||||
|
||||
// Create the Entrance object and put it into the list of exits for this area
|
||||
auto entrance =
|
||||
std::make_unique<randomizer::logic::entrance::Entrance>(area, connectedArea, entranceReq, this);
|
||||
std::make_unique<entrance::Entrance>(area, connectedArea, entranceReq, this);
|
||||
exits.emplace_back(std::move(entrance));
|
||||
}
|
||||
}
|
||||
@@ -492,15 +492,15 @@ namespace randomizer::logic::world
|
||||
|
||||
bool World::EvaluateSettingCondition(const std::string& condition)
|
||||
{
|
||||
auto req = randomizer::logic::requirement::ParseRequirementString(condition, this, true);
|
||||
auto req = requirement::ParseRequirementString(condition, this, true);
|
||||
return requirement::EvaluateSimpleRequirement(req, this);
|
||||
}
|
||||
|
||||
void World::GenerateItemPools()
|
||||
{
|
||||
LOG_TO_DEBUG("Now building item pools");
|
||||
randomizer::logic::item_pool::GenerateItemPool(this);
|
||||
randomizer::logic::item_pool::GenerateStartingItemPool(this);
|
||||
item_pool::GenerateItemPool(this);
|
||||
item_pool::GenerateStartingItemPool(this);
|
||||
|
||||
LOG_TO_DEBUG("Item Pool for world " + std::to_string(this->GetID()) + ":");
|
||||
for (const auto& item : this->_itemPool)
|
||||
@@ -689,7 +689,7 @@ namespace randomizer::logic::world
|
||||
|
||||
void World::AssignGoalLocations()
|
||||
{
|
||||
std::unordered_map<std::string, randomizer::logic::location::LocationPool> dungeonGoalLocations = {};
|
||||
std::unordered_map<std::string, location::LocationPool> dungeonGoalLocations = {};
|
||||
for (const auto& [dungeonName, dungeon] : this->_dungeons)
|
||||
{
|
||||
dungeonGoalLocations[dungeonName] = {};
|
||||
@@ -743,7 +743,7 @@ namespace randomizer::logic::world
|
||||
{ return !randomizer::utility::str::Contains(location->GetName(), "Heart Container", "Dungeon Reward"); });
|
||||
|
||||
// Gather all small key items
|
||||
randomizer::logic::item_pool::ItemPool smallKeys = {};
|
||||
item_pool::ItemPool smallKeys = {};
|
||||
for (const auto& [itemName, item] : this->_itemTable)
|
||||
{
|
||||
if (item->IsDungeonSmallKey() || randomizer::utility::general::IsAnyOf(itemName,
|
||||
@@ -788,8 +788,8 @@ namespace randomizer::logic::world
|
||||
|
||||
// Check if the game is beatable, set dungeon as required if so. If the dungeon is not required and barren
|
||||
// unrequired dungeons is on, then set all the locations in the unrequired dungeon as nonprogress.
|
||||
auto completeItemPool = randomizer::logic::item_pool::GetCompleteItemPool(this->_randomizer->GetWorlds());
|
||||
if (!randomizer::logic::search::GameBeatable(&(this->_randomizer->GetWorlds()), completeItemPool))
|
||||
auto completeItemPool = item_pool::GetCompleteItemPool(this->_randomizer->GetWorlds());
|
||||
if (!search::GameBeatable(&(this->_randomizer->GetWorlds()), completeItemPool))
|
||||
{
|
||||
dungeon->SetRequired(true);
|
||||
}
|
||||
@@ -811,7 +811,7 @@ namespace randomizer::logic::world
|
||||
|
||||
void World::SanitizeItemPool()
|
||||
{
|
||||
auto junkPool = randomizer::logic::item_pool::GetInitialJunkPool();
|
||||
auto junkPool = item_pool::GetInitialJunkPool();
|
||||
|
||||
// Depending on the Trap item Frequency setting, add some amount of ice traps to the pool
|
||||
if (this->Setting("Trap Item Frequency") == "Few")
|
||||
@@ -833,7 +833,7 @@ namespace randomizer::logic::world
|
||||
}
|
||||
|
||||
// Create an actual item pool from the junk items
|
||||
randomizer::logic::item_pool::ItemPool mainJunkPool = {};
|
||||
item_pool::ItemPool mainJunkPool = {};
|
||||
for (const auto& [itemName, count] : junkPool)
|
||||
{
|
||||
auto item = this->GetItem(itemName);
|
||||
@@ -855,7 +855,7 @@ namespace randomizer::logic::world
|
||||
// Add items until the pool's size matches the number of empty locations
|
||||
while (this->_itemPool.size() < numEmptyLocations)
|
||||
{
|
||||
randomizer::logic::item::Item* randomJunkItem;
|
||||
item::Item* randomJunkItem;
|
||||
if (!mainJunkPool.empty())
|
||||
{
|
||||
randomJunkItem = randomizer::utility::random::PopRandomElement(mainJunkPool);
|
||||
@@ -870,11 +870,11 @@ namespace randomizer::logic::world
|
||||
}
|
||||
}
|
||||
|
||||
void World::SetSearchStartingProperties(randomizer::logic::search::Search* search) const
|
||||
void World::SetSearchStartingProperties(search::Search* search) const
|
||||
{
|
||||
// Set the root area to have all player forms and times of day (necessary for entrance rando validation)
|
||||
auto root = this->GetRootArea();
|
||||
search->_areaFormTime[root] = randomizer::logic::requirement::FormTime::ALL;
|
||||
search->_areaFormTime[root] = requirement::FormTime::ALL;
|
||||
}
|
||||
|
||||
void World::PerformPostFillTasks()
|
||||
@@ -889,7 +889,7 @@ namespace randomizer::logic::world
|
||||
auto bottleWithHalfMilk = this->GetItem("Bottle with Half Milk");
|
||||
auto bottleWithLanternOil = this->GetItem("Bottle with Lantern Oil");
|
||||
auto emptyBottle = this->GetItem("Empty Bottle");
|
||||
randomizer::logic::item_pool::ItemPool bottlePool = {bottleWithGreatFairiesTears,
|
||||
item_pool::ItemPool bottlePool = {bottleWithGreatFairiesTears,
|
||||
bottleWithHalfMilk,
|
||||
bottleWithLanternOil,
|
||||
emptyBottle};
|
||||
@@ -910,7 +910,7 @@ namespace randomizer::logic::world
|
||||
else
|
||||
{
|
||||
// Gather the bottle locations
|
||||
randomizer::logic::location::LocationPool bottleLocations = {};
|
||||
location::LocationPool bottleLocations = {};
|
||||
for (auto& [locationName, location] : this->_locationTable)
|
||||
{
|
||||
auto originalItem = location->GetCurrentItem();
|
||||
@@ -929,7 +929,7 @@ namespace randomizer::logic::world
|
||||
}
|
||||
}
|
||||
|
||||
void World::AddPlandomizedLocation(randomizer::logic::location::Location* location, randomizer::logic::item::Item* item)
|
||||
void World::AddPlandomizedLocation(location::Location* location, item::Item* item)
|
||||
{
|
||||
if (this->_plandomizerLocations.contains(location))
|
||||
{
|
||||
@@ -939,7 +939,7 @@ namespace randomizer::logic::world
|
||||
this->_plandomizerLocations[location] = item;
|
||||
}
|
||||
|
||||
void World::AddPlandomizedEntrance(randomizer::logic::entrance::Entrance* entrance, randomizer::logic::entrance::Entrance* target)
|
||||
void World::AddPlandomizedEntrance(entrance::Entrance* entrance, entrance::Entrance* target)
|
||||
{
|
||||
for (const auto& [plandoEntrance, plandoTarget] : this->_plandomizerEntrances)
|
||||
{
|
||||
@@ -957,31 +957,31 @@ namespace randomizer::logic::world
|
||||
this->_plandomizerEntrances[entrance] = target;
|
||||
}
|
||||
|
||||
std::unordered_map<randomizer::logic::entrance::Entrance*, randomizer::logic::entrance::Entrance*> World::GetPlandomizerEntrances()
|
||||
std::unordered_map<entrance::Entrance*, entrance::Entrance*> World::GetPlandomizerEntrances()
|
||||
{
|
||||
return this->_plandomizerEntrances;
|
||||
}
|
||||
|
||||
randomizer::logic::dungeon::Dungeon* World::GetDungeon(const std::string& name)
|
||||
dungeon::Dungeon* World::GetDungeon(const std::string& name)
|
||||
{
|
||||
if (!this->_dungeons.contains(name))
|
||||
{
|
||||
this->_dungeons.emplace(name, std::make_unique<randomizer::logic::dungeon::Dungeon>(name, this));
|
||||
this->_dungeons.emplace(name, std::make_unique<dungeon::Dungeon>(name, this));
|
||||
LOG_TO_DEBUG("Added new dungeon \"" + name + "\" to world " + std::to_string(this->_id));
|
||||
}
|
||||
return this->_dungeons.at(name).get();
|
||||
}
|
||||
|
||||
const std::map<std::string, std::unique_ptr<randomizer::logic::dungeon::Dungeon>>& World::GetDungeonTable() const
|
||||
const std::map<std::string, std::unique_ptr<dungeon::Dungeon>>& World::GetDungeonTable() const
|
||||
{
|
||||
return this->_dungeons;
|
||||
}
|
||||
|
||||
randomizer::logic::item::Item* World::GetItem(const std::string& name, const bool& ignoreError /*= false*/)
|
||||
item::Item* World::GetItem(const std::string& name, const bool& ignoreError /*= false*/)
|
||||
{
|
||||
if (name == "Nothing")
|
||||
{
|
||||
return randomizer::logic::item::Nothing.get();
|
||||
return item::Nothing.get();
|
||||
}
|
||||
|
||||
if (!this->_itemTable.contains(name))
|
||||
@@ -995,27 +995,27 @@ namespace randomizer::logic::world
|
||||
return this->_itemTable.at(name).get();
|
||||
}
|
||||
|
||||
randomizer::logic::item::Item* World::GetGameWinningItem() const
|
||||
item::Item* World::GetGameWinningItem() const
|
||||
{
|
||||
return this->_itemTable.at("Game Beatable").get();
|
||||
}
|
||||
|
||||
randomizer::logic::item::Item* World::GetShadowCrystal()
|
||||
item::Item* World::GetShadowCrystal()
|
||||
{
|
||||
return this->_itemTable.at("Shadow Crystal").get();
|
||||
}
|
||||
|
||||
randomizer::logic::item_pool::ItemPool& World::GetItemPool()
|
||||
item_pool::ItemPool& World::GetItemPool()
|
||||
{
|
||||
return this->_itemPool;
|
||||
}
|
||||
|
||||
randomizer::logic::item_pool::ItemPool& World::GetStartingItemPool()
|
||||
item_pool::ItemPool& World::GetStartingItemPool()
|
||||
{
|
||||
return this->_startingItemPool;
|
||||
}
|
||||
|
||||
randomizer::logic::location::Location* World::GetLocation(const std::string& name)
|
||||
location::Location* World::GetLocation(const std::string& name)
|
||||
{
|
||||
if (!this->_locationTable.contains(name))
|
||||
{
|
||||
@@ -1024,9 +1024,9 @@ namespace randomizer::logic::world
|
||||
return this->_locationTable.at(name).get();
|
||||
}
|
||||
|
||||
randomizer::logic::location::LocationPool World::GetAllLocations(const bool& includeNonItemLocations /* = false */)
|
||||
location::LocationPool World::GetAllLocations(const bool& includeNonItemLocations /* = false */)
|
||||
{
|
||||
randomizer::logic::location::LocationPool locationPool = {};
|
||||
location::LocationPool locationPool = {};
|
||||
for (const auto& [locationName, location] : this->_locationTable)
|
||||
{
|
||||
if (includeNonItemLocations || !location->HasCategories("Non-Item Location"))
|
||||
@@ -1037,13 +1037,13 @@ namespace randomizer::logic::world
|
||||
return locationPool;
|
||||
}
|
||||
|
||||
randomizer::logic::area::Area* World::GetArea(const std::string& name, const bool& createIfNotFound /* = false */)
|
||||
area::Area* World::GetArea(const std::string& name, const bool& createIfNotFound /* = false */)
|
||||
{
|
||||
if (!this->_areaTable.contains(name))
|
||||
{
|
||||
if (createIfNotFound)
|
||||
{
|
||||
this->_areaTable.emplace(name, std::make_unique<randomizer::logic::area::Area>(name, this));
|
||||
this->_areaTable.emplace(name, std::make_unique<area::Area>(name, this));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1053,19 +1053,19 @@ namespace randomizer::logic::world
|
||||
return this->_areaTable.at(name).get();
|
||||
}
|
||||
|
||||
randomizer::logic::area::Area* World::GetRootArea() const
|
||||
area::Area* World::GetRootArea() const
|
||||
{
|
||||
return this->_areaTable.at("Root").get();
|
||||
}
|
||||
|
||||
const std::map<std::string, std::unique_ptr<randomizer::logic::area::Area>>& World::GetAreaTable() const
|
||||
const std::map<std::string, std::unique_ptr<area::Area>>& World::GetAreaTable() const
|
||||
{
|
||||
return this->_areaTable;
|
||||
}
|
||||
|
||||
randomizer::logic::entrance::Entrance* World::GetEntrance(const std::string& originalName)
|
||||
entrance::Entrance* World::GetEntrance(const std::string& originalName)
|
||||
{
|
||||
auto [parentAreaName, connectedAreaName] = randomizer::logic::entrance::GetParentAndConnectedAreaNames(originalName);
|
||||
auto [parentAreaName, connectedAreaName] = entrance::GetParentAndConnectedAreaNames(originalName);
|
||||
auto parentArea = this->GetArea(parentAreaName);
|
||||
auto connectedArea = this->GetArea(connectedAreaName);
|
||||
for (const auto& exit : parentArea->GetExits())
|
||||
@@ -1084,16 +1084,16 @@ namespace randomizer::logic::world
|
||||
return this->_entranceIdCounter++;
|
||||
}
|
||||
|
||||
randomizer::logic::entrance::EntrancePool World::GetShuffleableEntrances(const randomizer::logic::entrance::Type& type,
|
||||
entrance::EntrancePool World::GetShuffleableEntrances(const entrance::Type& type,
|
||||
const bool& onlyPrimary /* = false */)
|
||||
{
|
||||
randomizer::logic::entrance::EntrancePool shuffleableEntrances = {};
|
||||
entrance::EntrancePool shuffleableEntrances = {};
|
||||
for (const auto& [areaName, area] : this->GetAreaTable())
|
||||
{
|
||||
for (const auto& exit : area->GetExits())
|
||||
{
|
||||
if ((type == exit->GetType() || type == randomizer::logic::entrance::Type::ALL) &&
|
||||
(!onlyPrimary || exit->IsPrimary()) && exit->GetType() != randomizer::logic::entrance::Type::INVALID)
|
||||
if ((type == exit->GetType() || type == entrance::Type::ALL) &&
|
||||
(!onlyPrimary || exit->IsPrimary()) && exit->GetType() != entrance::Type::INVALID)
|
||||
{
|
||||
shuffleableEntrances.push_back(exit);
|
||||
}
|
||||
@@ -1102,8 +1102,8 @@ namespace randomizer::logic::world
|
||||
return shuffleableEntrances;
|
||||
}
|
||||
|
||||
randomizer::logic::entrance::EntrancePool World::GetShuffledEntrances(
|
||||
const randomizer::logic::entrance::Type& type /* = randomizer::logic::entrance::Type::ALL */,
|
||||
entrance::EntrancePool World::GetShuffledEntrances(
|
||||
const entrance::Type& type /* = entrance::Type::ALL */,
|
||||
const bool& onlyPrimary /* = false */)
|
||||
{
|
||||
auto entrances = this->GetShuffleableEntrances(type, onlyPrimary);
|
||||
@@ -1114,7 +1114,7 @@ namespace randomizer::logic::world
|
||||
return entrances;
|
||||
}
|
||||
|
||||
std::unordered_map<randomizer::logic::entrance::Entrance*, int>& World::GetExitTimeFormCache()
|
||||
std::unordered_map<entrance::Entrance*, int>& World::GetExitTimeFormCache()
|
||||
{
|
||||
return this->_exitTimeFormCache;
|
||||
}
|
||||
@@ -1128,7 +1128,7 @@ namespace randomizer::logic::world
|
||||
return -1;
|
||||
}
|
||||
|
||||
const randomizer::logic::requirement::Requirement& World::GetMacro(const int& macroIndex)
|
||||
const requirement::Requirement& World::GetMacro(const int& macroIndex)
|
||||
{
|
||||
return this->_macros.at(macroIndex);
|
||||
}
|
||||
|
||||
@@ -37,11 +37,11 @@ namespace randomizer::logic::world
|
||||
class World
|
||||
{
|
||||
public:
|
||||
World(const int& id, randomizer::Randomizer* randomizer);
|
||||
World(const int& id, Randomizer* randomizer);
|
||||
|
||||
int GetID() const;
|
||||
void SetSettings(const randomizer::seedgen::settings::Settings& settings);
|
||||
const randomizer::seedgen::settings::Settings& GetSettings() const;
|
||||
void SetSettings(const seedgen::settings::Settings& settings);
|
||||
const seedgen::settings::Settings& GetSettings() const;
|
||||
void SetRandomizer(Randomizer* randomizer);
|
||||
Randomizer* GetRandomizer() const;
|
||||
|
||||
@@ -106,63 +106,63 @@ namespace randomizer::logic::world
|
||||
* currently empty locations.
|
||||
*/
|
||||
void SanitizeItemPool();
|
||||
void SetSearchStartingProperties(randomizer::logic::search::Search* search) const;
|
||||
void SetSearchStartingProperties(search::Search* search) const;
|
||||
void PerformPostFillTasks();
|
||||
void FinalizeBottleContents();
|
||||
void AddPlandomizedLocation(randomizer::logic::location::Location* location, randomizer::logic::item::Item* item);
|
||||
void AddPlandomizedEntrance(randomizer::logic::entrance::Entrance* entrance, randomizer::logic::entrance::Entrance* target);
|
||||
std::unordered_map<randomizer::logic::entrance::Entrance*, randomizer::logic::entrance::Entrance*> GetPlandomizerEntrances();
|
||||
void AddPlandomizedLocation(location::Location* location, item::Item* item);
|
||||
void AddPlandomizedEntrance(entrance::Entrance* entrance, entrance::Entrance* target);
|
||||
std::unordered_map<entrance::Entrance*, entrance::Entrance*> GetPlandomizerEntrances();
|
||||
|
||||
randomizer::logic::dungeon::Dungeon* GetDungeon(const std::string& name);
|
||||
const std::map<std::string, std::unique_ptr<randomizer::logic::dungeon::Dungeon>>& GetDungeonTable() const;
|
||||
randomizer::logic::item::Item* GetItem(const std::string& name, const bool& ignoreError = false);
|
||||
randomizer::logic::item::Item* GetShadowCrystal();
|
||||
randomizer::logic::item::Item* GetGameWinningItem() const;
|
||||
randomizer::logic::item_pool::ItemPool& GetItemPool();
|
||||
randomizer::logic::item_pool::ItemPool& GetStartingItemPool();
|
||||
randomizer::logic::location::Location* GetLocation(const std::string& name);
|
||||
randomizer::logic::location::LocationPool GetAllLocations(const bool& includeNonItemLocations = false);
|
||||
randomizer::logic::area::Area* GetArea(const std::string& name, const bool& createIfNotFound = false);
|
||||
randomizer::logic::area::Area* GetRootArea() const;
|
||||
const std::map<std::string, std::unique_ptr<randomizer::logic::area::Area>>& GetAreaTable() const;
|
||||
randomizer::logic::entrance::Entrance* GetEntrance(const std::string& originalName);
|
||||
dungeon::Dungeon* GetDungeon(const std::string& name);
|
||||
const std::map<std::string, std::unique_ptr<dungeon::Dungeon>>& GetDungeonTable() const;
|
||||
item::Item* GetItem(const std::string& name, const bool& ignoreError = false);
|
||||
item::Item* GetShadowCrystal();
|
||||
item::Item* GetGameWinningItem() const;
|
||||
item_pool::ItemPool& GetItemPool();
|
||||
item_pool::ItemPool& GetStartingItemPool();
|
||||
location::Location* GetLocation(const std::string& name);
|
||||
location::LocationPool GetAllLocations(const bool& includeNonItemLocations = false);
|
||||
area::Area* GetArea(const std::string& name, const bool& createIfNotFound = false);
|
||||
area::Area* GetRootArea() const;
|
||||
const std::map<std::string, std::unique_ptr<area::Area>>& GetAreaTable() const;
|
||||
entrance::Entrance* GetEntrance(const std::string& originalName);
|
||||
int GetNewEntranceID();
|
||||
randomizer::logic::entrance::EntrancePool GetShuffleableEntrances(const randomizer::logic::entrance::Type& type,
|
||||
entrance::EntrancePool GetShuffleableEntrances(const entrance::Type& type,
|
||||
const bool& onlyPrimary = false);
|
||||
randomizer::logic::entrance::EntrancePool GetShuffledEntrances(
|
||||
const randomizer::logic::entrance::Type& type = randomizer::logic::entrance::Type::ALL,
|
||||
entrance::EntrancePool GetShuffledEntrances(
|
||||
const entrance::Type& type = entrance::Type::ALL,
|
||||
const bool& onlyPrimary = false);
|
||||
std::unordered_map<randomizer::logic::entrance::Entrance*, int>& GetExitTimeFormCache();
|
||||
std::unordered_map<entrance::Entrance*, int>& GetExitTimeFormCache();
|
||||
|
||||
int GetMacroIndex(const std::string& macroName) const;
|
||||
const randomizer::logic::requirement::Requirement& GetMacro(const int& macroIndex);
|
||||
const requirement::Requirement& GetMacro(const int& macroIndex);
|
||||
int GetEventIndex(const std::string& eventName, bool addIfNone = true);
|
||||
std::string GetEventName(const int& eventIndex);
|
||||
|
||||
randomizer::seedgen::settings::Setting& Setting(const std::string& settingName);
|
||||
seedgen::settings::Setting& Setting(const std::string& settingName);
|
||||
|
||||
private:
|
||||
int _id = -1;
|
||||
int _entranceIdCounter = 0;
|
||||
|
||||
randomizer::seedgen::settings::Settings _settings;
|
||||
std::map<std::string, std::unique_ptr<randomizer::logic::item::Item>> _itemTable = {};
|
||||
std::map<std::string, std::unique_ptr<randomizer::logic::location::Location>> _locationTable = {};
|
||||
seedgen::settings::Settings _settings;
|
||||
std::map<std::string, std::unique_ptr<item::Item>> _itemTable = {};
|
||||
std::map<std::string, std::unique_ptr<location::Location>> _locationTable = {};
|
||||
std::unordered_set<std::string> _intentionallyRemovedLocations = {};
|
||||
std::unordered_set<std::string> _registeredLocationCategories = {};
|
||||
std::map<std::string, std::unique_ptr<randomizer::logic::area::Area>> _areaTable = {};
|
||||
std::map<std::string, std::unique_ptr<randomizer::logic::dungeon::Dungeon>> _dungeons = {};
|
||||
std::map<int, randomizer::logic::requirement::Requirement> _macros = {};
|
||||
std::map<std::string, std::unique_ptr<area::Area>> _areaTable = {};
|
||||
std::map<std::string, std::unique_ptr<dungeon::Dungeon>> _dungeons = {};
|
||||
std::map<int, requirement::Requirement> _macros = {};
|
||||
std::unordered_map<std::string, int> _macroIndexes = {};
|
||||
std::unordered_map<std::string, int> _eventIndexes = {};
|
||||
std::unordered_map<int, std::string> _eventNames = {};
|
||||
randomizer::logic::item_pool::ItemPool _itemPool = {};
|
||||
randomizer::logic::item_pool::ItemPool _startingItemPool = {};
|
||||
std::unordered_map<randomizer::logic::entrance::Entrance*, int> _exitTimeFormCache = {};
|
||||
item_pool::ItemPool _itemPool = {};
|
||||
item_pool::ItemPool _startingItemPool = {};
|
||||
std::unordered_map<entrance::Entrance*, int> _exitTimeFormCache = {};
|
||||
|
||||
// Plandomizer Data
|
||||
std::unordered_map<randomizer::logic::location::Location*, randomizer::logic::item::Item*> _plandomizerLocations = {};
|
||||
std::unordered_map<randomizer::logic::entrance::Entrance*, randomizer::logic::entrance::Entrance*> _plandomizerEntrances = {};
|
||||
std::unordered_map<location::Location*, item::Item*> _plandomizerLocations = {};
|
||||
std::unordered_map<entrance::Entrance*, entrance::Entrance*> _plandomizerEntrances = {};
|
||||
|
||||
Randomizer* _randomizer = nullptr;
|
||||
};
|
||||
|
||||
@@ -48,11 +48,11 @@ namespace randomizer::seedgen::config
|
||||
preferencesFile.close();
|
||||
|
||||
this->_settingsList.clear();
|
||||
this->_settingsList.push_front(randomizer::seedgen::settings::Settings());
|
||||
this->_settingsList.push_front(settings::Settings());
|
||||
auto& settings = this->_settingsList.front();
|
||||
|
||||
// Load settings info
|
||||
auto settingInfoMap = randomizer::seedgen::settings::GetAllSettingsInfo();
|
||||
auto settingInfoMap = settings::GetAllSettingsInfo();
|
||||
|
||||
// Read in settings and preferences. If we have to change anything,
|
||||
// rewrite the appropriate file if allowed.
|
||||
@@ -79,7 +79,7 @@ namespace randomizer::seedgen::config
|
||||
rewriteSettings = true;
|
||||
}
|
||||
|
||||
settings.InsertSetting(settingName, randomizer::seedgen::settings::Setting(settingInfo.get(), settingOption));
|
||||
settings.InsertSetting(settingName, settings::Setting(settingInfo.get(), settingOption));
|
||||
}
|
||||
// Special handling for starting inventory
|
||||
else if (settingName == "Starting Inventory")
|
||||
@@ -122,7 +122,7 @@ namespace randomizer::seedgen::config
|
||||
// If seed is empty string, generate a new one
|
||||
if (this->_seed.empty())
|
||||
{
|
||||
this->_seed = randomizer::seedgen::seed::GenerateSeed();
|
||||
this->_seed = seed::GenerateSeed();
|
||||
}
|
||||
}
|
||||
// Special handling for Plandomizer
|
||||
@@ -156,7 +156,7 @@ namespace randomizer::seedgen::config
|
||||
}
|
||||
|
||||
settings.InsertSetting(preferenceName,
|
||||
randomizer::seedgen::settings::Setting(preferenceInfo.get(), preferenceOption));
|
||||
settings::Setting(preferenceInfo.get(), preferenceOption));
|
||||
}
|
||||
else if (preferenceName == "Game Base Path")
|
||||
{
|
||||
@@ -181,13 +181,13 @@ namespace randomizer::seedgen::config
|
||||
if (!settings.GetMap().contains(settingName))
|
||||
{
|
||||
settings.InsertSetting(settingName,
|
||||
randomizer::seedgen::settings::Setting(settingInfo.get(), settingInfo->GetDefaultOption()));
|
||||
settings::Setting(settingInfo.get(), settingInfo->GetDefaultOption()));
|
||||
randomizer::utility::platform::Log(std::string("Added missing setting \"") + settingName + "\"");
|
||||
if (settingInfo->GetType() == randomizer::seedgen::settings::Type::STANDARD)
|
||||
if (settingInfo->GetType() == settings::Type::STANDARD)
|
||||
{
|
||||
rewriteSettings = true;
|
||||
}
|
||||
else if (settingInfo->GetType() == randomizer::seedgen::settings::Type::PREFERENCE)
|
||||
else if (settingInfo->GetType() == settings::Type::PREFERENCE)
|
||||
{
|
||||
rewritePreferences = true;
|
||||
}
|
||||
@@ -195,7 +195,7 @@ namespace randomizer::seedgen::config
|
||||
}
|
||||
if (!settingsTree["Seed"])
|
||||
{
|
||||
this->_seed = randomizer::seedgen::seed::GenerateSeed();
|
||||
this->_seed = seed::GenerateSeed();
|
||||
randomizer::utility::platform::Log("Seed is missing. Generated new seed.");
|
||||
rewriteSettings = true;
|
||||
}
|
||||
@@ -244,7 +244,7 @@ namespace randomizer::seedgen::config
|
||||
for (const auto& settingName : sortedNames)
|
||||
{
|
||||
auto& setting = settings.GetMap().at(settingName);
|
||||
if (setting.GetInfo()->GetType() == randomizer::seedgen::settings::Type::STANDARD)
|
||||
if (setting.GetInfo()->GetType() == settings::Type::STANDARD)
|
||||
{
|
||||
out[settingName] = setting.GetCurrentOption();
|
||||
}
|
||||
@@ -288,7 +288,7 @@ namespace randomizer::seedgen::config
|
||||
out["Plandomizer Path"] = this->_plandomizerPath.generic_string();
|
||||
for (auto& [settingName, setting] : settings.GetMap())
|
||||
{
|
||||
if (setting.GetInfo()->GetType() == randomizer::seedgen::settings::Type::PREFERENCE)
|
||||
if (setting.GetInfo()->GetType() == settings::Type::PREFERENCE)
|
||||
{
|
||||
out[settingName] = setting.GetCurrentOption();
|
||||
}
|
||||
@@ -327,7 +327,7 @@ namespace randomizer::seedgen::config
|
||||
{
|
||||
if (this->_hash.empty())
|
||||
{
|
||||
this->_hash = randomizer::seedgen::seed::GenerateHash();
|
||||
this->_hash = seed::GenerateHash();
|
||||
}
|
||||
|
||||
return this->_hash;
|
||||
@@ -343,16 +343,16 @@ namespace randomizer::seedgen::config
|
||||
return 1;
|
||||
}
|
||||
|
||||
auto settingInfoMap = randomizer::seedgen::settings::GetAllSettingsInfo();
|
||||
auto settingInfoMap = settings::GetAllSettingsInfo();
|
||||
|
||||
YAML::Node root;
|
||||
root["Seed"] = randomizer::seedgen::seed::GenerateSeed();
|
||||
root["Seed"] = seed::GenerateSeed();
|
||||
root["Plandomizer"] = false;
|
||||
root["Generate Spoiler Log"] = true;
|
||||
// TODO: root["Permalink"] = randomizer::seedgen::permalink::GeneratePermalink();
|
||||
// TODO: root["Permalink"] = permalink::GeneratePermalink();
|
||||
for (const auto& [name, info] : *settingInfoMap)
|
||||
{
|
||||
if (info->GetType() == randomizer::seedgen::settings::Type::STANDARD)
|
||||
if (info->GetType() == settings::Type::STANDARD)
|
||||
{
|
||||
root[name] = info->GetDefaultOption();
|
||||
}
|
||||
@@ -377,7 +377,7 @@ namespace randomizer::seedgen::config
|
||||
return 1;
|
||||
}
|
||||
|
||||
auto settingInfoMap = randomizer::seedgen::settings::GetAllSettingsInfo();
|
||||
auto settingInfoMap = settings::GetAllSettingsInfo();
|
||||
|
||||
YAML::Node root;
|
||||
root["Game Base Path"] = "";
|
||||
@@ -385,7 +385,7 @@ namespace randomizer::seedgen::config
|
||||
root["Plandomizer Path"] = "";
|
||||
for (const auto& [name, info] : *settingInfoMap)
|
||||
{
|
||||
if (info->GetType() == randomizer::seedgen::settings::Type::PREFERENCE)
|
||||
if (info->GetType() == settings::Type::PREFERENCE)
|
||||
{
|
||||
root[name] = info->GetDefaultOption();
|
||||
}
|
||||
@@ -410,7 +410,7 @@ namespace randomizer::seedgen::config
|
||||
{
|
||||
for (auto& [settingName, setting] : settings.GetMap())
|
||||
{
|
||||
if (setting.GetInfo()->GetType() == randomizer::seedgen::settings::Type::STANDARD)
|
||||
if (setting.GetInfo()->GetType() == settings::Type::STANDARD)
|
||||
{
|
||||
hashStr += settingName + setting.GetCurrentOption();
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace randomizer::seedgen::config
|
||||
|
||||
std::string _seed;
|
||||
std::string _hash;
|
||||
std::list<randomizer::seedgen::settings::Settings> _settingsList;
|
||||
std::list<settings::Settings> _settingsList;
|
||||
bool _isUsingPlandomizer = false;
|
||||
bool _isGeneratingSpoilerLog = true;
|
||||
|
||||
|
||||
@@ -18,5 +18,5 @@ namespace randomizer::seedgen::seed
|
||||
*/
|
||||
std::string GenerateHash();
|
||||
|
||||
std::string HashForConfig(const randomizer::seedgen::config::Config& config);
|
||||
std::string HashForConfig(const config::Config& config);
|
||||
} // namespace randomizer::seedgen::seed
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace randomizer::utility::log
|
||||
class LogInfo
|
||||
{
|
||||
private:
|
||||
randomizer::seedgen::config::Config config;
|
||||
seedgen::config::Config config;
|
||||
std::string seedHash;
|
||||
|
||||
LogInfo();
|
||||
@@ -28,9 +28,9 @@ namespace randomizer::utility::log
|
||||
LogInfo(const LogInfo&) = delete;
|
||||
LogInfo& operator=(const LogInfo&) = delete;
|
||||
|
||||
static void setConfig(const randomizer::seedgen::config::Config& config_) { getInstance().config = config_; }
|
||||
static void setConfig(const seedgen::config::Config& config_) { getInstance().config = config_; }
|
||||
static void setSeedHash(const std::string& seedHash_) { getInstance().seedHash = seedHash_; }
|
||||
static const randomizer::seedgen::config::Config& getConfig();
|
||||
static const seedgen::config::Config& getConfig();
|
||||
static const std::string& getSeedHash();
|
||||
};
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include "yaml-cpp/yaml.h"
|
||||
|
||||
#include "../utility/file.hpp"
|
||||
#include "../utility/log.hpp"
|
||||
#include "../utility/path.hpp"
|
||||
|
||||
// this wrapper is here to avoid path encoding issues
|
||||
|
||||
Reference in New Issue
Block a user