Skip to content

Commit

Permalink
Merge branch 'stable' of github.com:miki151/keeperrl into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
miki151 committed Apr 4, 2023
2 parents dbbb31c + 801e7ff commit 23a85a7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions furniture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,10 @@ bool Furniture::isStairs() const {
optional<Position> Furniture::getSecondPart(Position pos) const {
if (onBuilt)
if (auto dir = getStairDirection(*onBuilt)) {
int index = *pos.getModel()->getMainLevelDepth(pos.getLevel());
index = pos.getModel()->getMainLevelsDepth().clamp(index + *dir);
return Position(pos.getCoord(), pos.getModel()->getMainLevel(index));
int myIndex = *pos.getModel()->getMainLevelDepth(pos.getLevel());
int nextIndex = pos.getModel()->getMainLevelsDepth().clamp(myIndex + *dir);
if (nextIndex != myIndex)
return Position(pos.getCoord(), pos.getModel()->getMainLevel(nextIndex));
}
return none;
}
Expand Down

0 comments on commit 23a85a7

Please sign in to comment.