diff options
author | Stijn Buys <ingar@osirion.org> | 2008-05-06 21:07:11 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-05-06 21:07:11 +0000 |
commit | 91d3a0352088611d3b78d3344b7a2bf2d4955a0a (patch) | |
tree | 74c0a6adf15ae15aa144f66f20272c1fd58a7db3 /src/core/netconnection.cc | |
parent | 8fefc1d995083f0d4a9873f216ccc6e15688d0a9 (diff) |
client-side frame interpolation: frames and timers
Diffstat (limited to 'src/core/netconnection.cc')
-rw-r--r-- | src/core/netconnection.cc | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/core/netconnection.cc b/src/core/netconnection.cc index dda339c..55480d2 100644 --- a/src/core/netconnection.cc +++ b/src/core/netconnection.cc @@ -267,6 +267,7 @@ void NetConnection::transmit() * msg public <name> <text> * die * ent + * frame * sup * pif */ @@ -305,6 +306,12 @@ void NetConnection::parse_incoming_message(const std::string & message) } else if (command == "ping") { + } else if (command == "frame") { + float timestamp; + if (msgstream >> timestamp) { + game()->reset_clientstate(timestamp); + } + } else if (command == "die") { unsigned int id; if (msgstream >> id) { @@ -339,14 +346,17 @@ void NetConnection::parse_incoming_message(const std::string & message) } } } else if (command == "sup") { - unsigned int id; - if (msgstream >> id) { - //con_debug << "Received update entity id " << id << std::endl; - Entity *entity = Entity::find(id); - if (!entity) { - con_warn << "Update for unknown entity " << id << std::endl; - } else - entity->recieve_server_update(msgstream); + if (connection_state == Connected) + { + unsigned int id; + if (msgstream >> id) { + //con_debug << "Received update entity id " << id << std::endl; + Entity *entity = Entity::find(id); + if (!entity) { + con_warn << "Update for unknown entity " << id << std::endl; + } else + entity->recieve_server_update(msgstream); + } } } else if (command == "pif") { |