• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

C++ Fixing roof jump destination

  • Thread starter Thread starter Tinkz
  • Start date Start date
You should post this on github or where ever you downloaded the sources from so they are aware of the problem and can update the code.
 
Hello Tinkz,

look for "floorChange" on tile.cpp and check if the Position.x and Position.y are right (++, --).

Kindest Regards,
Okke
 

Thank you all for your help. I tried to change the code to look like yours. But still nothing happend.

This is how my code looks like right now.

C++:
ReturnValue Game::internalMoveCreature(Creature* creature, Direction direction, uint32_t flags /*= 0*/)
{
    creature->setLastPosition(creature->getPosition());
    const Position& currentPos = creature->getPosition();
    Position destPos = getNextPosition(direction, currentPos);
    Player* player = creature->getPlayer();
  
    bool diagonalMovement = (direction & DIRECTION_DIAGONAL_MASK) != 0;
    if (player && !diagonalMovement) {
        //try go up
        if (currentPos.z != 8 && creature->getTile()->hasHeight(3)) {
            Tile* tmpTile = map.getTile(currentPos.x, currentPos.y, currentPos.getZ() - 1);
            if (tmpTile == nullptr || (tmpTile->getGround() == nullptr && !tmpTile->hasFlag(TILESTATE_BLOCKSOLID))) {
                tmpTile = map.getTile(destPos.x, destPos.y, destPos.getZ() - 1);
                if (tmpTile && tmpTile->getGround() && !tmpTile->hasFlag(TILESTATE_BLOCKSOLID)) {
                    player->setDirection(direction);
                    destPos.z--;
                    internalCreatureTurn(creature, DIRECTION_NORTH);
                }
            }
        } else {
            //try go down
            Tile* tmpTile = map.getTile(destPos.x, destPos.y, destPos.z);
            if (currentPos.z != 7 && (tmpTile == nullptr || (tmpTile->getGround() == nullptr && !tmpTile->hasFlag(TILESTATE_BLOCKSOLID)))) {
                tmpTile = map.getTile(destPos.x, destPos.y, destPos.z + 1);
                if (tmpTile && tmpTile->hasHeight(3)) {
                    player->setDirection(direction);
                    destPos.z++;
                    internalCreatureTurn(creature, DIRECTION_SOUTH);
                }
            }
        }
    }
 
Back
Top