summaryrefslogtreecommitdiff
path: root/src/network/core
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-11-19 12:33:19 +0000
committerrubidium <rubidium@openttd.org>2010-11-19 12:33:19 +0000
commit6d09f4a3cbb0ebf40b568026f47220f01449857c (patch)
tree0ca0e51a2c1bcb9970f4118ef0e979574fc295bc /src/network/core
parent611a9f200785885a29447f4fd138220283a8dcd0 (diff)
downloadopenttd-6d09f4a3cbb0ebf40b568026f47220f01449857c.tar.xz
(svn r21254) -Change: show a different "lag" message when a client is lagging because of connection trouble or lagging because the client is just slow
Diffstat (limited to 'src/network/core')
-rw-r--r--src/network/core/tcp_game.cpp3
-rw-r--r--src/network/core/tcp_game.h1
2 files changed, 4 insertions, 0 deletions
diff --git a/src/network/core/tcp_game.cpp b/src/network/core/tcp_game.cpp
index 4f4baeb6b..3cf1a468b 100644
--- a/src/network/core/tcp_game.cpp
+++ b/src/network/core/tcp_game.cpp
@@ -30,6 +30,7 @@ NetworkGameSocketHandler::NetworkGameSocketHandler(SOCKET s)
this->sock = s;
this->last_frame = _frame_counter;
this->last_frame_server = _frame_counter;
+ this->last_packet = _realtime_tick;
}
/**
@@ -70,6 +71,8 @@ NetworkRecvStatus NetworkGameSocketHandler::HandlePacket(Packet *p)
{
PacketGameType type = (PacketGameType)p->Recv_uint8();
+ this->last_packet = _realtime_tick;
+
switch (this->HasClientQuit() ? PACKET_END : type) {
GAME_COMMAND(PACKET_SERVER_FULL)
GAME_COMMAND(PACKET_SERVER_BANNED)
diff --git a/src/network/core/tcp_game.h b/src/network/core/tcp_game.h
index a2e0226be..b4a6999cd 100644
--- a/src/network/core/tcp_game.h
+++ b/src/network/core/tcp_game.h
@@ -473,6 +473,7 @@ public:
uint32 last_frame; ///< Last frame we have executed
uint32 last_frame_server; ///< Last frame the server has executed
CommandQueue incoming_queue; ///< The command-queue awaiting handling
+ uint last_packet; ///< Time we received the last frame.
NetworkRecvStatus CloseConnection(bool error = true);
virtual NetworkRecvStatus CloseConnection(NetworkRecvStatus status) = 0;