|
@@ -820,29 +820,24 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT
|
|
|
/* This is the frame the client receives
|
|
|
* we need it later on to make sure the client is not too slow */
|
|
|
cs->last_frame = _frame_counter;
|
|
|
cs->last_frame_server = _frame_counter;
|
|
|
|
|
|
FOR_ALL_CLIENT_SOCKETS(new_cs) {
|
|
|
if (new_cs->status > STATUS_AUTH) {
|
|
|
SEND_COMMAND(PACKET_SERVER_CLIENT_INFO)(new_cs, cs->GetInfo());
|
|
|
SEND_COMMAND(PACKET_SERVER_JOIN)(new_cs, cs->client_id);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (_settings_client.network.pause_on_join) {
|
|
|
/* Now pause the game till the client is in sync */
|
|
|
DoCommandP(0, PM_PAUSED_JOIN, 1, CMD_PAUSE);
|
|
|
}
|
|
|
|
|
|
/* also update the new client with our max values */
|
|
|
SEND_COMMAND(PACKET_SERVER_CONFIG_UPDATE)(cs);
|
|
|
|
|
|
/* quickly update the syncing client with company details */
|
|
|
SEND_COMMAND(PACKET_SERVER_COMPANY_UPDATE)(cs);
|
|
|
} else {
|
|
|
/* Wrong status for this packet, give a warning to client, and close connection */
|
|
|
SEND_COMMAND(PACKET_SERVER_ERROR)(cs, NETWORK_ERROR_NOT_EXPECTED);
|
|
|
}
|
|
|
return NETWORK_RECV_STATUS_OKAY;
|
|
|
}
|
|
|
|
|
@@ -1013,28 +1008,24 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT
|
|
|
}
|
|
|
|
|
|
uint32 frame = p->Recv_uint32();
|
|
|
|
|
|
/* The client is trying to catch up with the server */
|
|
|
if (cs->status == STATUS_PRE_ACTIVE) {
|
|
|
/* The client is not yet catched up? */
|
|
|
if (frame + DAY_TICKS < _frame_counter) return NETWORK_RECV_STATUS_OKAY;
|
|
|
|
|
|
/* Now he is! Unpause the game */
|
|
|
cs->status = STATUS_ACTIVE;
|
|
|
|
|
|
if (_pause_mode & PM_PAUSED_JOIN) {
|
|
|
DoCommandP(0, PM_PAUSED_JOIN, 0, CMD_PAUSE);
|
|
|
}
|
|
|
|
|
|
/* Execute script for, e.g. MOTD */
|
|
|
IConsoleCmdExec("exec scripts/on_server_connect.scr 0");
|
|
|
}
|
|
|
|
|
|
/* The client received the frame, make note of it */
|
|
|
cs->last_frame = frame;
|
|
|
/* With those 2 values we can calculate the lag realtime */
|
|
|
cs->last_frame_server = _frame_counter;
|
|
|
return NETWORK_RECV_STATUS_OKAY;
|
|
|
}
|
|
|
|
|
|
|