diff options
author | Stijn Buys <ingar@osirion.org> | 2009-01-10 15:35:45 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2009-01-10 15:35:45 +0000 |
commit | 44500292f5a964036e9d915a38a2773bf5aa765d (patch) | |
tree | 04e791247062a78b753017afad6d96e32a367900 /src/core/netserver.cc | |
parent | b8668c7a181ff082e5aeabffeaa413677da3e6f9 (diff) |
preliminary player ping support
Diffstat (limited to 'src/core/netserver.cc')
-rw-r--r-- | src/core/netserver.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/core/netserver.cc b/src/core/netserver.cc index b61ae1f..e6e85f8 100644 --- a/src/core/netserver.cc +++ b/src/core/netserver.cc @@ -398,8 +398,9 @@ void NetServer::frame(unsigned long timestamp) * frame <timestamp> <previous timestamp> * ent <id> <entity create data> * die <id> <entity data> + * ping <timestamp> * sup <entity update data> - + * * msg <channel> <text> * supported message channels are "info" "public" "rcon" and "snd" * "snd" is a special channel to transmit sound events @@ -590,6 +591,12 @@ void NetServer::parse_incoming_message(NetClient *client, const std::string & me } if (command == "ping") { + unsigned long timestamp; + if (msgstream >> timestamp) { + client->player()->set_ping(server()->timestamp() - timestamp); + } else { + client->player()->set_ping(-1); + } return; } |