Files
@ r27165:ea28ecab6159
Branch filter:
Location: cpp/openttd-patchpack/source/src/network/core/udp.h - annotation
r27165:ea28ecab6159
2.3 KiB
text/x-c
Fix: Clear church/stadium flags when copying house substitute specs.
r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r5475:3f5cd13d1b63 r17621:78f5210393b8 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r6121:a8ff6abe7fb2 r6121:a8ff6abe7fb2 r6121:a8ff6abe7fb2 r11545:27d3f758c0c0 r6121:a8ff6abe7fb2 r6121:a8ff6abe7fb2 r5475:3f5cd13d1b63 r5619:40c6c3e3d5f7 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r18737:1ee35da7fa2f r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 r5624:8f8d1f8d3a74 r5624:8f8d1f8d3a74 r5619:40c6c3e3d5f7 r11593:8dd431018ab1 r11593:8dd431018ab1 r11593:8dd431018ab1 r11593:8dd431018ab1 r11593:8dd431018ab1 r17621:78f5210393b8 r17621:78f5210393b8 r17621:78f5210393b8 r17621:78f5210393b8 r17621:78f5210393b8 r17621:78f5210393b8 r17621:78f5210393b8 r17621:78f5210393b8 r17621:78f5210393b8 r17621:78f5210393b8 r25804:399333b35219 r17621:78f5210393b8 r17621:78f5210393b8 r17621:78f5210393b8 r17621:78f5210393b8 r17621:78f5210393b8 r11545:27d3f758c0c0 r5619:40c6c3e3d5f7 r23607:36c15679007d r11593:8dd431018ab1 r5864:7aec8f5a81f1 r25458:3aaccd46b7fa r5619:40c6c3e3d5f7 r11593:8dd431018ab1 r25458:3aaccd46b7fa r5619:40c6c3e3d5f7 r11593:8dd431018ab1 r5619:40c6c3e3d5f7 r5619:40c6c3e3d5f7 r5475:3f5cd13d1b63 r5475:3f5cd13d1b63 | /*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file core/udp.h Basic functions to receive and send UDP packets.
*/
#ifndef NETWORK_CORE_UDP_H
#define NETWORK_CORE_UDP_H
#include "address.h"
#include "packet.h"
/** Enum with all types of UDP packets. The order MUST not be changed **/
enum PacketUDPType {
PACKET_UDP_CLIENT_FIND_SERVER, ///< Queries a game server for game information
PACKET_UDP_SERVER_RESPONSE, ///< Reply of the game server with game information
PACKET_UDP_END, ///< Must ALWAYS be on the end of this list!! (period)
};
/** Base socket handler for all UDP sockets */
class NetworkUDPSocketHandler : public NetworkSocketHandler {
protected:
/** The address to bind to. */
NetworkAddressList bind;
/** The opened sockets. */
SocketList sockets;
void ReceiveInvalidPacket(PacketUDPType, NetworkAddress *client_addr);
/**
* Queries to the server for information about the game.
* @param p The received packet.
* @param client_addr The origin of the packet.
*/
virtual void Receive_CLIENT_FIND_SERVER(Packet *p, NetworkAddress *client_addr);
/**
* Response to a query letting the client know we are here.
* @param p The received packet.
* @param client_addr The origin of the packet.
*/
virtual void Receive_SERVER_RESPONSE(Packet *p, NetworkAddress *client_addr);
void HandleUDPPacket(Packet *p, NetworkAddress *client_addr);
public:
NetworkUDPSocketHandler(NetworkAddressList *bind = nullptr);
/** On destructing of this class, the socket needs to be closed */
virtual ~NetworkUDPSocketHandler() { this->CloseSocket(); }
bool Listen();
void CloseSocket();
void SendPacket(Packet *p, NetworkAddress *recv, bool all = false, bool broadcast = false);
void ReceivePackets();
};
#endif /* NETWORK_CORE_UDP_H */
|