diff options
author | truelight <truelight@openttd.org> | 2005-03-29 19:10:13 +0000 |
---|---|---|
committer | truelight <truelight@openttd.org> | 2005-03-29 19:10:13 +0000 |
commit | 508738f836af7f5315ea14f8daa280d00cad2d10 (patch) | |
tree | 71c58f5741951475a3a1776a1833c7a13b621ba7 /network.c | |
parent | c68cfdeecaccbd3979e920ec424f98375e0f9e3d (diff) | |
download | openttd-508738f836af7f5315ea14f8daa280d00cad2d10.tar.xz |
(svn r2106) -Fix: improved the network-join algoritm, it is now a bit more stable
-Add: added 'pause_on_join' and 'max_join_time' for MP games, where you
can auto-pause the game when a client wants to join the game. This to
avoid connection losses because of big maps (200+ trains). (with tnx to
#openttdcoop for the ideas and testing)
Diffstat (limited to 'network.c')
-rw-r--r-- | network.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -4,6 +4,7 @@ #include "strings.h" #include "map.h" #include "network_data.h" +#include "command.h" #if defined(WITH_REV) extern const char _openttd_revision[]; @@ -466,6 +467,9 @@ static NetworkClientState *NetworkAllocClient(SOCKET s) cs->last_frame = 0; cs->quited = false; + cs->last_frame = _frame_counter; + cs->last_frame_server = _frame_counter; + if (_network_server) { ci = DEREF_CLIENT_INFO(cs); memset(ci, 0, sizeof(*ci)); @@ -511,6 +515,12 @@ void NetworkCloseClient(NetworkClientState *cs) SEND_COMMAND(PACKET_SERVER_ERROR_QUIT)(new_cs, cs->index, errorno); } } + + /* When the client was PRE_ACTIVE, the server was in pause mode, so unpause */ + if (cs->status == STATUS_PRE_ACTIVE && _network_pause_on_join) { + DoCommandP(0, 0, 0, NULL, CMD_PAUSE); + NetworkServer_HandleChat(NETWORK_ACTION_CHAT, DESTTYPE_BROADCAST, 0, "Game unpaused", NETWORK_SERVER_INDEX); + } } closesocket(cs->socket); |