(svn r20923) -Codechange: prepare creating sub-classes of NetworkClientSocket for server and client side

This commit is contained in:
rubidium
2010-10-15 13:22:00 +00:00
parent bff710650f
commit 594faf45d9
7 changed files with 73 additions and 42 deletions

View File

@@ -30,12 +30,40 @@
#include "../company_gui.h"
#include "../window_func.h"
#include "../roadveh.h"
#include "../order_backup.h"
#include "../rev.h"
#include "table/strings.h"
/* This file handles all the server-commands */
DECLARE_POSTFIX_INCREMENT(ClientID)
/** The identifier counter for new clients (is never decreased) */
static ClientID _network_client_id = CLIENT_ID_FIRST;
/**
* Create a new socket for the server side of the game connection.
* @param s The socket to connect with.
*/
ServerNetworkGameSocketHandler::ServerNetworkGameSocketHandler(SOCKET s) : NetworkGameSocketHandler(s)
{
this->client_id = _network_client_id++;
NetworkClientInfo *ci = new NetworkClientInfo(this->client_id);
this->SetInfo(ci);
ci->client_playas = COMPANY_INACTIVE_CLIENT;
ci->join_date = _date;
}
/**
* Clear everything related to this client.
*/
ServerNetworkGameSocketHandler::~ServerNetworkGameSocketHandler()
{
if (_redirect_console_to_client == this->client_id) _redirect_console_to_client = INVALID_CLIENT_ID;
OrderBackup::ResetUser(this->client_id);
}
static void NetworkHandleCommandQueue(NetworkClientSocket *cs);
/***********