Skip to content

Commit

Permalink
Avoid including client headers on server builds
Browse files Browse the repository at this point in the history
  • Loading branch information
sfan5 committed Mar 20, 2024
1 parent bc4ab8b commit 5727d74
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 5 deletions.
5 changes: 4 additions & 1 deletion src/client/client.h
Expand Up @@ -36,9 +36,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "network/peerhandler.h"
#include "gameparams.h"
#include "clientdynamicinfo.h"
#include <fstream>
#include "util/numeric.h"

#ifdef SERVER
#error Do not include in server builds
#endif

#define CLIENT_CHAT_MESSAGE_LIMIT_PER_10S 10.0f

struct ClientEvent;
Expand Down
4 changes: 4 additions & 0 deletions src/client/clientenvironment.h
Expand Up @@ -24,6 +24,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "activeobjectmgr.h" // client::ActiveObjectMgr
#include <set>

#ifdef SERVER
#error Do not include in server builds
#endif

class ClientSimpleObject;
class ClientMap;
class ClientScripting;
Expand Down
4 changes: 4 additions & 0 deletions src/client/game.h
Expand Up @@ -22,6 +22,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "irrlichttypes.h"
#include <string>

#ifdef SERVER
#error Do not include in server builds
#endif

class InputHandler;
class ChatBackend;
class RenderingEngine;
Expand Down
4 changes: 4 additions & 0 deletions src/client/renderingengine.h
Expand Up @@ -30,6 +30,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
// include the shadow mapper classes too
#include "client/shadows/dynamicshadowsrender.h"

#ifdef SERVER
#error Do not include in server builds
#endif

struct VideoDriverInfo {
std::string name;
std::string friendly_name;
Expand Down
4 changes: 4 additions & 0 deletions src/client/sound.h
Expand Up @@ -26,6 +26,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <unordered_set>
#include <vector>

#ifdef SERVER
#error Do not include in server builds
#endif

struct SoundSpec;

class SoundFallbackPathProvider
Expand Down
4 changes: 1 addition & 3 deletions src/main.cpp
Expand Up @@ -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.
*/

#include "irrlichttypes.h" // must be included before anything irrlicht, see comment in the file
#include "irrlichttypes_bloated.h"
#include "irrlicht.h" // createDevice
#include "irrlichttypes_extrabloated.h"
#include "irrlicht_changes/printing.h"
#include "benchmark/benchmark.h"
#include "chat_interface.h"
Expand All @@ -28,7 +27,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "server.h"
#include "filesys.h"
#include "version.h"
#include "client/game.h"
#include "defaultsettings.h"
#include "gettext.h"
#include "log.h"
Expand Down
1 change: 0 additions & 1 deletion src/unittest/test.cpp
Expand Up @@ -19,7 +19,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,

#include "test.h"

#include "client/sound.h"
#include "nodedef.h"
#include "itemdef.h"
#include "dummygamedef.h"
Expand Down
4 changes: 4 additions & 0 deletions src/util/string.h
Expand Up @@ -20,7 +20,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#pragma once

#include "irrlichttypes_bloated.h"
#ifndef SERVER
#include "irrString.h"
#endif
#include <cstdlib>
#include <string>
#include <string_view>
Expand Down Expand Up @@ -732,6 +734,7 @@ inline std::string str_join(const std::vector<std::string> &list,
return oss.str();
}

#ifndef SERVER
/**
* Create a UTF8 std::string from an irr::core::stringw.
*/
Expand All @@ -749,6 +752,7 @@ inline irr::core::stringw utf8_to_stringw(std::string_view input)
std::wstring str = utf8_to_wide(input);
return irr::core::stringw(str.c_str(), str.size());
}
#endif

/**
* Sanitize the name of a new directory. This consists of two stages:
Expand Down

0 comments on commit 5727d74

Please sign in to comment.