forked from mirror/OpenTTD
(svn r8521) -Codechange: initial step in converting Packet to a class; make and use constructors and functions related to the reading/saving the packet size.
This commit is contained in:
@@ -738,18 +738,14 @@ static void NetworkAcceptClients(void)
|
||||
if (_network_ban_list[i] == NULL) continue;
|
||||
|
||||
if (sin.sin_addr.s_addr == inet_addr(_network_ban_list[i])) {
|
||||
Packet *p = NetworkSend_Init(PACKET_SERVER_BANNED);
|
||||
Packet p(PACKET_SERVER_BANNED);
|
||||
p.PrepareToSend();
|
||||
|
||||
DEBUG(net, 1, "Banned ip tried to join (%s), refused", _network_ban_list[i]);
|
||||
|
||||
p->buffer[0] = p->size & 0xFF;
|
||||
p->buffer[1] = p->size >> 8;
|
||||
|
||||
send(s, (const char*)p->buffer, p->size, 0);
|
||||
send(s, (const char*)p.buffer, p.size, 0);
|
||||
closesocket(s);
|
||||
|
||||
free(p);
|
||||
|
||||
banned = true;
|
||||
break;
|
||||
}
|
||||
@@ -761,16 +757,12 @@ static void NetworkAcceptClients(void)
|
||||
if (cs == NULL) {
|
||||
// no more clients allowed?
|
||||
// Send to the client that we are full!
|
||||
Packet *p = NetworkSend_Init(PACKET_SERVER_FULL);
|
||||
Packet p(PACKET_SERVER_FULL);
|
||||
p.PrepareToSend();
|
||||
|
||||
p->buffer[0] = p->size & 0xFF;
|
||||
p->buffer[1] = p->size >> 8;
|
||||
|
||||
send(s, (const char*)p->buffer, p->size, 0);
|
||||
send(s, (const char*)p.buffer, p.size, 0);
|
||||
closesocket(s);
|
||||
|
||||
free(p);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user