summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2019-03-20 17:01:13 +0100
committerPatric Stout <truebrain@openttd.org>2019-03-20 19:24:55 +0100
commite3c639a09f1d2251477f69496120d057dd8320a9 (patch)
tree7d66891ae41db811e1edd13647b05092dca54b5a /src/network
parent72c5f2b3eed77120d86ecf636e07c71eb23b4bd5 (diff)
downloadopenttd-e3c639a09f1d2251477f69496120d057dd8320a9.tar.xz
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.
Diffstat (limited to 'src/network')
-rw-r--r--src/network/core/address.cpp4
-rw-r--r--src/network/core/address.h3
-rw-r--r--src/network/core/core.cpp4
-rw-r--r--src/network/core/core.h4
-rw-r--r--src/network/core/game.h4
-rw-r--r--src/network/core/host.cpp4
-rw-r--r--src/network/core/os_abstraction.h4
-rw-r--r--src/network/core/packet.cpp4
-rw-r--r--src/network/core/packet.h4
-rw-r--r--src/network/core/tcp.cpp4
-rw-r--r--src/network/core/tcp.h4
-rw-r--r--src/network/core/tcp_admin.cpp4
-rw-r--r--src/network/core/tcp_admin.h4
-rw-r--r--src/network/core/tcp_connect.cpp4
-rw-r--r--src/network/core/tcp_content.cpp4
-rw-r--r--src/network/core/tcp_content.h4
-rw-r--r--src/network/core/tcp_game.cpp4
-rw-r--r--src/network/core/tcp_game.h4
-rw-r--r--src/network/core/tcp_http.cpp4
-rw-r--r--src/network/core/tcp_http.h4
-rw-r--r--src/network/core/tcp_listen.h4
-rw-r--r--src/network/core/udp.cpp4
-rw-r--r--src/network/core/udp.h4
-rw-r--r--src/network/network.cpp4
-rw-r--r--src/network/network.h18
-rw-r--r--src/network/network_admin.cpp4
-rw-r--r--src/network/network_admin.h3
-rw-r--r--src/network/network_base.h3
-rw-r--r--src/network/network_chat_gui.cpp4
-rw-r--r--src/network/network_client.cpp4
-rw-r--r--src/network/network_client.h4
-rw-r--r--src/network/network_command.cpp4
-rw-r--r--src/network/network_content.cpp4
-rw-r--r--src/network/network_content.h6
-rw-r--r--src/network/network_content_gui.cpp3
-rw-r--r--src/network/network_func.h3
-rw-r--r--src/network/network_gamelist.cpp4
-rw-r--r--src/network/network_gui.cpp3
-rw-r--r--src/network/network_gui.h12
-rw-r--r--src/network/network_internal.h3
-rw-r--r--src/network/network_server.cpp4
-rw-r--r--src/network/network_server.h10
-rw-r--r--src/network/network_type.h3
-rw-r--r--src/network/network_udp.cpp4
-rw-r--r--src/network/network_udp.h4
45 files changed, 0 insertions, 202 deletions
diff --git a/src/network/core/address.cpp b/src/network/core/address.cpp
index 62af3a40b..952229776 100644
--- a/src/network/core/address.cpp
+++ b/src/network/core/address.cpp
@@ -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 */
diff --git a/src/network/core/address.h b/src/network/core/address.h
index 9fd40eaee..b5c78c79b 100644
--- a/src/network/core/address.h
+++ b/src/network/core/address.h
@@ -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 */
diff --git a/src/network/core/core.cpp b/src/network/core/core.cpp
index e5f1df721..1726e4176 100644
--- a/src/network/core/core.cpp
+++ b/src/network/core/core.cpp
@@ -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 */
diff --git a/src/network/core/core.h b/src/network/core/core.h
index a250dbb08..1536c08a7 100644
--- a/src/network/core/core.h
+++ b/src/network/core/core.h
@@ -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 */
diff --git a/src/network/core/game.h b/src/network/core/game.h
index a9da29118..57eba5812 100644
--- a/src/network/core/game.h
+++ b/src/network/core/game.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 */
diff --git a/src/network/core/host.cpp b/src/network/core/host.cpp
index c2faf4c8b..05ad84153 100644
--- a/src/network/core/host.cpp
+++ b/src/network/core/host.cpp
@@ -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 */
diff --git a/src/network/core/os_abstraction.h b/src/network/core/os_abstraction.h
index 16c85d566..ef5c0f2ab 100644
--- a/src/network/core/os_abstraction.h
+++ b/src/network/core/os_abstraction.h
@@ -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 */
diff --git a/src/network/core/packet.cpp b/src/network/core/packet.cpp
index 7548132e0..8cecd9bd2 100644
--- a/src/network/core/packet.cpp
+++ b/src/network/core/packet.cpp
@@ -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 */
diff --git a/src/network/core/packet.h b/src/network/core/packet.h
index 7f344d017..7b4bf26f3 100644
--- a/src/network/core/packet.h
+++ b/src/network/core/packet.h
@@ -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 */
diff --git a/src/network/core/tcp.cpp b/src/network/core/tcp.cpp
index a2f789c09..33b61688d 100644
--- a/src/network/core/tcp.cpp
+++ b/src/network/core/tcp.cpp
@@ -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 */
diff --git a/src/network/core/tcp.h b/src/network/core/tcp.h
index b736189b4..00642c2dd 100644
--- a/src/network/core/tcp.h
+++ b/src/network/core/tcp.h
@@ -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 */
diff --git a/src/network/core/tcp_admin.cpp b/src/network/core/tcp_admin.cpp
index 284ceda9b..226bae024 100644
--- a/src/network/core/tcp_admin.cpp
+++ b/src/network/core/tcp_admin.cpp
@@ -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 */
diff --git a/src/network/core/tcp_admin.h b/src/network/core/tcp_admin.h
index e141a191a..497c24b48 100644
--- a/src/network/core/tcp_admin.h
+++ b/src/network/core/tcp_admin.h
@@ -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 */
diff --git a/src/network/core/tcp_connect.cpp b/src/network/core/tcp_connect.cpp
index 2dc789882..95f9662cd 100644
--- a/src/network/core/tcp_connect.cpp
+++ b/src/network/core/tcp_connect.cpp
@@ -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 */
diff --git a/src/network/core/tcp_content.cpp b/src/network/core/tcp_content.cpp
index fc22c4491..8257a7252 100644
--- a/src/network/core/tcp_content.cpp
+++ b/src/network/core/tcp_content.cpp
@@ -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 */
diff --git a/src/network/core/tcp_content.h b/src/network/core/tcp_content.h
index a506439da..c359fb667 100644
--- a/src/network/core/tcp_content.h
+++ b/src/network/core/tcp_content.h
@@ -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 */
diff --git a/src/network/core/tcp_game.cpp b/src/network/core/tcp_game.cpp
index caa378fc4..2d8a74a11 100644
--- a/src/network/core/tcp_game.cpp
+++ b/src/network/core/tcp_game.cpp
@@ -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 */
diff --git a/src/network/core/tcp_game.h b/src/network/core/tcp_game.h
index 5c6cb5c34..c41ad4dc1 100644
--- a/src/network/core/tcp_game.h
+++ b/src/network/core/tcp_game.h
@@ -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 */
diff --git a/src/network/core/tcp_http.cpp b/src/network/core/tcp_http.cpp
index 4cd92e5fe..3a40e3eec 100644
--- a/src/network/core/tcp_http.cpp
+++ b/src/network/core/tcp_http.cpp
@@ -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 */
diff --git a/src/network/core/tcp_http.h b/src/network/core/tcp_http.h
index 36520f136..ec969264b 100644
--- a/src/network/core/tcp_http.h
+++ b/src/network/core/tcp_http.h
@@ -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 */
diff --git a/src/network/core/tcp_listen.h b/src/network/core/tcp_listen.h
index 8cd8257b2..21bcaea3c 100644
--- a/src/network/core/tcp_listen.h
+++ b/src/network/core/tcp_listen.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 */
diff --git a/src/network/core/udp.cpp b/src/network/core/udp.cpp
index 1f34d15b0..4a2f77368 100644
--- a/src/network/core/udp.cpp
+++ b/src/network/core/udp.cpp
@@ -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 */
diff --git a/src/network/core/udp.h b/src/network/core/udp.h
index 9aa0c9dc4..2f77a94df 100644
--- a/src/network/core/udp.h
+++ b/src/network/core/udp.h
@@ -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 */
diff --git a/src/network/network.cpp b/src/network/network.cpp
index 4727e3344..ea770e500 100644
--- a/src/network/network.cpp
+++ b/src/network/network.cpp
@@ -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 */
diff --git a/src/network/network.h b/src/network/network.h
index 26f94482e..9f8e3b790 100644
--- a/src/network/network.h
+++ b/src/network/network.h
@@ -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 */
diff --git a/src/network/network_admin.cpp b/src/network/network_admin.cpp
index f70f3d1a5..73ad0e192 100644
--- a/src/network/network_admin.cpp
+++ b/src/network/network_admin.cpp
@@ -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 */
diff --git a/src/network/network_admin.h b/src/network/network_admin.h
index cb478fc7e..6d06d5b9f 100644
--- a/src/network/network_admin.h
+++ b/src/network/network_admin.h
@@ -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 */
diff --git a/src/network/network_base.h b/src/network/network_base.h
index 1644b3558..817d0e4c8 100644
--- a/src/network/network_base.h
+++ b/src/network/network_base.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 */
diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp
index 68e148987..94e289885 100644
--- a/src/network/network_chat_gui.cpp
+++ b/src/network/network_chat_gui.cpp
@@ -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 */
diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp
index 62db6a555..0bb42c86f 100644
--- a/src/network/network_client.cpp
+++ b/src/network/network_client.cpp
@@ -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 */
diff --git a/src/network/network_client.h b/src/network/network_client.h
index 23878b506..5e9988d9a 100644
--- a/src/network/network_client.h
+++ b/src/network/network_client.h
@@ -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 */
diff --git a/src/network/network_command.cpp b/src/network/network_command.cpp
index bc08bc5f1..51317288e 100644
--- a/src/network/network_command.cpp
+++ b/src/network/network_command.cpp
@@ -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 */
diff --git a/src/network/network_content.cpp b/src/network/network_content.cpp
index 551abb442..1a80c5d99 100644
--- a/src/network/network_content.cpp
+++ b/src/network/network_content.cpp
@@ -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 */
diff --git a/src/network/network_content.h b/src/network/network_content.h
index 25788065f..b1e9dd66b 100644
--- a/src/network/network_content.h
+++ b/src/network/network_content.h
@@ -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 */
diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp
index 877dea978..230a62134 100644
--- a/src/network/network_content_gui.cpp
+++ b/src/network/network_content_gui.cpp
@@ -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 */
diff --git a/src/network/network_func.h b/src/network/network_func.h
index 4f1525b5a..9adbb6e60 100644
--- a/src/network/network_func.h
+++ b/src/network/network_func.h
@@ -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 */
diff --git a/src/network/network_gamelist.cpp b/src/network/network_gamelist.cpp
index e5d80630e..6c65c52c9 100644
--- a/src/network/network_gamelist.cpp
+++ b/src/network/network_gamelist.cpp
@@ -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 */
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index 93cd3d973..cb6426142 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -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 */
diff --git a/src/network/network_gui.h b/src/network/network_gui.h
index a196c75e9..d9dfb57dd 100644
--- a/src/network/network_gui.h
+++ b/src/network/network_gui.h
@@ -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 */
diff --git a/src/network/network_internal.h b/src/network/network_internal.h
index ed9a8de6f..2498d50d4 100644
--- a/src/network/network_internal.h
+++ b/src/network/network_internal.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 */
diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp
index 05fb27fc8..bd78acf92 100644
--- a/src/network/network_server.cpp
+++ b/src/network/network_server.cpp
@@ -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 */
diff --git a/src/network/network_server.h b/src/network/network_server.h
index a52b2c936..1cd8feb67 100644
--- a/src/network/network_server.h
+++ b/src/network/network_server.h
@@ -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 */
diff --git a/src/network/network_type.h b/src/network/network_type.h
index 3c390c29b..9b598716f 100644
--- a/src/network/network_type.h
+++ b/src/network/network_type.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 */
diff --git a/src/network/network_udp.cpp b/src/network/network_udp.cpp
index 3fd0dd485..289b07520 100644
--- a/src/network/network_udp.cpp
+++ b/src/network/network_udp.cpp
@@ -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 */
diff --git a/src/network/network_udp.h b/src/network/network_udp.h
index 3dfd07672..12de30bca 100644
--- a/src/network/network_udp.h
+++ b/src/network/network_udp.h
@@ -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 */