Files
@ r12304:0c02bc720761
Branch filter:
Location: cpp/openttd-patchpack/source/src/network/core/tcp_game.cpp - annotation
r12304:0c02bc720761
1.9 KiB
text/x-c
(svn r16731) -Fix [NoAI]: AIDepotList contained wrong tiles for hangars when st->xy != st->airport_tile.
r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r11967:df0600d2c7e7 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r11967:df0600d2c7e7 r10746:38677d5ad005 r11967:df0600d2c7e7 r11967:df0600d2c7e7 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r12178:34138fe98654 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r12178:34138fe98654 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 r10746:38677d5ad005 | /* $Id$ */
/**
* @file tcp_game.cpp Basic functions to receive and send TCP packets for game purposes.
*/
#ifdef ENABLE_NETWORK
#include "../../stdafx.h"
#include "../../openttd.h"
#include "../../variables.h"
#include "../network_internal.h"
#include "packet.h"
#include "tcp_game.h"
#include "../../core/pool_func.hpp"
#include "table/strings.h"
/** Make very sure the preconditions given in network_type.h are actually followed */
assert_compile(MAX_CLIENT_SLOTS > MAX_CLIENTS);
assert_compile(NetworkClientSocketPool::MAX_SIZE == MAX_CLIENT_SLOTS);
NetworkClientSocketPool _networkclientsocket_pool("NetworkClientSocket");
INSTANTIATE_POOL_METHODS(NetworkClientSocket)
NetworkClientSocket::NetworkClientSocket(ClientID client_id)
{
this->client_id = client_id;
this->status = STATUS_INACTIVE;
}
NetworkClientSocket::~NetworkClientSocket()
{
while (this->command_queue != NULL) {
CommandPacket *p = this->command_queue->next;
free(this->command_queue);
this->command_queue = p;
}
this->client_id = INVALID_CLIENT_ID;
this->status = STATUS_INACTIVE;
}
/**
* Functions to help NetworkRecv_Packet/NetworkSend_Packet a bit
* A socket can make errors. When that happens this handles what to do.
* For clients: close connection and drop back to main-menu
* For servers: close connection and that is it
* @return the new status
* TODO: needs to be splitted when using client and server socket packets
*/
NetworkRecvStatus NetworkClientSocket::CloseConnection(bool error)
{
/* Clients drop back to the main menu */
if (!_network_server && _networking) {
_switch_mode = SM_MENU;
_networking = false;
extern StringID _switch_mode_errorstr;
_switch_mode_errorstr = STR_NETWORK_ERR_LOSTCONNECTION;
return NETWORK_RECV_STATUS_CONN_LOST;
}
NetworkCloseClient(this, error);
return NETWORK_RECV_STATUS_OKAY;
}
#endif /* ENABLE_NETWORK */
|