Remove: ENABLE_NETWORK switch
This switch has been a pain for years. Often disabling broke compilation, as no developer compiles OpenTTD without, neither do any of our official binaries. Additionaly, it has grown so hugely in our codebase, that it clearly shows that the current solution was a poor one. 350+ instances of "#ifdef ENABLE_NETWORK" were in the code, of which only ~30 in the networking code itself. The rest were all around the code to do the right thing, from GUI to NewGRF. A more proper solution would be to stub all the functions, and make sure the rest of the code can simply assume network is available. This was also partially done, and most variables were correct if networking was disabled. Despite that, often the #ifdefs were still used. With the recent removal of DOS, there is also no platform anymore which we support where networking isn't working out-of-the-box. All in all, it is time to remove the ENABLE_NETWORK switch. No replacement is planned, but if you feel we really need this option, we welcome any Pull Request which implements this in a way that doesn't crawl through the code like this diff shows we used to.
This commit is contained in:
@@ -11,8 +11,6 @@
|
||||
|
||||
#include "../../stdafx.h"
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
#include "address.h"
|
||||
#include "../../debug.h"
|
||||
|
||||
@@ -433,5 +431,3 @@ void NetworkAddress::Listen(int socktype, SocketList *sockets)
|
||||
default: return "unsupported";
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
@@ -17,8 +17,6 @@
|
||||
#include "../../string_func.h"
|
||||
#include "../../core/smallmap_type.hpp"
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
class NetworkAddress;
|
||||
typedef SmallVector<NetworkAddress, 4> NetworkAddressList; ///< Type for a list of addresses.
|
||||
typedef SmallMap<NetworkAddress, SOCKET, 4> SocketList; ///< Type for a mapping between address and socket.
|
||||
@@ -192,5 +190,4 @@ public:
|
||||
static const char *AddressFamilyAsString(int family);
|
||||
};
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
#endif /* NETWORK_CORE_ADDRESS_H */
|
||||
|
@@ -11,8 +11,6 @@
|
||||
* @file core.cpp Functions used to initialize/shut down the core network
|
||||
*/
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
#include "../../stdafx.h"
|
||||
#include "../../debug.h"
|
||||
#include "os_abstraction.h"
|
||||
@@ -80,5 +78,3 @@ void NetworkSocketHandler::ReceiveGRFIdentifier(Packet *p, GRFIdentifier *grf)
|
||||
grf->md5sum[j] = p->Recv_uint8();
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
@@ -17,8 +17,6 @@
|
||||
#include "../../newgrf_config.h"
|
||||
#include "config.h"
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
bool NetworkCoreInitialize();
|
||||
void NetworkCoreShutdown();
|
||||
|
||||
@@ -80,6 +78,4 @@ public:
|
||||
void SendCompanyInformation(Packet *p, const struct Company *c, const struct NetworkCompanyStats *stats, uint max_len = NETWORK_COMPANY_NAME_LENGTH);
|
||||
};
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
||||
#endif /* NETWORK_CORE_CORE_H */
|
||||
|
@@ -19,8 +19,6 @@
|
||||
#include "../../newgrf_config.h"
|
||||
#include "../../date_type.h"
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
/**
|
||||
* The game information that is not generated on-the-fly and has to
|
||||
* be sent to the clients.
|
||||
@@ -58,6 +56,4 @@ struct NetworkGameInfo : NetworkServerGameInfo {
|
||||
|
||||
const char * GetNetworkRevisionString();
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
||||
#endif /* NETWORK_CORE_GAME_H */
|
||||
|
@@ -9,8 +9,6 @@
|
||||
|
||||
/** @file host.cpp Functions related to getting host specific data (IPs). */
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
#include "../../stdafx.h"
|
||||
#include "../../debug.h"
|
||||
#include "address.h"
|
||||
@@ -207,5 +205,3 @@ void NetworkFindBroadcastIPs(NetworkAddressList *broadcast)
|
||||
DEBUG(net, 3, "%d) %s", i++, addr->GetHostname());
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
@@ -18,8 +18,6 @@
|
||||
|
||||
/* Include standard stuff per OS */
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
/* Windows stuff */
|
||||
#if defined(_WIN32)
|
||||
#include <errno.h>
|
||||
@@ -172,6 +170,4 @@ static inline bool SetNoDelay(SOCKET d)
|
||||
assert_compile(sizeof(in_addr) == 4); ///< IPv4 addresses should be 4 bytes.
|
||||
assert_compile(sizeof(in6_addr) == 16); ///< IPv6 addresses should be 16 bytes.
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
||||
#endif /* NETWORK_CORE_OS_ABSTRACTION_H */
|
||||
|
@@ -11,8 +11,6 @@
|
||||
* @file packet.cpp Basic functions to create, fill and read packets.
|
||||
*/
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
#include "../../stdafx.h"
|
||||
#include "../../string_func.h"
|
||||
|
||||
@@ -310,5 +308,3 @@ void Packet::Recv_string(char *buffer, size_t size, StringValidationSettings set
|
||||
|
||||
str_validate(bufp, last, settings);
|
||||
}
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
@@ -18,8 +18,6 @@
|
||||
#include "core.h"
|
||||
#include "../../string_type.h"
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
typedef uint16 PacketSize; ///< Size of the whole packet.
|
||||
typedef uint8 PacketType; ///< Identifier for the packet
|
||||
|
||||
@@ -87,6 +85,4 @@ public:
|
||||
void Recv_string(char *buffer, size_t size, StringValidationSettings settings = SVS_REPLACE_WITH_QUESTION_MARK);
|
||||
};
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
||||
#endif /* NETWORK_CORE_PACKET_H */
|
||||
|
@@ -11,8 +11,6 @@
|
||||
* @file tcp.cpp Basic functions to receive and send TCP packets.
|
||||
*/
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
#include "../../stdafx.h"
|
||||
#include "../../debug.h"
|
||||
|
||||
@@ -243,5 +241,3 @@ bool NetworkTCPSocketHandler::CanSendReceive()
|
||||
this->writable = !!FD_ISSET(this->sock, &write_fd);
|
||||
return FD_ISSET(this->sock, &read_fd) != 0;
|
||||
}
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
@@ -17,8 +17,6 @@
|
||||
#include "address.h"
|
||||
#include "packet.h"
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
/** The states of sending the packets. */
|
||||
enum SendPacketsState {
|
||||
SPS_CLOSED, ///< The connection got closed.
|
||||
@@ -99,6 +97,4 @@ public:
|
||||
static void KillAll();
|
||||
};
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
||||
#endif /* NETWORK_CORE_TCP_H */
|
||||
|
@@ -11,8 +11,6 @@
|
||||
* @file tcp_admin.cpp Basic functions to receive and send TCP packets to and from the admin network.
|
||||
*/
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
#include "../../stdafx.h"
|
||||
|
||||
#include "../network_internal.h"
|
||||
@@ -172,5 +170,3 @@ NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CMD_NAMES(Packet *p)
|
||||
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CMD_LOGGING(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CMD_LOGGING); }
|
||||
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_RCON_END(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_RCON_END); }
|
||||
NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_PONG(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_PONG); }
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
@@ -19,8 +19,6 @@
|
||||
#include "../network_type.h"
|
||||
#include "../../core/pool_type.hpp"
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
/**
|
||||
* Enum with types of TCP packets specific to the admin network.
|
||||
* This protocol may only be extended to ensure stability.
|
||||
@@ -500,6 +498,4 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
||||
#endif /* NETWORK_CORE_TCP_ADMIN_H */
|
||||
|
@@ -11,8 +11,6 @@
|
||||
* @file tcp_connect.cpp Basic functions to create connections without blocking.
|
||||
*/
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
#include "../../stdafx.h"
|
||||
#include "../../thread/thread.h"
|
||||
|
||||
@@ -97,5 +95,3 @@ void TCPConnecter::Connect()
|
||||
{
|
||||
for (TCPConnecter **iter = _tcp_connecters.Begin(); iter != _tcp_connecters.End(); iter++) (*iter)->killed = true;
|
||||
}
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
@@ -11,8 +11,6 @@
|
||||
* @file tcp_content.cpp Basic functions to receive and send Content packets.
|
||||
*/
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
#include "../../stdafx.h"
|
||||
#ifndef OPENTTD_MSU
|
||||
#include "../../textfile_gui.h"
|
||||
@@ -266,5 +264,3 @@ Subdirectory GetContentInfoSubDir(ContentType type)
|
||||
}
|
||||
}
|
||||
#endif /* OPENTTD_MSU */
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
@@ -19,8 +19,6 @@
|
||||
#include "packet.h"
|
||||
#include "../../debug.h"
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
/** The values in the enum are important; they are used as database 'keys' */
|
||||
enum ContentType {
|
||||
CONTENT_TYPE_BEGIN = 1, ///< Helper to mark the begin of the types
|
||||
@@ -213,6 +211,4 @@ public:
|
||||
Subdirectory GetContentInfoSubDir(ContentType type);
|
||||
#endif /* OPENTTD_MSU */
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
||||
#endif /* NETWORK_CORE_TCP_CONTENT_H */
|
||||
|
@@ -11,8 +11,6 @@
|
||||
* @file tcp_game.cpp Basic functions to receive and send TCP packets for game purposes.
|
||||
*/
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
#include "../../stdafx.h"
|
||||
|
||||
#include "../network.h"
|
||||
@@ -199,5 +197,3 @@ NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_MOVE(Packet *p) { ret
|
||||
NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_MOVE(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CLIENT_MOVE); }
|
||||
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_COMPANY_UPDATE(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_COMPANY_UPDATE); }
|
||||
NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_CONFIG_UPDATE(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_CONFIG_UPDATE); }
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
@@ -19,8 +19,6 @@
|
||||
#include "../network_type.h"
|
||||
#include "../../core/pool_type.hpp"
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
/**
|
||||
* Enum with all types of TCP packets.
|
||||
* For the exact meaning, look at #NetworkGameSocketHandler.
|
||||
@@ -558,6 +556,4 @@ public:
|
||||
void SendCommand(Packet *p, const CommandPacket *cp);
|
||||
};
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
||||
#endif /* NETWORK_CORE_TCP_GAME_H */
|
||||
|
@@ -11,8 +11,6 @@
|
||||
* @file tcp_http.cpp Basic functions to receive and send HTTP TCP packets.
|
||||
*/
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
#include "../../stdafx.h"
|
||||
#include "../../debug.h"
|
||||
#include "../../rev.h"
|
||||
@@ -331,5 +329,3 @@ int NetworkHTTPSocketHandler::Receive()
|
||||
iter++;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
@@ -16,8 +16,6 @@
|
||||
|
||||
#include "tcp.h"
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
/** Callback for when the HTTP handler has something to tell us. */
|
||||
struct HTTPCallback {
|
||||
/**
|
||||
@@ -122,6 +120,4 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
||||
#endif /* NETWORK_CORE_TCP_HTTP_H */
|
||||
|
@@ -20,8 +20,6 @@
|
||||
#include "../../debug.h"
|
||||
#include "table/strings.h"
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
/**
|
||||
* Template for TCP listeners.
|
||||
* @param Tsocket The class we create sockets for.
|
||||
@@ -173,6 +171,4 @@ public:
|
||||
|
||||
template <class Tsocket, PacketType Tfull_packet, PacketType Tban_packet> SocketList TCPListenHandler<Tsocket, Tfull_packet, Tban_packet>::sockets;
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
||||
#endif /* NETWORK_CORE_TCP_LISTEN_H */
|
||||
|
@@ -11,8 +11,6 @@
|
||||
* @file core/udp.cpp Basic functions to receive and send UDP packets.
|
||||
*/
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
#include "../../stdafx.h"
|
||||
#include "../../date_func.h"
|
||||
#include "../../debug.h"
|
||||
@@ -347,5 +345,3 @@ void NetworkUDPSocketHandler::Receive_SERVER_UNREGISTER(Packet *p, NetworkAddres
|
||||
void NetworkUDPSocketHandler::Receive_CLIENT_GET_NEWGRFS(Packet *p, NetworkAddress *client_addr) { this->ReceiveInvalidPacket(PACKET_UDP_CLIENT_GET_NEWGRFS, client_addr); }
|
||||
void NetworkUDPSocketHandler::Receive_SERVER_NEWGRFS(Packet *p, NetworkAddress *client_addr) { this->ReceiveInvalidPacket(PACKET_UDP_SERVER_NEWGRFS, client_addr); }
|
||||
void NetworkUDPSocketHandler::Receive_MASTER_SESSION_KEY(Packet *p, NetworkAddress *client_addr) { this->ReceiveInvalidPacket(PACKET_UDP_MASTER_SESSION_KEY, client_addr); }
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
@@ -18,8 +18,6 @@
|
||||
#include "game.h"
|
||||
#include "packet.h"
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
/** 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
|
||||
@@ -246,6 +244,4 @@ public:
|
||||
void ReceiveNetworkGameInfo(Packet *p, NetworkGameInfo *info);
|
||||
};
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
||||
#endif /* NETWORK_CORE_UDP_H */
|
||||
|
@@ -11,8 +11,6 @@
|
||||
|
||||
#include "../stdafx.h"
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
#include "../strings_func.h"
|
||||
#include "../command_func.h"
|
||||
#include "../date_func.h"
|
||||
@@ -1172,5 +1170,3 @@ bool IsNetworkCompatibleVersion(const char *other)
|
||||
const char *hash2 = ExtractNetworkRevisionHash(other);
|
||||
return hash1 && hash2 && (strncmp(hash1, hash2, GITHASH_SUFFIX_LEN) == 0);
|
||||
}
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
@@ -12,9 +12,6 @@
|
||||
#ifndef NETWORK_H
|
||||
#define NETWORK_H
|
||||
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
void NetworkStartUp();
|
||||
void NetworkShutDown();
|
||||
void NetworkDrawChatMessage();
|
||||
@@ -26,19 +23,4 @@ extern bool _network_available; ///< is network mode available?
|
||||
extern bool _network_dedicated; ///< are we a dedicated server?
|
||||
extern bool _is_network_server; ///< Does this client wants to be a network-server?
|
||||
|
||||
#else /* ENABLE_NETWORK */
|
||||
/* Network function stubs when networking is disabled */
|
||||
|
||||
static inline void NetworkStartUp() {}
|
||||
static inline void NetworkShutDown() {}
|
||||
static inline void NetworkDrawChatMessage() {}
|
||||
static inline bool HasClients() { return false; }
|
||||
|
||||
#define _networking 0
|
||||
#define _network_server 0
|
||||
#define _network_available 0
|
||||
#define _network_dedicated 0
|
||||
#define _is_network_server 0
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
#endif /* NETWORK_H */
|
||||
|
@@ -9,8 +9,6 @@
|
||||
|
||||
/** @file network_admin.cpp Server part of the admin network protocol. */
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
#include "../stdafx.h"
|
||||
#include "../strings_func.h"
|
||||
#include "../date_func.h"
|
||||
@@ -1045,5 +1043,3 @@ void NetworkAdminUpdate(AdminUpdateFrequency freq)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
@@ -12,8 +12,6 @@
|
||||
#ifndef NETWORK_ADMIN_H
|
||||
#define NETWORK_ADMIN_H
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
#include "network_internal.h"
|
||||
#include "core/tcp_listen.h"
|
||||
#include "core/tcp_admin.h"
|
||||
@@ -124,5 +122,4 @@ void NetworkAdminConsole(const char *origin, const char *string);
|
||||
void NetworkAdminGameScript(const char *json);
|
||||
void NetworkAdminCmdLogging(const NetworkClientSocket *owner, const CommandPacket *cp);
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
#endif /* NETWORK_ADMIN_H */
|
||||
|
@@ -12,8 +12,6 @@
|
||||
#ifndef NETWORK_BASE_H
|
||||
#define NETWORK_BASE_H
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
#include "network_type.h"
|
||||
#include "core/address.h"
|
||||
#include "../core/pool_type.hpp"
|
||||
@@ -54,5 +52,4 @@ struct NetworkClientInfo : NetworkClientInfoPool::PoolItem<&_networkclientinfo_p
|
||||
*/
|
||||
#define FOR_ALL_CLIENT_INFOS(var) FOR_ALL_CLIENT_INFOS_FROM(var, 0)
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
#endif /* NETWORK_BASE_H */
|
||||
|
@@ -11,8 +11,6 @@
|
||||
|
||||
#include <stdarg.h> /* va_list */
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
#include "../stdafx.h"
|
||||
#include "../strings_func.h"
|
||||
#include "../blitter/factory.hpp"
|
||||
@@ -562,5 +560,3 @@ void ShowNetworkChatQueryWindow(DestType type, int dest)
|
||||
DeleteWindowByClass(WC_SEND_NETWORK_MSG);
|
||||
new NetworkChatWindow(&_chat_window_desc, type, dest);
|
||||
}
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
@@ -9,8 +9,6 @@
|
||||
|
||||
/** @file network_client.cpp Client part of the network protocol. */
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
#include "../stdafx.h"
|
||||
#include "network_gui.h"
|
||||
#include "../saveload/saveload.h"
|
||||
@@ -1320,5 +1318,3 @@ bool NetworkMaxSpectatorsReached()
|
||||
{
|
||||
return NetworkSpectatorCount() >= (_network_server ? _settings_client.network.max_spectators : _network_server_max_spectators);
|
||||
}
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
@@ -12,8 +12,6 @@
|
||||
#ifndef NETWORK_CLIENT_H
|
||||
#define NETWORK_CLIENT_H
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
#include "network_internal.h"
|
||||
|
||||
/** Class for handling the client side of the game connection. */
|
||||
@@ -118,6 +116,4 @@ extern CompanyID _network_join_as;
|
||||
extern const char *_network_join_server_password;
|
||||
extern const char *_network_join_company_password;
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
||||
#endif /* NETWORK_CLIENT_H */
|
||||
|
@@ -9,8 +9,6 @@
|
||||
|
||||
/** @file network_command.cpp Command handling over network connections. */
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
#include "../stdafx.h"
|
||||
#include "network_admin.h"
|
||||
#include "network_client.h"
|
||||
@@ -344,5 +342,3 @@ void NetworkGameSocketHandler::SendCommand(Packet *p, const CommandPacket *cp)
|
||||
}
|
||||
p->Send_uint8 (callback);
|
||||
}
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
@@ -9,8 +9,6 @@
|
||||
|
||||
/** @file network_content.cpp Content sending/receiving part of the network protocol. */
|
||||
|
||||
#if defined(ENABLE_NETWORK)
|
||||
|
||||
#include "../stdafx.h"
|
||||
#include "../rev.h"
|
||||
#include "../ai/ai.hpp"
|
||||
@@ -1090,5 +1088,3 @@ void ClientNetworkContentSocketHandler::OnDownloadComplete(ContentID cid)
|
||||
if (iter != this->callbacks.End() && *iter == cb) iter++;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
@@ -15,8 +15,6 @@
|
||||
#include "core/tcp_content.h"
|
||||
#include "core/tcp_http.h"
|
||||
|
||||
#if defined(ENABLE_NETWORK)
|
||||
|
||||
/** Vector with content info */
|
||||
typedef SmallVector<ContentInfo *, 16> ContentVector;
|
||||
/** Vector with constant content info */
|
||||
@@ -153,8 +151,4 @@ void ShowNetworkContentListWindow(ContentVector *cv = NULL, ContentType type1 =
|
||||
|
||||
void ShowMissingContentWindow(const struct GRFConfig *list);
|
||||
|
||||
#else
|
||||
static inline void ShowNetworkContentListWindow() {}
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
||||
#endif /* NETWORK_CONTENT_H */
|
||||
|
@@ -9,7 +9,6 @@
|
||||
|
||||
/** @file network_content_gui.cpp Implementation of the Network Content related GUIs. */
|
||||
|
||||
#if defined(ENABLE_NETWORK)
|
||||
#include "../stdafx.h"
|
||||
#include "../strings_func.h"
|
||||
#include "../gfx_func.h"
|
||||
@@ -1168,5 +1167,3 @@ void ShowNetworkContentListWindow(ContentVector *cv, ContentType type1, ContentT
|
||||
}
|
||||
#endif /* WITH_ZLIB */
|
||||
}
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
@@ -26,8 +26,6 @@
|
||||
#include "../openttd.h"
|
||||
#include "../company_type.h"
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
extern NetworkServerGameInfo _network_game_info;
|
||||
extern NetworkCompanyState *_network_company_states;
|
||||
|
||||
@@ -90,5 +88,4 @@ void NetworkChatMessageLoop();
|
||||
|
||||
void NetworkAfterNewGRFScan();
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
#endif /* NETWORK_FUNC_H */
|
||||
|
@@ -12,8 +12,6 @@
|
||||
* Also, it handles the request to a server for data about the server
|
||||
*/
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
#include "../stdafx.h"
|
||||
#include "../debug.h"
|
||||
#include "../window_func.h"
|
||||
@@ -206,5 +204,3 @@ void NetworkAfterNewGRFScan()
|
||||
|
||||
InvalidateWindowClassesData(WC_NETWORK_WINDOW);
|
||||
}
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
@@ -9,7 +9,6 @@
|
||||
|
||||
/** @file network_gui.cpp Implementation of the Network related GUIs. */
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
#include "../stdafx.h"
|
||||
#include "../strings_func.h"
|
||||
#include "../date_func.h"
|
||||
@@ -2241,5 +2240,3 @@ void ShowNetworkCompanyPasswordWindow(Window *parent)
|
||||
|
||||
new NetworkCompanyPasswordWindow(&_network_company_password_window_desc, parent);
|
||||
}
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
@@ -17,8 +17,6 @@
|
||||
#include "../window_type.h"
|
||||
#include "network_type.h"
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
void ShowNetworkNeedPassword(NetworkPasswordType npt);
|
||||
void ShowNetworkGiveMoneyWindow(CompanyID company);
|
||||
void ShowNetworkChatQueryWindow(DestType type, int dest);
|
||||
@@ -42,14 +40,4 @@ struct NetworkCompanyInfo : NetworkCompanyStats {
|
||||
|
||||
NetworkCompanyInfo *GetLobbyCompanyInfo(CompanyID company);
|
||||
|
||||
#else /* ENABLE_NETWORK */
|
||||
/* Network function stubs when networking is disabled */
|
||||
|
||||
static inline void ShowNetworkChatQueryWindow(byte desttype, int dest) {}
|
||||
static inline void ShowClientList() {}
|
||||
static inline void ShowNetworkGameWindow() {}
|
||||
static inline void ShowNetworkCompanyPasswordWindow(Window *parent) {}
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
||||
#endif /* NETWORK_GUI_H */
|
||||
|
@@ -17,8 +17,6 @@
|
||||
|
||||
#include "../command_type.h"
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
#ifdef RANDOM_DEBUG
|
||||
/**
|
||||
* If this line is enable, every frame will have a sync test
|
||||
@@ -171,5 +169,4 @@ StringID GetNetworkErrorMsg(NetworkErrorCode err);
|
||||
bool NetworkFindName(char *new_name, const char *last);
|
||||
const char *GenerateCompanyPasswordHash(const char *password, const char *password_server_id, uint32 password_game_seed);
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
#endif /* NETWORK_INTERNAL_H */
|
||||
|
@@ -9,8 +9,6 @@
|
||||
|
||||
/** @file network_server.cpp Server part of the network protocol. */
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
#include "../stdafx.h"
|
||||
#include "../strings_func.h"
|
||||
#include "../date_func.h"
|
||||
@@ -2206,5 +2204,3 @@ void NetworkServerNewCompany(const Company *c, NetworkClientInfo *ci)
|
||||
NetworkServerSendChat(NETWORK_ACTION_COMPANY_NEW, DESTTYPE_BROADCAST, 0, "", ci->client_id, c->index + 1);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
@@ -12,8 +12,6 @@
|
||||
#ifndef NETWORK_SERVER_H
|
||||
#define NETWORK_SERVER_H
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
#include "network_internal.h"
|
||||
#include "core/tcp_listen.h"
|
||||
#include "../thread/thread.h"
|
||||
@@ -138,12 +136,4 @@ void NetworkServerUpdateCompanyPassworded(CompanyID company_id, bool passworded)
|
||||
*/
|
||||
#define FOR_ALL_CLIENT_SOCKETS(var) FOR_ALL_CLIENT_SOCKETS_FROM(var, 0)
|
||||
|
||||
#else /* ENABLE_NETWORK */
|
||||
/* Network function stubs when networking is disabled */
|
||||
|
||||
static inline void NetworkServerMonthlyLoop() {}
|
||||
static inline void NetworkServerYearlyLoop() {}
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
||||
#endif /* NETWORK_SERVER_H */
|
||||
|
@@ -14,8 +14,6 @@
|
||||
|
||||
#include "core/game.h"
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
/** How many clients can we have */
|
||||
static const uint MAX_CLIENTS = 255;
|
||||
|
||||
@@ -130,5 +128,4 @@ enum NetworkErrorCode {
|
||||
NETWORK_ERROR_END,
|
||||
};
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
#endif /* NETWORK_TYPE_H */
|
||||
|
@@ -14,8 +14,6 @@
|
||||
* communication before the game is being joined.
|
||||
*/
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
#include "../stdafx.h"
|
||||
#include "../date_func.h"
|
||||
#include "../map_func.h"
|
||||
@@ -714,5 +712,3 @@ void NetworkBackgroundUDPLoop()
|
||||
|
||||
_network_udp_mutex->EndCritical();
|
||||
}
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
@@ -12,8 +12,6 @@
|
||||
#ifndef NETWORK_UDP_H
|
||||
#define NETWORK_UDP_H
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
#include "core/address.h"
|
||||
|
||||
void NetworkUDPInitialize();
|
||||
@@ -25,6 +23,4 @@ void NetworkUDPRemoveAdvertise(bool blocking);
|
||||
void NetworkUDPClose();
|
||||
void NetworkBackgroundUDPLoop();
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
||||
#endif /* NETWORK_UDP_H */
|
||||
|
Reference in New Issue
Block a user