Skip to content

Commit 23bc03e

Browse files
authored
Merge pull request #168 from SuperDude88/entrance-tweak
Remove Redundant Entrance Data
2 parents 7abb7b0 + 68a4677 commit 23bc03e

4 files changed

Lines changed: 6 additions & 21 deletions

File tree

logic/Entrance.cpp

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ Entrance::Entrance(Area* parentArea_, Area* connectedArea_, World* world_) :
1212
alreadySetOriginalConnectedArea(true),
1313
world(world_)
1414
{
15-
worldId = world->getWorldId();
1615
setOriginalName();
1716
requirement = Requirement();
1817
requirement.type = RequirementType::NOTHING;
@@ -197,16 +196,6 @@ bool Entrance::hasWindWarp() const
197196
return windWarp;
198197
}
199198

200-
int Entrance::getWorldId() const
201-
{
202-
return worldId;
203-
}
204-
205-
void Entrance::setWorldId(int& newWorldId)
206-
{
207-
worldId = newWorldId;
208-
}
209-
210199
Entrance* Entrance::getReverse()
211200
{
212201
return reverse;
@@ -346,9 +335,9 @@ Entrance* Entrance::assumeReachable()
346335

347336
bool Entrance::operator<(const Entrance& rhs) const
348337
{
349-
if (this->worldId != rhs.worldId)
338+
if (this->world->getWorldId() != rhs.world->getWorldId())
350339
{
351-
return this->worldId < rhs.worldId;
340+
return this->world->getWorldId() < rhs.world->getWorldId();
352341
}
353342

354343
return PointerLess<Area>{}(this->parentArea, rhs.parentArea);
@@ -516,4 +505,4 @@ std::string EntrancePath::to_string() const
516505
returnStr += entrance->getOriginalName() + "\n";
517506
}
518507
return returnStr;
519-
}
508+
}

logic/Entrance.hpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ class Entrance
6969
bool needsSavewarp() const;
7070
void setWindWarp(const bool& windWarp_);
7171
bool hasWindWarp() const;
72-
int getWorldId() const;
73-
void setWorldId(int& newWorldId);
7472
Entrance* getReverse();
7573
void setReverse(Entrance* reverseEntrance);
7674
Entrance* getReplaces();
@@ -120,7 +118,6 @@ class Entrance
120118
uint8_t spawnId = 0xFF;
121119
bool savewarp = false;
122120
bool windWarp = false;
123-
int worldId = -1;
124121
Entrance* reverse = nullptr;
125122
Entrance* replaces = nullptr;
126123
Entrance* assumed = nullptr;
@@ -166,4 +163,4 @@ struct EntrancePath {
166163

167164
bool isBetterThan(const EntrancePath& other, const std::string& curArea = "");
168165
std::string to_string() const;
169-
};
166+
};

logic/SpoilerLog.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ static std::string getSpoilerFormatEntrance(Entrance* entrance, const size_t& lo
1717
{
1818
// Print the world number if more than 1 world
1919
std::string worldNumber = " [W";
20-
worldNumber = worlds.size() > 1 ? worldNumber + std::to_string(entrance->getWorldId() + 1) + "]" : "";
20+
worldNumber = worlds.size() > 1 ? worldNumber + std::to_string(entrance->getWorld()->getWorldId() + 1) + "]" : "";
2121

2222
auto currentEntranceName = entrance->getOriginalName(true);
2323
// Add an extra space if the world id is only 1 digit
24-
size_t numSpaces = (longestEntranceLength - currentEntranceName.length()) + ((entrance->getWorldId() >= 9) ? 0 : 1);
24+
size_t numSpaces = (longestEntranceLength - currentEntranceName.length()) + ((entrance->getWorld()->getWorldId() >= 9) ? 0 : 1);
2525
std::string spaces (numSpaces, ' ');
2626

2727
auto replacement = entrance->getReplaces()->getOriginalName();

logic/World.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,6 @@ World::WorldLoadingError World::loadExit(const std::string& connectedArea, const
842842
AREA_VALID_CHECK(connectedArea, "Connected area of name \"" << connectedArea << "\" does not exist!");
843843
loadedExit.setParentArea(getArea(parentArea));
844844
loadedExit.setConnectedArea(getArea(connectedArea));
845-
loadedExit.setWorldId(worldId);
846845
loadedExit.setWorld(this);
847846
// load exit requirements
848847
if(const RequirementError err = parseRequirementString(logicExpression, loadedExit.getRequirement(), this); err != RequirementError::NONE)

0 commit comments

Comments
 (0)