From 85511a642f851100d0d856f4ecbe7fea7a7bb049 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Blot?= Date: Wed, 16 Aug 2017 22:11:45 +0200 Subject: [PATCH] Cleanup various headers to reduce compilation times (#6255) * Cleanup various headers to reduce compilation times --- src/ban.h | 2 +- src/camera.cpp | 19 +++++++++---------- src/camera.h | 5 +---- src/client.cpp | 5 +++-- src/client.h | 1 - src/client/inputhandler.h | 2 +- src/client/renderingengine.cpp | 2 ++ src/clientenvironment.cpp | 1 + src/clientenvironment.h | 1 + src/clientiface.cpp | 5 ++--- src/clientiface.h | 1 + src/content_cao.cpp | 1 + src/content_mapblock.h | 2 +- src/environment.h | 3 +-- src/game.cpp | 3 +-- src/gettext.h | 1 + src/guiKeyChangeMenu.h | 1 - src/guiPasswordChange.cpp | 4 +--- src/guiPasswordChange.h | 3 ++- src/guiVolumeChange.h | 5 ++--- src/irrlichttypes.h | 2 +- src/localplayer.h | 2 ++ src/main.cpp | 6 +----- src/mapblock_mesh.cpp | 1 + src/mg_ore.cpp | 1 + src/minimap.cpp | 19 ++++--------------- src/minimap.h | 9 +++++---- src/network/clientopcodes.h | 3 ++- src/network/connection.cpp | 14 ++++++++++++++ src/network/connection.h | 12 ++---------- src/network/networkpacket.cpp | 2 +- src/network/networkpacket.h | 2 +- src/network/serveropcodes.h | 3 ++- src/nodedef.h | 1 - src/noise.h | 2 +- src/script/cpp_api/s_async.h | 4 ++-- src/script/cpp_api/s_base.h | 2 +- src/script/cpp_api/s_internal.h | 1 + src/script/lua_api/l_base.h | 2 +- src/script/lua_api/l_camera.cpp | 1 + src/script/lua_api/l_client.cpp | 1 + src/script/lua_api/l_env.cpp | 3 +++ src/script/lua_api/l_localplayer.cpp | 1 + src/script/lua_api/l_minimap.cpp | 1 + src/server.cpp | 1 + src/server.h | 5 +++-- src/serverenvironment.h | 1 + src/terminal_chat_console.cpp | 1 + src/terminal_chat_console.h | 6 ++++-- src/unittest/test.cpp | 1 + src/unittest/test_connection.cpp | 1 + 51 files changed, 94 insertions(+), 84 deletions(-) diff --git a/src/ban.h b/src/ban.h index 35bf10ab..44cc94e6 100644 --- a/src/ban.h +++ b/src/ban.h @@ -30,7 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc., class BanManager { public: - BanManager(const std::string &bannfilepath); + BanManager(const std::string &banfilepath); ~BanManager(); void load(); void save(); diff --git a/src/camera.cpp b/src/camera.cpp index 7406aba0..b7aed5d7 100644 --- a/src/camera.cpp +++ b/src/camera.cpp @@ -283,8 +283,7 @@ void Camera::addArmInertia(f32 player_yaw) } } -void Camera::update(LocalPlayer* player, f32 frametime, f32 busytime, - f32 tool_reload_ratio, ClientEnvironment &c_env) +void Camera::update(LocalPlayer* player, f32 frametime, f32 busytime, f32 tool_reload_ratio) { // Get player position // Smooth the movement when walking up stairs @@ -408,19 +407,19 @@ void Camera::update(LocalPlayer* player, f32 frametime, f32 busytime, // Calculate new position bool abort = false; - for (int i = BS; i <= BS*2.75; i++) - { - my_cp.X = m_camera_position.X + m_camera_direction.X*-i; - my_cp.Z = m_camera_position.Z + m_camera_direction.Z*-i; + for (int i = BS; i <= BS * 2.75; i++) { + my_cp.X = m_camera_position.X + m_camera_direction.X * -i; + my_cp.Z = m_camera_position.Z + m_camera_direction.Z * -i; if (i > 12) - my_cp.Y = m_camera_position.Y + (m_camera_direction.Y*-i); + my_cp.Y = m_camera_position.Y + (m_camera_direction.Y * -i); // Prevent camera positioned inside nodes INodeDefManager *nodemgr = m_client->ndef(); - MapNode n = c_env.getClientMap().getNodeNoEx(floatToInt(my_cp, BS)); + MapNode n = m_client->getEnv().getClientMap() + .getNodeNoEx(floatToInt(my_cp, BS)); + const ContentFeatures& features = nodemgr->get(n); - if(features.walkable) - { + if (features.walkable) { my_cp.X += m_camera_direction.X*-1*-BS/2; my_cp.Z += m_camera_direction.Z*-1*-BS/2; my_cp.Y += m_camera_direction.Y*-1*-BS/2; diff --git a/src/camera.h b/src/camera.h index 052284ca..ce80fa9f 100644 --- a/src/camera.h +++ b/src/camera.h @@ -24,13 +24,10 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "inventory.h" #include "mesh.h" #include "client/tile.h" -#include "util/numeric.h" #include #include #include -#include "client.h" - class LocalPlayer; struct MapDrawControl; class Client; @@ -120,7 +117,7 @@ public: // Update the camera from the local player's position. // busytime is used to adjust the viewing range. void update(LocalPlayer* player, f32 frametime, f32 busytime, - f32 tool_reload_ratio, ClientEnvironment &c_env); + f32 tool_reload_ratio); // Update render distance void updateViewingRange(); diff --git a/src/client.cpp b/src/client.cpp index 402418ea..dc8e0d4e 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -22,6 +22,9 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include #include +#include "client.h" +#include "network/clientopcodes.h" +#include "network/networkpacket.h" #include "threading/mutex_auto_lock.h" #include "client/renderingengine.h" #include "util/auth.h" @@ -30,8 +33,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "util/serialize.h" #include "util/string.h" #include "util/srp.h" -#include "client.h" -#include "network/clientopcodes.h" #include "filesys.h" #include "mapblock_mesh.h" #include "mapblock.h" diff --git a/src/client.h b/src/client.h index 05f3ab9e..121f825b 100644 --- a/src/client.h +++ b/src/client.h @@ -38,7 +38,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "tileanimation.h" #include "mesh_generator_thread.h" #include -#include "filesys.h" #define CLIENT_CHAT_MESSAGE_LIMIT_PER_10S 10.0f diff --git a/src/client/inputhandler.h b/src/client/inputhandler.h index bc825188..f14e7d80 100644 --- a/src/client/inputhandler.h +++ b/src/client/inputhandler.h @@ -247,8 +247,8 @@ public: } return m_mousepos; - } + virtual void setMousePos(s32 x, s32 y) { if (RenderingEngine::get_raw_device()->getCursorControl()) { diff --git a/src/client/renderingengine.cpp b/src/client/renderingengine.cpp index 21af8948..70587116 100644 --- a/src/client/renderingengine.cpp +++ b/src/client/renderingengine.cpp @@ -21,10 +21,12 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include #include "fontengine.h" +#include "client.h" #include "clouds.h" #include "util/numeric.h" #include "guiscalingfilter.h" #include "hud.h" +#include "localplayer.h" #include "camera.h" #include "minimap.h" #include "clientmap.h" diff --git a/src/clientenvironment.cpp b/src/clientenvironment.cpp index 9abb6a23..c98b5fc9 100644 --- a/src/clientenvironment.cpp +++ b/src/clientenvironment.cpp @@ -19,6 +19,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "util/serialize.h" #include "util/pointedthing.h" +#include "client.h" #include "clientenvironment.h" #include "clientsimpleobject.h" #include "clientmap.h" diff --git a/src/clientenvironment.h b/src/clientenvironment.h index 070ff95f..35dca571 100644 --- a/src/clientenvironment.h +++ b/src/clientenvironment.h @@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include "environment.h" #include "clientobject.h" +#include "util/numeric.h" class ClientSimpleObject; class ClientMap; diff --git a/src/clientiface.cpp b/src/clientiface.cpp index fdabcc78..cdb64e19 100644 --- a/src/clientiface.cpp +++ b/src/clientiface.cpp @@ -18,18 +18,17 @@ with this program; if not, write to the Free Software Foundation, Inc., */ #include - #include "clientiface.h" +#include "network/connection.h" +#include "network/serveropcodes.h" #include "remoteplayer.h" #include "settings.h" #include "mapblock.h" -#include "network/connection.h" #include "serverenvironment.h" #include "map.h" #include "emerge.h" #include "content_sao.h" // TODO this is used for cleanup of only #include "log.h" -#include "network/serveropcodes.h" #include "util/srp.h" #include "face_position_cache.h" diff --git a/src/clientiface.h b/src/clientiface.h index ce74cfec..edc389cb 100644 --- a/src/clientiface.h +++ b/src/clientiface.h @@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "constants.h" #include "serialization.h" // for SER_FMT_VER_INVALID #include "network/networkpacket.h" +#include "network/networkprotocol.h" #include "porting.h" #include diff --git a/src/content_cao.cpp b/src/content_cao.cpp index 771820cb..90f08f36 100644 --- a/src/content_cao.cpp +++ b/src/content_cao.cpp @@ -41,6 +41,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "localplayer.h" #include "map.h" #include "camera.h" // CameraModes +#include "client.h" #include "wieldmesh.h" #include #include "client/renderingengine.h" diff --git a/src/content_mapblock.h b/src/content_mapblock.h index 51c5fc6e..d1c8c7ca 100644 --- a/src/content_mapblock.h +++ b/src/content_mapblock.h @@ -19,7 +19,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #ifndef CONTENT_MAPBLOCK_HEADER #define CONTENT_MAPBLOCK_HEADER -#include "util/numeric.h" + #include "nodedef.h" #include diff --git a/src/environment.h b/src/environment.h index 1b1cfc50..6c45592d 100644 --- a/src/environment.h +++ b/src/environment.h @@ -36,9 +36,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include #include "irr_v3d.h" -#include "activeobject.h" -#include "util/numeric.h" #include "network/networkprotocol.h" // for AccessDeniedCode +#include "util/basic_macros.h" class IGameDef; class Map; diff --git a/src/game.cpp b/src/game.cpp index 4588e21e..cdbd9230 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -3445,8 +3445,7 @@ void Game::updateCamera(u32 busy_time, f32 dtime) float tool_reload_ratio = runData.time_from_last_punch / full_punch_interval; tool_reload_ratio = MYMIN(tool_reload_ratio, 1.0); - camera->update(player, dtime, busy_time / 1000.0f, tool_reload_ratio, - client->getEnv()); + camera->update(player, dtime, busy_time / 1000.0f, tool_reload_ratio); camera->step(dtime); v3f camera_position = camera->getPosition(); diff --git a/src/gettext.h b/src/gettext.h index 885d7ca2..b87bdd9c 100644 --- a/src/gettext.h +++ b/src/gettext.h @@ -21,6 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #define GETTEXT_HEADER #include "config.h" // for USE_GETTEXT +#include #if USE_GETTEXT #include diff --git a/src/guiKeyChangeMenu.h b/src/guiKeyChangeMenu.h index 84d3fffc..84807c79 100644 --- a/src/guiKeyChangeMenu.h +++ b/src/guiKeyChangeMenu.h @@ -24,7 +24,6 @@ #include "irrlichttypes_extrabloated.h" #include "modalMenu.h" -#include "client.h" #include "gettext.h" #include "keycode.h" #include diff --git a/src/guiPasswordChange.cpp b/src/guiPasswordChange.cpp index ce1b66fd..69db4e6b 100644 --- a/src/guiPasswordChange.cpp +++ b/src/guiPasswordChange.cpp @@ -17,9 +17,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include "guiPasswordChange.h" -#include "debug.h" -#include "serialization.h" -#include +#include "client.h" #include #include #include diff --git a/src/guiPasswordChange.h b/src/guiPasswordChange.h index d9d21e7c..bb678fe2 100644 --- a/src/guiPasswordChange.h +++ b/src/guiPasswordChange.h @@ -21,9 +21,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "irrlichttypes_extrabloated.h" #include "modalMenu.h" -#include "client.h" #include +class Client; + class GUIPasswordChange : public GUIModalMenu { public: diff --git a/src/guiVolumeChange.h b/src/guiVolumeChange.h index 98731c67..0a743dcd 100644 --- a/src/guiVolumeChange.h +++ b/src/guiVolumeChange.h @@ -22,7 +22,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "irrlichttypes_extrabloated.h" #include "modalMenu.h" -#include "client.h" #include class GUIVolumeChange : public GUIModalMenu @@ -32,7 +31,7 @@ public: gui::IGUIElement* parent, s32 id, IMenuManager *menumgr); ~GUIVolumeChange(); - + void removeChildren(); /* Remove and re-add (or reposition) stuff @@ -42,7 +41,7 @@ public: void drawMenu(); bool OnEvent(const SEvent& event); - + bool pausesGame() { return true; } }; diff --git a/src/irrlichttypes.h b/src/irrlichttypes.h index dedebd45..33bfa9ee 100644 --- a/src/irrlichttypes.h +++ b/src/irrlichttypes.h @@ -28,7 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc., * regardless of the compiler. */ #ifndef _MSC_VER -# include +# include #endif #include diff --git a/src/localplayer.h b/src/localplayer.h index ffaa83f3..5c52a9c0 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -144,7 +144,9 @@ public: void setCollisionbox(const aabb3f &box) { m_collisionbox = box; } private: + // clang-format off void accelerateHorizontal(const v3f &target_speed, f32 max_increase, bool slippery); + // clang-format on void accelerateVertical(const v3f &target_speed, const f32 max_increase); bool updateSneakNode(Map *map, const v3f &position, const v3f &sneak_max); diff --git a/src/main.cpp b/src/main.cpp index b9530c55..ee391cf6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -21,6 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "mainmenumanager.h" #include "irrlichttypes_extrabloated.h" +#include "chat_interface.h" #include "debug.h" #include "unittest/test.h" #include "server.h" @@ -34,10 +35,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "quicktune.h" #include "httpfetch.h" #include "guiEngine.h" -#include "map.h" -#include "player.h" -#include "mapsector.h" -#include "fontengine.h" #include "gameparams.h" #include "database.h" #include "config.h" @@ -47,7 +44,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #endif #ifndef SERVER #include "client/clientlauncher.h" - #endif #ifdef HAVE_TOUCHSCREENGUI diff --git a/src/mapblock_mesh.cpp b/src/mapblock_mesh.cpp index 67195cab..5ab96a15 100644 --- a/src/mapblock_mesh.cpp +++ b/src/mapblock_mesh.cpp @@ -18,6 +18,7 @@ with this program; if not, write to the Free Software Foundation, Inc., */ #include "mapblock_mesh.h" +#include "client.h" #include "mapblock.h" #include "map.h" #include "profiler.h" diff --git a/src/mg_ore.cpp b/src/mg_ore.cpp index 36100f76..044d58db 100644 --- a/src/mg_ore.cpp +++ b/src/mg_ore.cpp @@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "noise.h" #include "map.h" #include "log.h" +#include "util/numeric.h" #include diff --git a/src/minimap.cpp b/src/minimap.cpp index 71a4c9c6..dab5f3aa 100644 --- a/src/minimap.cpp +++ b/src/minimap.cpp @@ -18,16 +18,10 @@ with this program; if not, write to the Free Software Foundation, Inc., */ #include "minimap.h" -#include "threading/mutex_auto_lock.h" -#include "threading/semaphore.h" +#include "client.h" #include "clientmap.h" #include "settings.h" -#include "nodedef.h" -#include "porting.h" -#include "util/numeric.h" -#include "util/string.h" #include "mapblock.h" -#include #include "client/renderingengine.h" @@ -37,16 +31,11 @@ with this program; if not, write to the Free Software Foundation, Inc., MinimapUpdateThread::~MinimapUpdateThread() { - for (std::map::iterator - it = m_blocks_cache.begin(); - it != m_blocks_cache.end(); ++it) { - delete it->second; + for (auto &it : m_blocks_cache) { + delete it.second; } - for (std::deque::iterator - it = m_update_queue.begin(); - it != m_update_queue.end(); ++it) { - QueuedMinimapUpdate &q = *it; + for (auto &q : m_update_queue) { delete q.data; } } diff --git a/src/minimap.h b/src/minimap.h index 01eafbe5..f087dbfa 100644 --- a/src/minimap.h +++ b/src/minimap.h @@ -21,18 +21,19 @@ with this program; if not, write to the Free Software Foundation, Inc., #define MINIMAP_HEADER #include "irrlichttypes_extrabloated.h" -#include "client.h" +#include "util/thread.h" #include "voxel.h" -#include "threading/semaphore.h" #include #include #include -#include "camera.h" + +class Client; +class ITextureSource; +class IShaderSource; #define MINIMAP_MAX_SX 512 #define MINIMAP_MAX_SY 512 - enum MinimapMode { MINIMAP_MODE_OFF, MINIMAP_MODE_SURFACEx1, diff --git a/src/network/clientopcodes.h b/src/network/clientopcodes.h index 43a93bb4..789c9c0b 100644 --- a/src/network/clientopcodes.h +++ b/src/network/clientopcodes.h @@ -23,7 +23,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "client.h" #include "networkprotocol.h" -#include "networkpacket.h" + +class NetworkPacket; enum ToClientConnectionState { TOCLIENT_STATE_NOT_CONNECTED, diff --git a/src/network/connection.cpp b/src/network/connection.cpp index d1ab948d..c93971ca 100644 --- a/src/network/connection.cpp +++ b/src/network/connection.cpp @@ -563,6 +563,20 @@ void IncomingSplitBuffer::removeUnreliableTimedOuts(float dtime, float timeout) } } +/* + ConnectionCommand + */ + +void ConnectionCommand::send(u16 peer_id_, u8 channelnum_, NetworkPacket *pkt, + bool reliable_) +{ + type = CONNCMD_SEND; + peer_id = peer_id_; + channelnum = channelnum_; + data = pkt->oldForgePacket(); + reliable = reliable_; +} + /* Channel */ diff --git a/src/network/connection.h b/src/network/connection.h index 289c7912..3dc87b48 100644 --- a/src/network/connection.h +++ b/src/network/connection.h @@ -24,7 +24,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "socket.h" #include "exceptions.h" #include "constants.h" -#include "network/networkpacket.h" #include "util/pointer.h" #include "util/container.h" #include "util/thread.h" @@ -433,15 +432,8 @@ struct ConnectionCommand type = CONNCMD_DISCONNECT_PEER; peer_id = peer_id_; } - void send(u16 peer_id_, u8 channelnum_, - NetworkPacket* pkt, bool reliable_) - { - type = CONNCMD_SEND; - peer_id = peer_id_; - channelnum = channelnum_; - data = pkt->oldForgePacket(); - reliable = reliable_; - } + + void send(u16 peer_id_, u8 channelnum_, NetworkPacket* pkt, bool reliable_); void ack(u16 peer_id_, u8 channelnum_, const SharedBuffer &data_) { diff --git a/src/network/networkpacket.cpp b/src/network/networkpacket.cpp index 78c73d25..ab7ddfb5 100644 --- a/src/network/networkpacket.cpp +++ b/src/network/networkpacket.cpp @@ -18,7 +18,7 @@ with this program; if not, write to the Free Software Foundation, Inc., */ #include "networkpacket.h" -#include "debug.h" +#include #include "exceptions.h" #include "util/serialize.h" diff --git a/src/network/networkpacket.h b/src/network/networkpacket.h index 7eb8cc3f..40a20eb2 100644 --- a/src/network/networkpacket.h +++ b/src/network/networkpacket.h @@ -20,9 +20,9 @@ with this program; if not, write to the Free Software Foundation, Inc., #ifndef NETWORKPACKET_HEADER #define NETWORKPACKET_HEADER +#include #include "util/pointer.h" #include "util/numeric.h" -#include "networkprotocol.h" class NetworkPacket { diff --git a/src/network/serveropcodes.h b/src/network/serveropcodes.h index 72323ae2..296b7d47 100644 --- a/src/network/serveropcodes.h +++ b/src/network/serveropcodes.h @@ -23,7 +23,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "server.h" #include "networkprotocol.h" -#include "networkpacket.h" + +class NetworkPacket; enum ToServerConnectionState { TOSERVER_STATE_NOT_CONNECTED, diff --git a/src/nodedef.h b/src/nodedef.h index 66296016..6ae72940 100644 --- a/src/nodedef.h +++ b/src/nodedef.h @@ -25,7 +25,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include #include -#include "util/numeric.h" #include "mapnode.h" #ifndef SERVER #include "client/tile.h" diff --git a/src/noise.h b/src/noise.h index d5aca4de..53cab575 100644 --- a/src/noise.h +++ b/src/noise.h @@ -111,7 +111,7 @@ struct NoiseParams { float lacunarity = 2.0f; u32 flags = NOISE_FLAG_DEFAULTS; - NoiseParams() {} + NoiseParams() = default; NoiseParams(float offset_, float scale_, v3f spread_, s32 seed_, u16 octaves_, float persist_, float lacunarity_, diff --git a/src/script/cpp_api/s_async.h b/src/script/cpp_api/s_async.h index 94b55db6..aa1559ed 100644 --- a/src/script/cpp_api/s_async.h +++ b/src/script/cpp_api/s_async.h @@ -24,8 +24,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include -#include "threading/thread.h" #include "threading/semaphore.h" +#include "threading/thread.h" #include "debug.h" #include "lua.h" #include "cpp_api/s_base.h" @@ -39,7 +39,7 @@ class AsyncEngine; // Data required to queue a job struct LuaJobInfo { - LuaJobInfo() {}; + LuaJobInfo() = default; // Function to be called in async environment std::string serializedFunction = ""; diff --git a/src/script/cpp_api/s_base.h b/src/script/cpp_api/s_base.h index 28fefdd3..ff92bdf9 100644 --- a/src/script/cpp_api/s_base.h +++ b/src/script/cpp_api/s_base.h @@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include #include +#include #include "util/basic_macros.h" extern "C" { @@ -30,7 +31,6 @@ extern "C" { } #include "irrlichttypes.h" -#include "threading/mutex_auto_lock.h" #include "common/c_types.h" #include "common/c_internal.h" diff --git a/src/script/cpp_api/s_internal.h b/src/script/cpp_api/s_internal.h index 315561e0..b493cb6f 100644 --- a/src/script/cpp_api/s_internal.h +++ b/src/script/cpp_api/s_internal.h @@ -30,6 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include "common/c_internal.h" #include "cpp_api/s_base.h" +#include "threading/mutex_auto_lock.h" #ifdef SCRIPTAPI_LOCK_DEBUG #include "debug.h" // assert() diff --git a/src/script/lua_api/l_base.h b/src/script/lua_api/l_base.h index af89afd9..e9b28b36 100644 --- a/src/script/lua_api/l_base.h +++ b/src/script/lua_api/l_base.h @@ -30,7 +30,7 @@ extern "C" { } #ifndef SERVER -#include "client.h" +class Client; #endif class ScriptApiBase; diff --git a/src/script/lua_api/l_camera.cpp b/src/script/lua_api/l_camera.cpp index ef842a22..49622df0 100644 --- a/src/script/lua_api/l_camera.cpp +++ b/src/script/lua_api/l_camera.cpp @@ -3,6 +3,7 @@ #include "l_internal.h" #include "content_cao.h" #include "camera.h" +#include "client.h" LuaCamera::LuaCamera(Camera *m) : m_camera(m) { diff --git a/src/script/lua_api/l_client.cpp b/src/script/lua_api/l_client.cpp index 6f924046..81dfdb1e 100644 --- a/src/script/lua_api/l_client.cpp +++ b/src/script/lua_api/l_client.cpp @@ -20,6 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "l_client.h" #include "chatmessage.h" +#include "client.h" #include "clientenvironment.h" #include "common/c_content.h" #include "common/c_converter.h" diff --git a/src/script/lua_api/l_env.cpp b/src/script/lua_api/l_env.cpp index 2a57ca59..9a2ce334 100644 --- a/src/script/lua_api/l_env.cpp +++ b/src/script/lua_api/l_env.cpp @@ -37,6 +37,9 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "emerge.h" #include "pathfinder.h" #include "face_position_cache.h" +#ifndef SERVER +#include "client.h" +#endif struct EnumString ModApiEnvMod::es_ClearObjectsMode[] = { diff --git a/src/script/lua_api/l_localplayer.cpp b/src/script/lua_api/l_localplayer.cpp index 7f932cbc..da560c3a 100644 --- a/src/script/lua_api/l_localplayer.cpp +++ b/src/script/lua_api/l_localplayer.cpp @@ -20,6 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "l_localplayer.h" #include "l_internal.h" #include "script/common/c_converter.h" +#include "localplayer.h" LuaLocalPlayer::LuaLocalPlayer(LocalPlayer *m) : m_localplayer(m) { diff --git a/src/script/lua_api/l_minimap.cpp b/src/script/lua_api/l_minimap.cpp index be981c88..b59e7909 100644 --- a/src/script/lua_api/l_minimap.cpp +++ b/src/script/lua_api/l_minimap.cpp @@ -21,6 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "lua_api/l_minimap.h" #include "lua_api/l_internal.h" #include "common/c_converter.h" +#include "client.h" #include "minimap.h" #include "settings.h" diff --git a/src/server.cpp b/src/server.cpp index 4ccac574..41493a86 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -61,6 +61,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "util/hex.h" #include "database.h" #include "chatmessage.h" +#include "chat_interface.h" class ClientNotFoundException : public BaseException { diff --git a/src/server.h b/src/server.h index ac7ba4f6..aae589f9 100644 --- a/src/server.h +++ b/src/server.h @@ -34,16 +34,17 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "util/thread.h" #include "util/basic_macros.h" #include "serverenvironment.h" -#include "chat_interface.h" #include "clientiface.h" #include "remoteplayer.h" -#include "network/networkpacket.h" #include "chatmessage.h" #include #include #include #include +class ChatEvent; +struct ChatEventChat; +struct ChatInterface; class IWritableItemDefManager; class IWritableNodeDefManager; class IWritableCraftDefManager; diff --git a/src/serverenvironment.h b/src/serverenvironment.h index 4cfe7f7d..c9f80a4c 100644 --- a/src/serverenvironment.h +++ b/src/serverenvironment.h @@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "environment.h" #include "mapnode.h" #include "mapblock.h" +#include "activeobject.h" #include class IGameDef; diff --git a/src/terminal_chat_console.cpp b/src/terminal_chat_console.cpp index a8c4ebae..222c0864 100644 --- a/src/terminal_chat_console.cpp +++ b/src/terminal_chat_console.cpp @@ -25,6 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "settings.h" #include "util/numeric.h" #include "util/string.h" +#include "chat_interface.h" TerminalChatConsole g_term_console; diff --git a/src/terminal_chat_console.h b/src/terminal_chat_console.h index 8f6abe29..b656f887 100644 --- a/src/terminal_chat_console.h +++ b/src/terminal_chat_console.h @@ -22,11 +22,13 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "chat.h" #include "threading/thread.h" -#include "chat_interface.h" +#include "util/container.h" #include "log.h" - #include + +struct ChatInterface; + class TermLogOutput : public ILogOutput { public: diff --git a/src/unittest/test.cpp b/src/unittest/test.cpp index 911b647f..b52189cb 100644 --- a/src/unittest/test.cpp +++ b/src/unittest/test.cpp @@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "itemdef.h" #include "gamedef.h" #include "mods.h" +#include "util/numeric.h" content_t t_CONTENT_STONE; content_t t_CONTENT_GRASS; diff --git a/src/unittest/test_connection.cpp b/src/unittest/test_connection.cpp index 3ea3d744..c23d2a06 100644 --- a/src/unittest/test_connection.cpp +++ b/src/unittest/test_connection.cpp @@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "settings.h" #include "util/serialize.h" #include "network/connection.h" +#include "network/networkpacket.h" class TestConnection : public TestBase { public: