diff options
Diffstat (limited to 'src/game-server/state.cpp')
-rw-r--r-- | src/game-server/state.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/game-server/state.cpp b/src/game-server/state.cpp index 62e867aa..58949ce7 100644 --- a/src/game-server/state.cpp +++ b/src/game-server/state.cpp @@ -286,18 +286,25 @@ void State::update() case EVENT_WARP: { remove(o); - o->setMapId(e.map); Point pos = { e.x, e.y }; + o->setMapId(e.map); o->setPosition(pos); + + assert(o->getType() == OBJECT_PLAYER); + Player *p = static_cast< Player * >(o); + /* Force update of persistent data on map change, so that + players can respawn at the start of the map after a death or + a disconnection. */ + p->setMap(e.map); + p->setPos(pos); + accountHandler->sendPlayerData(p); + if (mapManager->isActive(e.map)) { insert(o); } else { - assert(o->getType() == OBJECT_PLAYER); - Player *p = static_cast< Player * >(o); - accountHandler->sendPlayerData(p); MessageOut msg(GAMSG_REDIRECT); msg.writeLong(p->getDatabaseID()); accountHandler->send(msg); |