Avoid including client headers on server builds

This commit is contained in:
sfan5 2024-03-17 22:55:37 +01:00
parent bc4ab8b99e
commit 5727d74d37
8 changed files with 25 additions and 5 deletions

View File

@ -36,9 +36,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "network/peerhandler.h" #include "network/peerhandler.h"
#include "gameparams.h" #include "gameparams.h"
#include "clientdynamicinfo.h" #include "clientdynamicinfo.h"
#include <fstream>
#include "util/numeric.h" #include "util/numeric.h"
#ifdef SERVER
#error Do not include in server builds
#endif
#define CLIENT_CHAT_MESSAGE_LIMIT_PER_10S 10.0f #define CLIENT_CHAT_MESSAGE_LIMIT_PER_10S 10.0f
struct ClientEvent; struct ClientEvent;

View File

@ -24,6 +24,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "activeobjectmgr.h" // client::ActiveObjectMgr #include "activeobjectmgr.h" // client::ActiveObjectMgr
#include <set> #include <set>
#ifdef SERVER
#error Do not include in server builds
#endif
class ClientSimpleObject; class ClientSimpleObject;
class ClientMap; class ClientMap;
class ClientScripting; class ClientScripting;

View File

@ -22,6 +22,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "irrlichttypes.h" #include "irrlichttypes.h"
#include <string> #include <string>
#ifdef SERVER
#error Do not include in server builds
#endif
class InputHandler; class InputHandler;
class ChatBackend; class ChatBackend;
class RenderingEngine; class RenderingEngine;

View File

@ -30,6 +30,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
// include the shadow mapper classes too // include the shadow mapper classes too
#include "client/shadows/dynamicshadowsrender.h" #include "client/shadows/dynamicshadowsrender.h"
#ifdef SERVER
#error Do not include in server builds
#endif
struct VideoDriverInfo { struct VideoDriverInfo {
std::string name; std::string name;
std::string friendly_name; std::string friendly_name;

View File

@ -26,6 +26,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <unordered_set> #include <unordered_set>
#include <vector> #include <vector>
#ifdef SERVER
#error Do not include in server builds
#endif
struct SoundSpec; struct SoundSpec;
class SoundFallbackPathProvider class SoundFallbackPathProvider

View File

@ -17,9 +17,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#include "irrlichttypes.h" // must be included before anything irrlicht, see comment in the file #include "irrlichttypes_bloated.h"
#include "irrlicht.h" // createDevice #include "irrlicht.h" // createDevice
#include "irrlichttypes_extrabloated.h"
#include "irrlicht_changes/printing.h" #include "irrlicht_changes/printing.h"
#include "benchmark/benchmark.h" #include "benchmark/benchmark.h"
#include "chat_interface.h" #include "chat_interface.h"
@ -28,7 +27,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "server.h" #include "server.h"
#include "filesys.h" #include "filesys.h"
#include "version.h" #include "version.h"
#include "client/game.h"
#include "defaultsettings.h" #include "defaultsettings.h"
#include "gettext.h" #include "gettext.h"
#include "log.h" #include "log.h"

View File

@ -19,7 +19,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "test.h" #include "test.h"
#include "client/sound.h"
#include "nodedef.h" #include "nodedef.h"
#include "itemdef.h" #include "itemdef.h"
#include "dummygamedef.h" #include "dummygamedef.h"

View File

@ -20,7 +20,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#pragma once #pragma once
#include "irrlichttypes_bloated.h" #include "irrlichttypes_bloated.h"
#ifndef SERVER
#include "irrString.h" #include "irrString.h"
#endif
#include <cstdlib> #include <cstdlib>
#include <string> #include <string>
#include <string_view> #include <string_view>
@ -732,6 +734,7 @@ inline std::string str_join(const std::vector<std::string> &list,
return oss.str(); return oss.str();
} }
#ifndef SERVER
/** /**
* Create a UTF8 std::string from an irr::core::stringw. * Create a UTF8 std::string from an irr::core::stringw.
*/ */
@ -749,6 +752,7 @@ inline irr::core::stringw utf8_to_stringw(std::string_view input)
std::wstring str = utf8_to_wide(input); std::wstring str = utf8_to_wide(input);
return irr::core::stringw(str.c_str(), str.size()); return irr::core::stringw(str.c_str(), str.size());
} }
#endif
/** /**
* Sanitize the name of a new directory. This consists of two stages: * Sanitize the name of a new directory. This consists of two stages: