diff --git a/furniture.cpp b/furniture.cpp index 90d893007..d0ced4095 100644 --- a/furniture.cpp +++ b/furniture.cpp @@ -363,9 +363,10 @@ bool Furniture::isStairs() const { optional 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; }