Optimize headers (part 2) (#6272)
authorLoïc Blot <nerzhul@users.noreply.github.com>
Fri, 18 Aug 2017 17:25:07 +0000 (19:25 +0200)
committerGitHub <noreply@github.com>
Fri, 18 Aug 2017 17:25:07 +0000 (19:25 +0200)
* Optimize headers (part 2)

* less debug.h in headers
* less remoteplayer.h for everybody

* Cleanup (part 2)

* camera.h: mesh.h
* mapgen.h: mapnode.h
* serverenvironment.h: mapblock.h
* nodedef.h: shader.h

42 files changed:
src/camera.cpp
src/camera.h
src/client.cpp
src/client/clientlauncher.cpp
src/clientenvironment.cpp
src/database-postgresql.cpp
src/dungeongen.cpp
src/game.cpp
src/hud.cpp
src/inventory.h
src/inventorymanager.cpp
src/main.cpp
src/mainmenumanager.h
src/map.h
src/mapblock.h
src/mapblock_mesh.cpp
src/mapgen.h
src/minimap.cpp
src/network/serverpackethandler.cpp
src/nodedef.cpp
src/nodedef.h
src/particles.cpp
src/particles.h
src/profiler.h
src/script/cpp_api/s_async.h
src/script/cpp_api/s_internal.h
src/script/lua_api/l_env.cpp
src/script/lua_api/l_inventory.cpp
src/script/lua_api/l_nodemeta.cpp
src/script/lua_api/l_object.cpp
src/script/lua_api/l_server.cpp
src/script/lua_api/l_vmanip.cpp
src/script/scripting_mainmenu.cpp
src/server.cpp
src/server.h
src/serverenvironment.cpp
src/serverenvironment.h
src/serverobject.cpp
src/treegen.cpp
src/voxel.h
src/wieldmesh.cpp
src/wieldmesh.h

index b7aed5d748fda67dc330d4d40f8194f4af7189d9..7746b65df08b47475f44d5fd407ef178bad0a38e 100644 (file)
@@ -30,7 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "noise.h"         // easeCurve
 #include "sound.h"
 #include "event.h"
-#include "profiler.h"
+#include "nodedef.h"
 #include "util/numeric.h"
 #include "constants.h"
 #include "fontengine.h"
index b8de3b1db3246623c3e83f16d0f9bf876ee7769e..0b5c7441f4a6c31d0373d5bd92e80d7071ce40e8 100644 (file)
@@ -21,7 +21,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 #include "irrlichttypes_extrabloated.h"
 #include "inventory.h"
-#include "mesh.h"
 #include "client/tile.h"
 #include <ICameraSceneNode.h>
 #include <ISceneNode.h>
index dc8e0d4e2cc38de7f0ed8ce1318190c7b2a3be69..ab0eddcdcaf0c7780c0c8823a639eb5b8d98ff29 100644 (file)
@@ -39,6 +39,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "minimap.h"
 #include "mods.h"
 #include "profiler.h"
+#include "shader.h"
 #include "gettext.h"
 #include "clientmap.h"
 #include "clientmedia.h"
index 644adbbf94d1593fa02e8ce15fcd9c4a50479d7f..3d5d14ae72a3f4186435beaed08436e46fae8e90 100644 (file)
@@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "filesys.h"
 #include "guiMainMenu.h"
 #include "game.h"
+#include "player.h"
 #include "chat.h"
 #include "gettext.h"
 #include "profiler.h"
index 57b18760af432b84b7757291ffed80f0b5713888..2a5adea75f4204e0518441c297044b38d7f5f698 100644 (file)
@@ -27,6 +27,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "mapblock_mesh.h"
 #include "event.h"
 #include "collision.h"
+#include "nodedef.h"
 #include "profiler.h"
 #include "raycast.h"
 #include "voxelalgorithms.h"
index de1601d0dbf996d6bf87e6001514484843c6bdbf..74651135a84b26239f486377ba1ec23a21cb137f 100644 (file)
@@ -33,7 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include <netinet/in.h>
 #endif
 
-#include "log.h"
+#include "debug.h"
 #include "exceptions.h"
 #include "settings.h"
 #include "content_sao.h"
index 851b1e25ff705b1a98763805655c8db46309408f..fa867b3988494f75ec0de1d4ddf4a4dda4dd8c20 100644 (file)
@@ -25,7 +25,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "mapnode.h"
 #include "map.h"
 #include "nodedef.h"
-#include "profiler.h"
 #include "settings.h"
 
 //#define DGEN_USE_TORCHES
index 3634d6b6fe88de11c2d1c1609b8af180541b7710..c71fa457b622c08af63c87f25e61bcf9543d621e 100644 (file)
@@ -66,6 +66,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 #if USE_SOUND
        #include "sound_openal.h"
+#include "shader.h"
+
 #endif
 
 extern Settings *g_settings;
index 14e784a62621a6f387fb3f8cfebbc2c307a4752e..339f50d4c392eef71f052b7076972cc98f23839a 100644 (file)
@@ -25,6 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "log.h"
 #include "client.h"
 #include "inventory.h"
+#include "shader.h"
 #include "client/tile.h"
 #include "localplayer.h"
 #include "camera.h"
@@ -33,7 +34,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "guiscalingfilter.h"
 #include "mesh.h"
 #include "wieldmesh.h"
-#include <IGUIStaticText.h>
 #include "client/renderingengine.h"
 
 #ifdef HAVE_TOUCHSCREENGUI
index aff0ce20fea4de7ca81ada6d6daf91a59ecedd95..459228d3e328f2cb03b2eb73666d339195c2d64a 100644 (file)
@@ -19,7 +19,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 #pragma once
 
-#include "debug.h"
 #include "itemdef.h"
 #include "irrlichttypes.h"
 #include "itemstackmetadata.h"
@@ -27,6 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include <ostream>
 #include <string>
 #include <vector>
+#include <cassert>
 
 struct ToolCapabilities;
 
index d4315f7a47369523ad91cd88a58127195f5374b4..25f601742b66702a6008e3feace2081a88df6e47 100644 (file)
@@ -18,6 +18,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 */
 
 #include "inventorymanager.h"
+#include "debug.h"
 #include "log.h"
 #include "serverenvironment.h"
 #include "scripting_server.h"
index 303004f0c6baf7cd8cb330ca768fcc7c147452fa..52c8aff3cdf9cb8e318cc8752f42a18ca6a7a415 100644 (file)
@@ -18,7 +18,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 */
 
 #include "irrlicht.h" // createDevice
-
 #include "mainmenumanager.h"
 #include "irrlichttypes_extrabloated.h"
 #include "chat_interface.h"
@@ -38,6 +37,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "gameparams.h"
 #include "database.h"
 #include "config.h"
+#include "player.h"
 #include "porting.h"
 #if USE_CURSES
        #include "terminal_chat_console.h"
index 49bc88dff27edbdc3bcbd3415fb5e7f3d8531c12..c9964a97ed044900eec2ccc9928fa1c21db1bb64 100644 (file)
@@ -22,8 +22,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 /*
        All kinds of stuff that needs to be exposed from main.cpp
 */
-#include "debug.h" // assert
 #include "modalMenu.h"
+#include <cassert>
 #include <list>
 
 class IGameCallback
index 81f32baeaf9a6376b007a53aa8f051c293b282f5..93ab591a3c0184428a29a80c614d226ae1db7b75 100644 (file)
--- a/src/map.h
+++ b/src/map.h
@@ -33,6 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "util/container.h"
 #include "nodetimer.h"
 #include "map_settings_manager.h"
+#include "debug.h"
 
 class Settings;
 class MapDatabase;
index d6f99b36ceb265cb4e6e1c2f1eeab9282ccb52bf..84991631dfb22e46c3638132dd92bb31253a4a59 100644 (file)
@@ -20,7 +20,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #pragma once
 
 #include <set>
-#include "debug.h"
 #include "irr_v3d.h"
 #include "mapnode.h"
 #include "exceptions.h"
index 5ab96a156c2fb44b7a8274ac9e9219a380dc5d29..f1eb2c5b2093db2fec0e7122256233ba4d838b65 100644 (file)
@@ -22,6 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "mapblock.h"
 #include "map.h"
 #include "profiler.h"
+#include "shader.h"
 #include "mesh.h"
 #include "minimap.h"
 #include "content_mapblock.h"
index 6701cfdd0167d5c421b44c7f953fb10490cc50f0..7b79041895a4102a8df42f612cc8746dca1c53bd 100644 (file)
@@ -23,7 +23,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 #include "noise.h"
 #include "nodedef.h"
-#include "mapnode.h"
 #include "util/string.h"
 #include "util/container.h"
 
index f35330963d74c2afad5d917ee0f3c3be92750170..5b9b27b8ec9af3211c2e5cd2f1254ad5960bc2aa 100644 (file)
@@ -21,6 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "client.h"
 #include "clientmap.h"
 #include "settings.h"
+#include "shader.h"
 #include "mapblock.h"
 #include "client/renderingengine.h"
 
index 64c754ee551d444ae7674a951b4da5787db8c682..e6b400750f7afba206898a1c1c7b5b1d5e18e498 100644 (file)
@@ -17,15 +17,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
-#include <chatmessage.h>
+#include "chatmessage.h"
 #include "server.h"
 #include "log.h"
-
 #include "content_sao.h"
 #include "emerge.h"
 #include "mapblock.h"
 #include "nodedef.h"
-#include "player.h"
+#include "remoteplayer.h"
 #include "rollback_interface.h"
 #include "scripting_server.h"
 #include "settings.h"
index fc404f252a73da4d789e3908edfbe9bf83c1d11b..651418cd80c46029020f29c1563b46098d6b3e9b 100644 (file)
@@ -22,6 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "itemdef.h"
 #ifndef SERVER
 #include "mesh.h"
+#include "shader.h"
 #include "client.h"
 #include "client/renderingengine.h"
 #include "client/tile.h"
index aeee81988955974bbb478cf9ca10154071970bdd..f3fb834bc5651fceea7baf62947a7fab4e8e96c9 100644 (file)
@@ -27,7 +27,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "mapnode.h"
 #ifndef SERVER
 #include "client/tile.h"
-#include "shader.h"
 #include <IMeshManipulator.h>
 class Client;
 #endif
index b86266f42fdb631cd86c5874a79fa85eab6ae951..e756a88d18ba3b809eee04d86145d7b2dde6a41a 100644 (file)
@@ -20,13 +20,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "particles.h"
 #include "client.h"
 #include "collision.h"
-#include <stdlib.h>
 #include "client/renderingengine.h"
 #include "util/numeric.h"
 #include "light.h"
 #include "environment.h"
 #include "clientmap.h"
 #include "mapnode.h"
+#include "nodedef.h"
 #include "client.h"
 #include "settings.h"
 
index b3c02f4c463ffff3dbd1251b2746988c2100ec56..64b4db0c400aa500c417eb2da90c16a2d7200e0b 100644 (file)
@@ -23,7 +23,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "irrlichttypes_extrabloated.h"
 #include "client/tile.h"
 #include "localplayer.h"
-#include "environment.h"
 #include "tileanimation.h"
 
 struct ClientEvent;
index fade4c924779e9167e3ab36866166859aa2cb65c..78055b0d4850aa470b64f91d8780cea363c7cd6d 100644 (file)
@@ -20,13 +20,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #pragma once
 
 #include "irrlichttypes.h"
+#include <cassert>
 #include <string>
 #include <map>
+#include <ostream>
 
 #include "threading/mutex_auto_lock.h"
 #include "util/timetaker.h"
 #include "util/numeric.h"      // paging()
-#include "debug.h"             // assert()
 
 #define MAX_PROFILER_TEXT_ROWS 20
 
index 01c3ad00537d11179e6052b676ccf1cfd4ceccae..38eb4800ae0f33227c90b69097524de3da3f6c41 100644 (file)
@@ -25,7 +25,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 #include "threading/semaphore.h"
 #include "threading/thread.h"
-#include "debug.h"
 #include "lua.h"
 #include "cpp_api/s_base.h"
 
index fc049f9226ffa1230317d6f8e30abf1dcb7fb659..83b3b9d27646e57d2b22e9f2808b91b604c40ab0 100644 (file)
@@ -32,7 +32,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "threading/mutex_auto_lock.h"
 
 #ifdef SCRIPTAPI_LOCK_DEBUG
-#include "debug.h" // assert()
+#include <cassert>
 
 class LockChecker {
 public:
index 9a2ce334b70cf1d0be0bae53984e844d7bb91d43..1b1f963898e4c2be521ceeb9f62b3e2a131fe753 100644 (file)
@@ -28,6 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include <algorithm>
 #include "scripting_server.h"
 #include "environment.h"
+#include "mapblock.h"
 #include "server.h"
 #include "nodedef.h"
 #include "daynightratio.h"
@@ -37,6 +38,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "emerge.h"
 #include "pathfinder.h"
 #include "face_position_cache.h"
+#include "remoteplayer.h"
 #ifndef SERVER
 #include "client.h"
 #endif
index e92197c141f8b9f1330a33baa28a34af9def9837..aac5eed8e8d90221841502de2f242fce11238772 100644 (file)
@@ -23,7 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "common/c_converter.h"
 #include "common/c_content.h"
 #include "server.h"
-#include "player.h"
+#include "remoteplayer.h"
 
 /*
        InvRef
index c446a8f07bceffb709e0057b39906be6c5df7948..d1f3140793ddae2926d4102dcb6219f7b86bb775 100644 (file)
@@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "common/c_content.h"
 #include "serverenvironment.h"
 #include "map.h"
+#include "mapblock.h"
 #include "server.h"
 
 /*
index 7d2eba8e252e28a5e46075ec3227d7b61e512781..9ddbc3e419ebc6a3e4379aee21582cd3098dba8e 100644 (file)
@@ -27,6 +27,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "tool.h"
 #include "serverobject.h"
 #include "content_sao.h"
+#include "remoteplayer.h"
 #include "server.h"
 #include "hud.h"
 #include "scripting_server.h"
index e60d1d2d6e4fb101b220b0aa1042def1ce44799a..d99f46cd1c1c82c4d4abdfa59e22528d32a323db 100644 (file)
@@ -24,7 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "cpp_api/s_base.h"
 #include "server.h"
 #include "environment.h"
-#include "player.h"
+#include "remoteplayer.h"
 #include "log.h"
 #include <algorithm>
 
index 9e482873bdf55f625f05db3af5a7834070fdbe29..1e973703c52630aae082ac9bfa7beee48ac45281 100644 (file)
@@ -25,6 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "emerge.h"
 #include "environment.h"
 #include "map.h"
+#include "mapblock.h"
 #include "server.h"
 #include "mapgen.h"
 #include "voxelalgorithms.h"
index e2f735927b48859f6e3e84af02f5cbbc883c82af..b8a44205a9fc962c9853087b43aa42b69396ef7d 100644 (file)
@@ -25,6 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "lua_api/l_sound.h"
 #include "lua_api/l_util.h"
 #include "lua_api/l_settings.h"
+#include "log.h"
 
 extern "C" {
 #include "lualib.h"
index 685f1f667b10722483e8b9f38dc1b5ce8049a0c1..c74cc539430fd546503ef9b7eed546d1a3d3f8b4 100644 (file)
@@ -62,6 +62,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "database.h"
 #include "chatmessage.h"
 #include "chat_interface.h"
+#include "remoteplayer.h"
 
 class ClientNotFoundException : public BaseException
 {
@@ -3122,6 +3123,11 @@ bool Server::hudSetHotbarItemcount(RemotePlayer *player, s32 hotbar_itemcount)
        return true;
 }
 
+s32 Server::hudGetHotbarItemcount(RemotePlayer *player) const
+{
+       return player->getHotbarItemcount();
+}
+
 void Server::hudSetHotbarImage(RemotePlayer *player, std::string name)
 {
        if (!player)
@@ -3147,6 +3153,11 @@ void Server::hudSetHotbarSelectedImage(RemotePlayer *player, std::string name)
        SendHUDSetParam(player->peer_id, HUD_PARAM_HOTBAR_SELECTED_IMAGE, name);
 }
 
+const std::string& Server::hudGetHotbarSelectedImage(RemotePlayer *player) const
+{
+       return player->getHotbarSelectedImage();
+}
+
 bool Server::setLocalPlayerAnimations(RemotePlayer *player,
                v2s32 animation_frames[4], f32 frame_speed)
 {
index 6955306dd7aaa7c456b8aca583f3a25548b8a179..eeb134a5c6b1f6767c9d4130b6fb5578ef267477 100644 (file)
@@ -34,7 +34,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "util/basic_macros.h"
 #include "serverenvironment.h"
 #include "clientiface.h"
-#include "remoteplayer.h"
 #include "chatmessage.h"
 #include <string>
 #include <list>
@@ -50,6 +49,7 @@ class IWritableCraftDefManager;
 class BanManager;
 class EventManager;
 class Inventory;
+class RemotePlayer;
 class PlayerSAO;
 class IRollbackManager;
 struct RollbackAction;
@@ -285,15 +285,11 @@ public:
        bool hudChange(RemotePlayer *player, u32 id, HudElementStat stat, void *value);
        bool hudSetFlags(RemotePlayer *player, u32 flags, u32 mask);
        bool hudSetHotbarItemcount(RemotePlayer *player, s32 hotbar_itemcount);
-       s32 hudGetHotbarItemcount(RemotePlayer *player) const
-                       { return player->getHotbarItemcount(); }
+       s32 hudGetHotbarItemcount(RemotePlayer *player) const;
        void hudSetHotbarImage(RemotePlayer *player, std::string name);
        std::string hudGetHotbarImage(RemotePlayer *player);
        void hudSetHotbarSelectedImage(RemotePlayer *player, std::string name);
-       const std::string &hudGetHotbarSelectedImage(RemotePlayer *player) const
-       {
-               return player->getHotbarSelectedImage();
-       }
+       const std::string &hudGetHotbarSelectedImage(RemotePlayer *player) const;
 
        inline Address getPeerAddress(u16 peer_id)
                        { return m_con.GetPeerAddress(peer_id); }
index 2fb12692b75406a1cd470f4e80a5c2a3d79fdcf8..4cc76b96fc514aefb0cdf78f52e3fd505b39b0ad 100644 (file)
@@ -21,6 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "content_sao.h"
 #include "settings.h"
 #include "log.h"
+#include "mapblock.h"
 #include "nodedef.h"
 #include "nodemetadata.h"
 #include "gamedef.h"
index 3428d3c99c7b681c2846622db4315195f4046819..36f3e20673bba32b6502438078ed75b4c24f5bf8 100644 (file)
@@ -19,15 +19,17 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 #pragma once
 
+#include "activeobject.h"
 #include "environment.h"
 #include "mapnode.h"
-#include "mapblock.h"
-#include "activeobject.h"
+#include "settings.h"
+#include "util/numeric.h"
 #include <set>
 
 class IGameDef;
 class ServerMap;
 struct GameParams;
+class MapBlock;
 class RemotePlayer;
 class PlayerDatabase;
 class PlayerSAO;
index f477700dd3a4a3115f017a97beee0ba49007dd1b..f98290beaaaf334ac5aa0fb76a5d26bda834b76b 100644 (file)
@@ -21,6 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include <fstream>
 #include "inventory.h"
 #include "constants.h" // BS
+#include "log.h"
 
 ServerActiveObject::ServerActiveObject(ServerEnvironment *env, v3f pos):
        ActiveObject(0),
index 25f614d273780936682cf53663ca1b45c3560d1d..0806f292755b29aab3ccdaa9408acf1a739c92fa 100644 (file)
@@ -22,6 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "util/pointer.h"
 #include "util/numeric.h"
 #include "map.h"
+#include "mapblock.h"
 #include "serverenvironment.h"
 #include "nodedef.h"
 #include "treegen.h"
index 599a57de461e6912d767b37899a6a3dc1551e9bc..49a75c95f6f53aedc21ea22cc2bab6c86be28392 100644 (file)
@@ -22,7 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "irrlichttypes.h"
 #include "irr_v3d.h"
 #include <iostream>
-#include "debug.h"
+#include <cassert>
 #include "exceptions.h"
 #include "mapnode.h"
 #include <set>
index c532a048c0d0327ce737561808e725af1dafdcf1..dbec4a1775465cbb0e52e7606f468b214020c277 100644 (file)
@@ -17,8 +17,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
-#include "settings.h"
 #include "wieldmesh.h"
+#include "settings.h"
+#include "shader.h"
 #include "inventory.h"
 #include "client.h"
 #include "itemdef.h"
index c10ff66a4f51c2581eeecc0935a8208b7be021de..51ba20536fb4b52758c9cc8348babc796e7304ca 100644 (file)
@@ -20,6 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #pragma once
 
 #include <string>
+#include <vector>
 #include "irrlichttypes_extrabloated.h"
 
 struct ItemStack;