diff options
author | Stijn Buys <ingar@osirion.org> | 2008-03-16 14:51:37 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-03-16 14:51:37 +0000 |
commit | 7d7b9324f1f0db14648fb9fe32256d7942af77b9 (patch) | |
tree | ef2a60c275f22c6b1ab7430a299138597030b581 /src/core/netconnection.cc | |
parent | 9a7ca1743f0c74042bca4d4903f7e56fe810edce (diff) |
somewhat smoother network play, player assets, client pif updates
Diffstat (limited to 'src/core/netconnection.cc')
-rw-r--r-- | src/core/netconnection.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/core/netconnection.cc b/src/core/netconnection.cc index b87477b..9790655 100644 --- a/src/core/netconnection.cc +++ b/src/core/netconnection.cc @@ -116,6 +116,23 @@ void NetConnection::frame(float seconds) } } +void NetConnection::send(std::string const &msg) +{ + sendq.append(msg); +} + +void NetConnection::transmit() +{ + while (sendq.size() && valid() && !error()) { + TCPConnection::send(sendq.substr(0, net::FRAMESIZE-1)); + if (sendq.size() < net::FRAMESIZE) { + sendq.clear(); + } else { + sendq.erase(0, net::FRAMESIZE-1); + } + } +} + // parse incoming client messages /** * The following incoming messages are parsed; |