diff options
Diffstat (limited to 'src/game-server/state.cpp')
-rw-r--r-- | src/game-server/state.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/game-server/state.cpp b/src/game-server/state.cpp index 5ad0c579..1c4b38cc 100644 --- a/src/game-server/state.cpp +++ b/src/game-server/state.cpp @@ -165,7 +165,7 @@ static void serializeLooks(Character *ch, MessageOut &msg, bool full) /** * Informs a player of what happened around the character. */ -static void informPlayer(MapComposite *map, Character *p) +static void informPlayer(MapComposite *map, Character *p, int worldTime) { MessageOut moveMsg(GPMSG_BEINGS_MOVE); MessageOut damageMsg(GPMSG_BEINGS_DAMAGE); @@ -311,7 +311,11 @@ static void informPlayer(MapComposite *map, Character *p) if (opos != oold) { - flags |= MOVING_POSITION; + // Add position check coords every 5 seconds. + if (worldTime % 50 == 0) + flags |= MOVING_POSITION; + + flags |= MOVING_DESTINATION; } // Send move messages. @@ -319,6 +323,12 @@ static void informPlayer(MapComposite *map, Character *p) moveMsg.writeInt8(flags); if (flags & MOVING_POSITION) { + moveMsg.writeInt16(oold.x); + moveMsg.writeInt16(oold.y); + } + + if (flags & MOVING_DESTINATION) + { moveMsg.writeInt16(opos.x); moveMsg.writeInt16(opos.y); // We multiply the sent speed (in tiles per second) by ten @@ -460,7 +470,7 @@ void GameState::update(int worldTime) for (CharacterIterator p(map->getWholeMapIterator()); p; ++p) { - informPlayer(map, *p); + informPlayer(map, *p, worldTime); /* sending the whole character is overhead for the database, it should be replaced by a syncbuffer. see: game-server/accountconnection: |