From e3c639a09f1d2251477f69496120d057dd8320a9 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Wed, 20 Mar 2019 17:01:13 +0100 Subject: 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. --- src/date.cpp | 8 -------- 1 file changed, 8 deletions(-) (limited to 'src/date.cpp') diff --git a/src/date.cpp b/src/date.cpp index 9c25af40e..8b8fab5b0 100644 --- a/src/date.cpp +++ b/src/date.cpp @@ -195,9 +195,7 @@ static void OnNewYear() VehiclesYearlyLoop(); TownsYearlyLoop(); InvalidateWindowClassesData(WC_BUILD_STATION); -#ifdef ENABLE_NETWORK if (_network_server) NetworkServerYearlyLoop(); -#endif /* ENABLE_NETWORK */ if (_cur_year == _settings_client.gui.semaphore_build_before) ResetSignalVariant(); @@ -217,11 +215,9 @@ static void OnNewYear() LinkGraph *lg; FOR_ALL_LINK_GRAPHS(lg) lg->ShiftDates(-days_this_year); -#ifdef ENABLE_NETWORK /* Because the _date wraps here, and text-messages expire by game-days, we have to clean out * all of them if the date is set back, else those messages will hang for ever */ NetworkInitChatMessage(); -#endif /* ENABLE_NETWORK */ } if (_settings_client.gui.auto_euro) CheckSwitchToEuro(); @@ -244,9 +240,7 @@ static void OnNewMonth() IndustryMonthlyLoop(); SubsidyMonthlyLoop(); StationMonthlyLoop(); -#ifdef ENABLE_NETWORK if (_network_server) NetworkServerMonthlyLoop(); -#endif /* ENABLE_NETWORK */ } /** @@ -254,9 +248,7 @@ static void OnNewMonth() */ static void OnNewDay() { -#ifdef ENABLE_NETWORK if (_network_server) NetworkServerDailyLoop(); -#endif /* ENABLE_NETWORK */ DisasterDailyLoop(); IndustryDailyLoop(); -- cgit v1.2.3-70-g09d2