summaryrefslogtreecommitdiff
path: root/src/table
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/table
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/table')
-rw-r--r--src/table/gameopt_settings.ini2
-rw-r--r--src/table/settings.ini46
2 files changed, 1 insertions, 47 deletions
diff --git a/src/table/gameopt_settings.ini b/src/table/gameopt_settings.ini
index 624d475c3..29d6a3177 100644
--- a/src/table/gameopt_settings.ini
+++ b/src/table/gameopt_settings.ini
@@ -21,9 +21,7 @@ static const char *_climates = "temperate|arctic|tropic|toyland";
static const char *_autosave_interval = "off|monthly|quarterly|half year|yearly";
static const char *_roadsides = "left|right";
static const char *_savegame_date = "long|short|iso";
-#ifdef ENABLE_NETWORK
static const char *_server_langs = "ANY|ENGLISH|GERMAN|FRENCH|BRAZILIAN|BULGARIAN|CHINESE|CZECH|DANISH|DUTCH|ESPERANTO|FINNISH|HUNGARIAN|ICELANDIC|ITALIAN|JAPANESE|KOREAN|LITHUANIAN|NORWEGIAN|POLISH|PORTUGUESE|ROMANIAN|RUSSIAN|SLOVAK|SLOVENIAN|SPANISH|SWEDISH|TURKISH|UKRAINIAN|AFRIKAANS|CROATIAN|CATALAN|ESTONIAN|GALICIAN|GREEK|LATVIAN";
-#endif /* ENABLE_NETWORK */
static const char *_osk_activation = "disabled|double|single|immediately";
static const char *_settings_profiles = "easy|medium|hard";
static const char *_news_display = "off|summarized|full";
diff --git a/src/table/settings.ini b/src/table/settings.ini
index 7ab00d5a3..e7b625e4b 100644
--- a/src/table/settings.ini
+++ b/src/table/settings.ini
@@ -44,12 +44,11 @@ static bool ZoomMinMaxChanged(int32 p1);
static bool MaxVehiclesChanged(int32 p1);
static bool InvalidateShipPathCache(int32 p1);
-#ifdef ENABLE_NETWORK
static bool UpdateClientName(int32 p1);
static bool UpdateServerPassword(int32 p1);
static bool UpdateRconPassword(int32 p1);
static bool UpdateClientConfigValues(int32 p1);
-#endif /* ENABLE_NETWORK */
+
/* End - Callback Functions for the various settings */
/* Some settings do not need to be synchronised when playing in multiplayer.
@@ -3565,7 +3564,6 @@ strhelp = STR_CONFIG_SETTING_NEWS_GENERAL_INFORMATION_HELPTEXT
strval = STR_CONFIG_SETTING_NEWS_MESSAGES_OFF
[SDTC_VAR]
-ifdef = ENABLE_NETWORK
var = gui.network_chat_box_width_pct
type = SLE_UINT16
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
@@ -3575,7 +3573,6 @@ max = 100
cat = SC_EXPERT
[SDTC_VAR]
-ifdef = ENABLE_NETWORK
var = gui.network_chat_box_height
type = SLE_UINT8
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
@@ -3585,7 +3582,6 @@ max = 255
cat = SC_EXPERT
[SDTC_VAR]
-ifdef = ENABLE_NETWORK
var = gui.network_chat_timeout
type = SLE_UINT16
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
@@ -3595,7 +3591,6 @@ max = 65535
cat = SC_EXPERT
[SDTC_VAR]
-ifdef = ENABLE_NETWORK
var = network.sync_freq
type = SLE_UINT16
flags = SLF_NOT_IN_SAVE | SLF_NOT_IN_CONFIG | SLF_NO_NETWORK_SYNC
@@ -3606,7 +3601,6 @@ max = 100
cat = SC_EXPERT
[SDTC_VAR]
-ifdef = ENABLE_NETWORK
var = network.frame_freq
type = SLE_UINT8
flags = SLF_NOT_IN_SAVE | SLF_NOT_IN_CONFIG | SLF_NO_NETWORK_SYNC
@@ -3617,7 +3611,6 @@ max = 100
cat = SC_EXPERT
[SDTC_VAR]
-ifdef = ENABLE_NETWORK
var = network.commands_per_frame
type = SLE_UINT16
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
@@ -3628,7 +3621,6 @@ max = 65535
cat = SC_EXPERT
[SDTC_VAR]
-ifdef = ENABLE_NETWORK
var = network.max_commands_in_queue
type = SLE_UINT16
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
@@ -3639,7 +3631,6 @@ max = 65535
cat = SC_EXPERT
[SDTC_VAR]
-ifdef = ENABLE_NETWORK
var = network.bytes_per_frame
type = SLE_UINT16
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
@@ -3650,7 +3641,6 @@ max = 65535
cat = SC_EXPERT
[SDTC_VAR]
-ifdef = ENABLE_NETWORK
var = network.bytes_per_frame_burst
type = SLE_UINT16
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
@@ -3661,7 +3651,6 @@ max = 65535
cat = SC_EXPERT
[SDTC_VAR]
-ifdef = ENABLE_NETWORK
var = network.max_init_time
type = SLE_UINT16
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
@@ -3672,7 +3661,6 @@ max = 32000
cat = SC_EXPERT
[SDTC_VAR]
-ifdef = ENABLE_NETWORK
var = network.max_join_time
type = SLE_UINT16
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
@@ -3682,7 +3670,6 @@ min = 0
max = 32000
[SDTC_VAR]
-ifdef = ENABLE_NETWORK
var = network.max_download_time
type = SLE_UINT16
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
@@ -3692,7 +3679,6 @@ min = 0
max = 32000
[SDTC_VAR]
-ifdef = ENABLE_NETWORK
var = network.max_password_time
type = SLE_UINT16
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
@@ -3702,7 +3688,6 @@ min = 0
max = 32000
[SDTC_VAR]
-ifdef = ENABLE_NETWORK
var = network.max_lag_time
type = SLE_UINT16
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
@@ -3712,14 +3697,12 @@ min = 0
max = 32000
[SDTC_BOOL]
-ifdef = ENABLE_NETWORK
var = network.pause_on_join
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
guiflags = SGF_NETWORK_ONLY
def = true
[SDTC_VAR]
-ifdef = ENABLE_NETWORK
var = network.server_port
type = SLE_UINT16
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
@@ -3730,7 +3713,6 @@ max = 65535
cat = SC_EXPERT
[SDTC_VAR]
-ifdef = ENABLE_NETWORK
var = network.server_admin_port
type = SLE_UINT16
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
@@ -3741,7 +3723,6 @@ max = 65535
cat = SC_EXPERT
[SDTC_BOOL]
-ifdef = ENABLE_NETWORK
var = network.server_admin_chat
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
guiflags = SGF_NETWORK_ONLY
@@ -3749,14 +3730,12 @@ def = true
cat = SC_EXPERT
[SDTC_BOOL]
-ifdef = ENABLE_NETWORK
var = network.server_advertise
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
guiflags = SGF_NETWORK_ONLY
def = false
[SDTC_VAR]
-ifdef = ENABLE_NETWORK
var = network.lan_internet
type = SLE_UINT8
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
@@ -3766,7 +3745,6 @@ min = 0
max = 1
[SDTC_STR]
-ifdef = ENABLE_NETWORK
var = network.client_name
type = SLE_STRB
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
@@ -3774,8 +3752,6 @@ def = NULL
proc = UpdateClientName
cat = SC_BASIC
-[SDTC_STR]
-ifdef = ENABLE_NETWORK
var = network.server_password
type = SLE_STRB
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
@@ -3785,7 +3761,6 @@ proc = UpdateServerPassword
cat = SC_BASIC
[SDTC_STR]
-ifdef = ENABLE_NETWORK
var = network.rcon_password
type = SLE_STRB
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
@@ -3795,7 +3770,6 @@ proc = UpdateRconPassword
cat = SC_BASIC
[SDTC_STR]
-ifdef = ENABLE_NETWORK
var = network.admin_password
type = SLE_STRB
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
@@ -3804,14 +3778,12 @@ def = NULL
cat = SC_BASIC
[SDTC_STR]
-ifdef = ENABLE_NETWORK
var = network.default_company_pass
type = SLE_STRB
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
def = NULL
[SDTC_STR]
-ifdef = ENABLE_NETWORK
var = network.server_name
type = SLE_STRB
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
@@ -3820,14 +3792,12 @@ def = NULL
cat = SC_BASIC
[SDTC_STR]
-ifdef = ENABLE_NETWORK
var = network.connect_to_ip
type = SLE_STRB
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
def = NULL
[SDTC_STR]
-ifdef = ENABLE_NETWORK
var = network.network_id
type = SLE_STRB
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
@@ -3835,14 +3805,12 @@ guiflags = SGF_NETWORK_ONLY
def = NULL
[SDTC_BOOL]
-ifdef = ENABLE_NETWORK
var = network.autoclean_companies
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
guiflags = SGF_NETWORK_ONLY
def = false
[SDTC_VAR]
-ifdef = ENABLE_NETWORK
var = network.autoclean_unprotected
type = SLE_UINT8
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
@@ -3852,7 +3820,6 @@ min = 0
max = 240
[SDTC_VAR]
-ifdef = ENABLE_NETWORK
var = network.autoclean_protected
type = SLE_UINT8
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
@@ -3862,7 +3829,6 @@ min = 0
max = 240
[SDTC_VAR]
-ifdef = ENABLE_NETWORK
var = network.autoclean_novehicles
type = SLE_UINT8
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
@@ -3872,7 +3838,6 @@ min = 0
max = 240
[SDTC_VAR]
-ifdef = ENABLE_NETWORK
var = network.max_companies
type = SLE_UINT8
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
@@ -3884,7 +3849,6 @@ proc = UpdateClientConfigValues
cat = SC_BASIC
[SDTC_VAR]
-ifdef = ENABLE_NETWORK
var = network.max_clients
type = SLE_UINT8
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
@@ -3895,7 +3859,6 @@ max = MAX_CLIENTS
cat = SC_BASIC
[SDTC_VAR]
-ifdef = ENABLE_NETWORK
var = network.max_spectators
type = SLE_UINT8
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
@@ -3907,7 +3870,6 @@ proc = UpdateClientConfigValues
cat = SC_BASIC
[SDTC_VAR]
-ifdef = ENABLE_NETWORK
var = network.restart_game_year
type = SLE_INT32
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
@@ -3918,7 +3880,6 @@ max = MAX_YEAR
interval = 1
[SDTC_VAR]
-ifdef = ENABLE_NETWORK
var = network.min_active_clients
type = SLE_UINT8
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
@@ -3928,7 +3889,6 @@ min = 0
max = MAX_CLIENTS
[SDTC_OMANY]
-ifdef = ENABLE_NETWORK
var = network.server_lang
type = SLE_UINT8
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
@@ -3939,7 +3899,6 @@ full = _server_langs
cat = SC_BASIC
[SDTC_BOOL]
-ifdef = ENABLE_NETWORK
var = network.reload_cfg
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
guiflags = SGF_NETWORK_ONLY
@@ -3947,7 +3906,6 @@ def = false
cat = SC_EXPERT
[SDTC_STR]
-ifdef = ENABLE_NETWORK
var = network.last_host
type = SLE_STRB
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
@@ -3955,7 +3913,6 @@ def = """"
cat = SC_EXPERT
[SDTC_VAR]
-ifdef = ENABLE_NETWORK
var = network.last_port
type = SLE_UINT16
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
@@ -3965,7 +3922,6 @@ max = UINT16_MAX
cat = SC_EXPERT
[SDTC_BOOL]
-ifdef = ENABLE_NETWORK
var = network.no_http_content_downloads
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
def = false