diff options
author | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-08-18 19:25:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-18 19:25:07 +0200 |
commit | fd3afbced5410639325e730d5710b8b5039b320e (patch) | |
tree | 72e7059aa256706062b9ce2cd9ec5b0df76f5ede | |
parent | c42753338924bb29c61081c9f269772f89bcd808 (diff) | |
download | minetest-fd3afbced5410639325e730d5710b8b5039b320e.tar.gz minetest-fd3afbced5410639325e730d5710b8b5039b320e.tar.bz2 minetest-fd3afbced5410639325e730d5710b8b5039b320e.zip |
Optimize headers (part 2) (#6272)
* 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, 55 insertions, 32 deletions
diff --git a/src/camera.cpp b/src/camera.cpp index b7aed5d74..7746b65df 100644 --- a/src/camera.cpp +++ b/src/camera.cpp @@ -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" diff --git a/src/camera.h b/src/camera.h index b8de3b1db..0b5c7441f 100644 --- a/src/camera.h +++ b/src/camera.h @@ -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> diff --git a/src/client.cpp b/src/client.cpp index dc8e0d4e2..ab0eddcdc 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -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" diff --git a/src/client/clientlauncher.cpp b/src/client/clientlauncher.cpp index 644adbbf9..3d5d14ae7 100644 --- a/src/client/clientlauncher.cpp +++ b/src/client/clientlauncher.cpp @@ -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" diff --git a/src/clientenvironment.cpp b/src/clientenvironment.cpp index 57b18760a..2a5adea75 100644 --- a/src/clientenvironment.cpp +++ b/src/clientenvironment.cpp @@ -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" diff --git a/src/database-postgresql.cpp b/src/database-postgresql.cpp index de1601d0d..74651135a 100644 --- a/src/database-postgresql.cpp +++ b/src/database-postgresql.cpp @@ -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" diff --git a/src/dungeongen.cpp b/src/dungeongen.cpp index 851b1e25f..fa867b398 100644 --- a/src/dungeongen.cpp +++ b/src/dungeongen.cpp @@ -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 diff --git a/src/game.cpp b/src/game.cpp index 3634d6b6f..c71fa457b 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -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; diff --git a/src/hud.cpp b/src/hud.cpp index 14e784a62..339f50d4c 100644 --- a/src/hud.cpp +++ b/src/hud.cpp @@ -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 diff --git a/src/inventory.h b/src/inventory.h index aff0ce20f..459228d3e 100644 --- a/src/inventory.h +++ b/src/inventory.h @@ -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; diff --git a/src/inventorymanager.cpp b/src/inventorymanager.cpp index d4315f7a4..25f601742 100644 --- a/src/inventorymanager.cpp +++ b/src/inventorymanager.cpp @@ -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" diff --git a/src/main.cpp b/src/main.cpp index 303004f0c..52c8aff3c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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" diff --git a/src/mainmenumanager.h b/src/mainmenumanager.h index 49bc88dff..c9964a97e 100644 --- a/src/mainmenumanager.h +++ b/src/mainmenumanager.h @@ -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 @@ -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; diff --git a/src/mapblock.h b/src/mapblock.h index d6f99b36c..84991631d 100644 --- a/src/mapblock.h +++ b/src/mapblock.h @@ -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" diff --git a/src/mapblock_mesh.cpp b/src/mapblock_mesh.cpp index 5ab96a156..f1eb2c5b2 100644 --- a/src/mapblock_mesh.cpp +++ b/src/mapblock_mesh.cpp @@ -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" diff --git a/src/mapgen.h b/src/mapgen.h index 6701cfdd0..7b7904189 100644 --- a/src/mapgen.h +++ b/src/mapgen.h @@ -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" diff --git a/src/minimap.cpp b/src/minimap.cpp index f35330963..5b9b27b8e 100644 --- a/src/minimap.cpp +++ b/src/minimap.cpp @@ -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" diff --git a/src/network/serverpackethandler.cpp b/src/network/serverpackethandler.cpp index 64c754ee5..e6b400750 100644 --- a/src/network/serverpackethandler.cpp +++ b/src/network/serverpackethandler.cpp @@ -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" diff --git a/src/nodedef.cpp b/src/nodedef.cpp index fc404f252..651418cd8 100644 --- a/src/nodedef.cpp +++ b/src/nodedef.cpp @@ -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" diff --git a/src/nodedef.h b/src/nodedef.h index aeee81988..f3fb834bc 100644 --- a/src/nodedef.h +++ b/src/nodedef.h @@ -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 diff --git a/src/particles.cpp b/src/particles.cpp index b86266f42..e756a88d1 100644 --- a/src/particles.cpp +++ b/src/particles.cpp @@ -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" diff --git a/src/particles.h b/src/particles.h index b3c02f4c4..64b4db0c4 100644 --- a/src/particles.h +++ b/src/particles.h @@ -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; diff --git a/src/profiler.h b/src/profiler.h index fade4c924..78055b0d4 100644 --- a/src/profiler.h +++ b/src/profiler.h @@ -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 diff --git a/src/script/cpp_api/s_async.h b/src/script/cpp_api/s_async.h index 01c3ad005..38eb4800a 100644 --- a/src/script/cpp_api/s_async.h +++ b/src/script/cpp_api/s_async.h @@ -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" diff --git a/src/script/cpp_api/s_internal.h b/src/script/cpp_api/s_internal.h index fc049f922..83b3b9d27 100644 --- a/src/script/cpp_api/s_internal.h +++ b/src/script/cpp_api/s_internal.h @@ -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: diff --git a/src/script/lua_api/l_env.cpp b/src/script/lua_api/l_env.cpp index 9a2ce334b..1b1f96389 100644 --- a/src/script/lua_api/l_env.cpp +++ b/src/script/lua_api/l_env.cpp @@ -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 diff --git a/src/script/lua_api/l_inventory.cpp b/src/script/lua_api/l_inventory.cpp index e92197c14..aac5eed8e 100644 --- a/src/script/lua_api/l_inventory.cpp +++ b/src/script/lua_api/l_inventory.cpp @@ -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 diff --git a/src/script/lua_api/l_nodemeta.cpp b/src/script/lua_api/l_nodemeta.cpp index c446a8f07..d1f314079 100644 --- a/src/script/lua_api/l_nodemeta.cpp +++ b/src/script/lua_api/l_nodemeta.cpp @@ -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" /* diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp index 7d2eba8e2..9ddbc3e41 100644 --- a/src/script/lua_api/l_object.cpp +++ b/src/script/lua_api/l_object.cpp @@ -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" diff --git a/src/script/lua_api/l_server.cpp b/src/script/lua_api/l_server.cpp index e60d1d2d6..d99f46cd1 100644 --- a/src/script/lua_api/l_server.cpp +++ b/src/script/lua_api/l_server.cpp @@ -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> diff --git a/src/script/lua_api/l_vmanip.cpp b/src/script/lua_api/l_vmanip.cpp index 9e482873b..1e973703c 100644 --- a/src/script/lua_api/l_vmanip.cpp +++ b/src/script/lua_api/l_vmanip.cpp @@ -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" diff --git a/src/script/scripting_mainmenu.cpp b/src/script/scripting_mainmenu.cpp index e2f735927..b8a44205a 100644 --- a/src/script/scripting_mainmenu.cpp +++ b/src/script/scripting_mainmenu.cpp @@ -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" diff --git a/src/server.cpp b/src/server.cpp index 685f1f667..c74cc5394 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -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) { diff --git a/src/server.h b/src/server.h index 6955306dd..eeb134a5c 100644 --- a/src/server.h +++ b/src/server.h @@ -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); } diff --git a/src/serverenvironment.cpp b/src/serverenvironment.cpp index 2fb12692b..4cc76b96f 100644 --- a/src/serverenvironment.cpp +++ b/src/serverenvironment.cpp @@ -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" diff --git a/src/serverenvironment.h b/src/serverenvironment.h index 3428d3c99..36f3e2067 100644 --- a/src/serverenvironment.h +++ b/src/serverenvironment.h @@ -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; diff --git a/src/serverobject.cpp b/src/serverobject.cpp index f477700dd..f98290bea 100644 --- a/src/serverobject.cpp +++ b/src/serverobject.cpp @@ -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), diff --git a/src/treegen.cpp b/src/treegen.cpp index 25f614d27..0806f2927 100644 --- a/src/treegen.cpp +++ b/src/treegen.cpp @@ -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" diff --git a/src/voxel.h b/src/voxel.h index 599a57de4..49a75c95f 100644 --- a/src/voxel.h +++ b/src/voxel.h @@ -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> diff --git a/src/wieldmesh.cpp b/src/wieldmesh.cpp index c532a048c..dbec4a177 100644 --- a/src/wieldmesh.cpp +++ b/src/wieldmesh.cpp @@ -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" diff --git a/src/wieldmesh.h b/src/wieldmesh.h index c10ff66a4..51ba20536 100644 --- a/src/wieldmesh.h +++ b/src/wieldmesh.h @@ -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; |