Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/game/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2907,9 +2907,7 @@ ReturnValue Game::internalTeleport(const std::shared_ptr<Thing> &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()) {
Expand Down
8 changes: 4 additions & 4 deletions src/game/movement/teleport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ void Teleport::addThing(int32_t, const std::shared_ptr<Thing> &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);
Expand Down
7 changes: 7 additions & 0 deletions src/map/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,13 @@ void Map::moveCreature(const std::shared_ptr<Creature> &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*/) {
Expand Down