diff --git a/src/game/game.cpp b/src/game/game.cpp index 49f8bf21d98..7445b28ea37 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -2907,9 +2907,7 @@ ReturnValue Game::internalTeleport(const std::shared_ptr &thing, const Po return ret; } - g_dispatcher().addWalkEvent([=] { - g_game().map.moveCreature(creature, toTile, !pushMove); - }); + map.moveCreature(creature, toTile, !pushMove); return RETURNVALUE_NOERROR; } else if (const auto &item = thing->getItem()) { diff --git a/src/game/movement/teleport.cpp b/src/game/movement/teleport.cpp index 935ec443617..368bcf6e476 100644 --- a/src/game/movement/teleport.cpp +++ b/src/game/movement/teleport.cpp @@ -93,11 +93,11 @@ void Teleport::addThing(int32_t, const std::shared_ptr &thing) { g_game().internalCreatureTurn(creature, origPos.x > destPos.x ? DIRECTION_WEST : DIRECTION_EAST); g_dispatcher().addWalkEvent([=] { g_game().map.moveCreature(creature, destTile); + if (effect != CONST_ME_NONE) { + g_game().addMagicEffect(origPos, effect); + g_game().addMagicEffect(destTile->getPosition(), effect); + } }); - if (effect != CONST_ME_NONE) { - g_game().addMagicEffect(origPos, effect); - g_game().addMagicEffect(destTile->getPosition(), effect); - } } else if (const auto &item = thing->getItem()) { if (effect != CONST_ME_NONE) { g_game().addMagicEffect(destTile->getPosition(), effect); diff --git a/src/map/map.cpp b/src/map/map.cpp index 768ba959dce..12770ad8b34 100644 --- a/src/map/map.cpp +++ b/src/map/map.cpp @@ -442,6 +442,13 @@ void Map::moveCreature(const std::shared_ptr &creature, const std::sha } else { events(); } + + if (forceTeleport) { + if (const auto &player = creature->getPlayer()) { + player->sendMagicEffect(oldPos, CONST_ME_TELEPORT); + player->sendMagicEffect(newPos, CONST_ME_TELEPORT); + } + } } bool Map::canThrowObjectTo(const Position &fromPos, const Position &toPos, const SightLines_t lineOfSight /*= SightLine_CheckSightLine*/, const int32_t rangex /*= Map::maxClientViewportX*/, const int32_t rangey /*= Map::maxClientViewportY*/) {