diff options
author | Patric Stout <truebrain@openttd.org> | 2019-03-20 17:01:13 +0100 |
---|---|---|
committer | Patric Stout <truebrain@openttd.org> | 2019-03-20 19:24:55 +0100 |
commit | e3c639a09f1d2251477f69496120d057dd8320a9 (patch) | |
tree | 7d66891ae41db811e1edd13647b05092dca54b5a /src/ai | |
parent | 72c5f2b3eed77120d86ecf636e07c71eb23b4bd5 (diff) | |
download | openttd-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/ai')
-rw-r--r-- | src/ai/ai.hpp | 2 | ||||
-rw-r--r-- | src/ai/ai_core.cpp | 4 | ||||
-rw-r--r-- | src/ai/ai_gui.cpp | 2 |
3 files changed, 0 insertions, 8 deletions
diff --git a/src/ai/ai.hpp b/src/ai/ai.hpp index 1b5b6c07d..bd9544b9f 100644 --- a/src/ai/ai.hpp +++ b/src/ai/ai.hpp @@ -164,11 +164,9 @@ public: /** Gets the ScriptScanner instance that is used to find AI Libraries */ static AIScannerLibrary *GetScannerLibrary(); -#if defined(ENABLE_NETWORK) /** Wrapper function for AIScanner::HasAI */ static bool HasAI(const struct ContentInfo *ci, bool md5sum); static bool HasAILibrary(const ContentInfo *ci, bool md5sum); -#endif private: static uint frame_counter; ///< Tick counter for the AI code static class AIScannerInfo *scanner_info; ///< ScriptScanner instance that is used to find AIs diff --git a/src/ai/ai_core.cpp b/src/ai/ai_core.cpp index 51522edaf..ff2fc286a 100644 --- a/src/ai/ai_core.cpp +++ b/src/ai/ai_core.cpp @@ -362,8 +362,6 @@ InvalidateWindowClassesData(WC_AI_SETTINGS); } -#if defined(ENABLE_NETWORK) - /** * Check whether we have an AI (library) with the exact characteristics as ci. * @param ci the characteristics to search on (shortname and md5sum) @@ -380,8 +378,6 @@ return AI::scanner_library->HasScript(ci, md5sum); } -#endif /* defined(ENABLE_NETWORK) */ - /* static */ AIScannerInfo *AI::GetScannerInfo() { return AI::scanner_info; diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp index 73806da15..8e7e12a63 100644 --- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -928,9 +928,7 @@ struct AIConfigWindow : public Window { if (!_network_available) { ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, WL_ERROR); } else { -#if defined(ENABLE_NETWORK) ShowNetworkContentListWindow(NULL, CONTENT_TYPE_AI, CONTENT_TYPE_GAME); -#endif } break; } |