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:
Patric Stout
2019-03-20 17:01:13 +01:00
parent 72c5f2b3ee
commit e3c639a09f
96 changed files with 29 additions and 600 deletions

View File

@@ -154,11 +154,9 @@ struct GUISettings {
uint8 station_gui_group_order; ///< the order of grouping cargo entries in the station gui
uint8 station_gui_sort_by; ///< sort cargo entries in the station gui by station name or amount
uint8 station_gui_sort_order; ///< the sort order of entries in the station gui - ascending or descending
#ifdef ENABLE_NETWORK
uint16 network_chat_box_width_pct; ///< width of the chat box in percent
uint8 network_chat_box_height; ///< height of the chat box in lines
uint16 network_chat_timeout; ///< timeout of chat messages in seconds
#endif
uint8 developer; ///< print non-fatal warnings in console (>= 1), copy debug output to console (== 2)
bool show_date_in_logs; ///< whether to show dates in console logs
@@ -237,7 +235,6 @@ struct NewsSettings {
/** All settings related to the network. */
struct NetworkSettings {
#ifdef ENABLE_NETWORK
uint16 sync_freq; ///< how often do we check whether we are still in-sync
uint8 frame_freq; ///< how often do we send commands to the clients
uint16 commands_per_frame; ///< how many commands may be sent each frame_freq frames?
@@ -277,8 +274,6 @@ struct NetworkSettings {
char last_host[NETWORK_HOSTNAME_LENGTH]; ///< IP address of the last joined server
uint16 last_port; ///< port of the last joined server
bool no_http_content_downloads; ///< do not do content downloads over HTTP
#else /* ENABLE_NETWORK */
#endif
};
/** Settings related to the creation of games. */