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
master
Loïc Blot 2017-08-18 19:25:07 +02:00 committed by GitHub
parent c427533389
commit fd3afbced5
42 changed files with 55 additions and 32 deletions

View File

@ -30,7 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "noise.h" // easeCurve #include "noise.h" // easeCurve
#include "sound.h" #include "sound.h"
#include "event.h" #include "event.h"
#include "profiler.h" #include "nodedef.h"
#include "util/numeric.h" #include "util/numeric.h"
#include "constants.h" #include "constants.h"
#include "fontengine.h" #include "fontengine.h"

View File

@ -21,7 +21,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "irrlichttypes_extrabloated.h" #include "irrlichttypes_extrabloated.h"
#include "inventory.h" #include "inventory.h"
#include "mesh.h"
#include "client/tile.h" #include "client/tile.h"
#include <ICameraSceneNode.h> #include <ICameraSceneNode.h>
#include <ISceneNode.h> #include <ISceneNode.h>

View File

@ -39,6 +39,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "minimap.h" #include "minimap.h"
#include "mods.h" #include "mods.h"
#include "profiler.h" #include "profiler.h"
#include "shader.h"
#include "gettext.h" #include "gettext.h"
#include "clientmap.h" #include "clientmap.h"
#include "clientmedia.h" #include "clientmedia.h"

View File

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "filesys.h" #include "filesys.h"
#include "guiMainMenu.h" #include "guiMainMenu.h"
#include "game.h" #include "game.h"
#include "player.h"
#include "chat.h" #include "chat.h"
#include "gettext.h" #include "gettext.h"
#include "profiler.h" #include "profiler.h"

View File

@ -27,6 +27,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "mapblock_mesh.h" #include "mapblock_mesh.h"
#include "event.h" #include "event.h"
#include "collision.h" #include "collision.h"
#include "nodedef.h"
#include "profiler.h" #include "profiler.h"
#include "raycast.h" #include "raycast.h"
#include "voxelalgorithms.h" #include "voxelalgorithms.h"

View File

@ -33,7 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <netinet/in.h> #include <netinet/in.h>
#endif #endif
#include "log.h" #include "debug.h"
#include "exceptions.h" #include "exceptions.h"
#include "settings.h" #include "settings.h"
#include "content_sao.h" #include "content_sao.h"

View File

@ -25,7 +25,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "mapnode.h" #include "mapnode.h"
#include "map.h" #include "map.h"
#include "nodedef.h" #include "nodedef.h"
#include "profiler.h"
#include "settings.h" #include "settings.h"
//#define DGEN_USE_TORCHES //#define DGEN_USE_TORCHES

View File

@ -66,6 +66,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#if USE_SOUND #if USE_SOUND
#include "sound_openal.h" #include "sound_openal.h"
#include "shader.h"
#endif #endif
extern Settings *g_settings; extern Settings *g_settings;

View File

@ -25,6 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "log.h" #include "log.h"
#include "client.h" #include "client.h"
#include "inventory.h" #include "inventory.h"
#include "shader.h"
#include "client/tile.h" #include "client/tile.h"
#include "localplayer.h" #include "localplayer.h"
#include "camera.h" #include "camera.h"
@ -33,7 +34,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "guiscalingfilter.h" #include "guiscalingfilter.h"
#include "mesh.h" #include "mesh.h"
#include "wieldmesh.h" #include "wieldmesh.h"
#include <IGUIStaticText.h>
#include "client/renderingengine.h" #include "client/renderingengine.h"
#ifdef HAVE_TOUCHSCREENGUI #ifdef HAVE_TOUCHSCREENGUI

View File

@ -19,7 +19,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#pragma once #pragma once
#include "debug.h"
#include "itemdef.h" #include "itemdef.h"
#include "irrlichttypes.h" #include "irrlichttypes.h"
#include "itemstackmetadata.h" #include "itemstackmetadata.h"
@ -27,6 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <ostream> #include <ostream>
#include <string> #include <string>
#include <vector> #include <vector>
#include <cassert>
struct ToolCapabilities; struct ToolCapabilities;

View File

@ -18,6 +18,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
*/ */
#include "inventorymanager.h" #include "inventorymanager.h"
#include "debug.h"
#include "log.h" #include "log.h"
#include "serverenvironment.h" #include "serverenvironment.h"
#include "scripting_server.h" #include "scripting_server.h"

View File

@ -18,7 +18,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
*/ */
#include "irrlicht.h" // createDevice #include "irrlicht.h" // createDevice
#include "mainmenumanager.h" #include "mainmenumanager.h"
#include "irrlichttypes_extrabloated.h" #include "irrlichttypes_extrabloated.h"
#include "chat_interface.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 "gameparams.h"
#include "database.h" #include "database.h"
#include "config.h" #include "config.h"
#include "player.h"
#include "porting.h" #include "porting.h"
#if USE_CURSES #if USE_CURSES
#include "terminal_chat_console.h" #include "terminal_chat_console.h"

View 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 All kinds of stuff that needs to be exposed from main.cpp
*/ */
#include "debug.h" // assert
#include "modalMenu.h" #include "modalMenu.h"
#include <cassert>
#include <list> #include <list>
class IGameCallback class IGameCallback

View File

@ -33,6 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "util/container.h" #include "util/container.h"
#include "nodetimer.h" #include "nodetimer.h"
#include "map_settings_manager.h" #include "map_settings_manager.h"
#include "debug.h"
class Settings; class Settings;
class MapDatabase; class MapDatabase;

View File

@ -20,7 +20,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#pragma once #pragma once
#include <set> #include <set>
#include "debug.h"
#include "irr_v3d.h" #include "irr_v3d.h"
#include "mapnode.h" #include "mapnode.h"
#include "exceptions.h" #include "exceptions.h"

View File

@ -22,6 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "mapblock.h" #include "mapblock.h"
#include "map.h" #include "map.h"
#include "profiler.h" #include "profiler.h"
#include "shader.h"
#include "mesh.h" #include "mesh.h"
#include "minimap.h" #include "minimap.h"
#include "content_mapblock.h" #include "content_mapblock.h"

View File

@ -23,7 +23,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "noise.h" #include "noise.h"
#include "nodedef.h" #include "nodedef.h"
#include "mapnode.h"
#include "util/string.h" #include "util/string.h"
#include "util/container.h" #include "util/container.h"

View File

@ -21,6 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "client.h" #include "client.h"
#include "clientmap.h" #include "clientmap.h"
#include "settings.h" #include "settings.h"
#include "shader.h"
#include "mapblock.h" #include "mapblock.h"
#include "client/renderingengine.h" #include "client/renderingengine.h"

View 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. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#include <chatmessage.h> #include "chatmessage.h"
#include "server.h" #include "server.h"
#include "log.h" #include "log.h"
#include "content_sao.h" #include "content_sao.h"
#include "emerge.h" #include "emerge.h"
#include "mapblock.h" #include "mapblock.h"
#include "nodedef.h" #include "nodedef.h"
#include "player.h" #include "remoteplayer.h"
#include "rollback_interface.h" #include "rollback_interface.h"
#include "scripting_server.h" #include "scripting_server.h"
#include "settings.h" #include "settings.h"

View File

@ -22,6 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "itemdef.h" #include "itemdef.h"
#ifndef SERVER #ifndef SERVER
#include "mesh.h" #include "mesh.h"
#include "shader.h"
#include "client.h" #include "client.h"
#include "client/renderingengine.h" #include "client/renderingengine.h"
#include "client/tile.h" #include "client/tile.h"

View File

@ -27,7 +27,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "mapnode.h" #include "mapnode.h"
#ifndef SERVER #ifndef SERVER
#include "client/tile.h" #include "client/tile.h"
#include "shader.h"
#include <IMeshManipulator.h> #include <IMeshManipulator.h>
class Client; class Client;
#endif #endif

View File

@ -20,13 +20,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "particles.h" #include "particles.h"
#include "client.h" #include "client.h"
#include "collision.h" #include "collision.h"
#include <stdlib.h>
#include "client/renderingengine.h" #include "client/renderingengine.h"
#include "util/numeric.h" #include "util/numeric.h"
#include "light.h" #include "light.h"
#include "environment.h" #include "environment.h"
#include "clientmap.h" #include "clientmap.h"
#include "mapnode.h" #include "mapnode.h"
#include "nodedef.h"
#include "client.h" #include "client.h"
#include "settings.h" #include "settings.h"

View File

@ -23,7 +23,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "irrlichttypes_extrabloated.h" #include "irrlichttypes_extrabloated.h"
#include "client/tile.h" #include "client/tile.h"
#include "localplayer.h" #include "localplayer.h"
#include "environment.h"
#include "tileanimation.h" #include "tileanimation.h"
struct ClientEvent; struct ClientEvent;

View File

@ -20,13 +20,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#pragma once #pragma once
#include "irrlichttypes.h" #include "irrlichttypes.h"
#include <cassert>
#include <string> #include <string>
#include <map> #include <map>
#include <ostream>
#include "threading/mutex_auto_lock.h" #include "threading/mutex_auto_lock.h"
#include "util/timetaker.h" #include "util/timetaker.h"
#include "util/numeric.h" // paging() #include "util/numeric.h" // paging()
#include "debug.h" // assert()
#define MAX_PROFILER_TEXT_ROWS 20 #define MAX_PROFILER_TEXT_ROWS 20

View File

@ -25,7 +25,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "threading/semaphore.h" #include "threading/semaphore.h"
#include "threading/thread.h" #include "threading/thread.h"
#include "debug.h"
#include "lua.h" #include "lua.h"
#include "cpp_api/s_base.h" #include "cpp_api/s_base.h"

View File

@ -32,7 +32,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "threading/mutex_auto_lock.h" #include "threading/mutex_auto_lock.h"
#ifdef SCRIPTAPI_LOCK_DEBUG #ifdef SCRIPTAPI_LOCK_DEBUG
#include "debug.h" // assert() #include <cassert>
class LockChecker { class LockChecker {
public: public:

View File

@ -28,6 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <algorithm> #include <algorithm>
#include "scripting_server.h" #include "scripting_server.h"
#include "environment.h" #include "environment.h"
#include "mapblock.h"
#include "server.h" #include "server.h"
#include "nodedef.h" #include "nodedef.h"
#include "daynightratio.h" #include "daynightratio.h"
@ -37,6 +38,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "emerge.h" #include "emerge.h"
#include "pathfinder.h" #include "pathfinder.h"
#include "face_position_cache.h" #include "face_position_cache.h"
#include "remoteplayer.h"
#ifndef SERVER #ifndef SERVER
#include "client.h" #include "client.h"
#endif #endif

View 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_converter.h"
#include "common/c_content.h" #include "common/c_content.h"
#include "server.h" #include "server.h"
#include "player.h" #include "remoteplayer.h"
/* /*
InvRef InvRef

View File

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "common/c_content.h" #include "common/c_content.h"
#include "serverenvironment.h" #include "serverenvironment.h"
#include "map.h" #include "map.h"
#include "mapblock.h"
#include "server.h" #include "server.h"
/* /*

View File

@ -27,6 +27,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "tool.h" #include "tool.h"
#include "serverobject.h" #include "serverobject.h"
#include "content_sao.h" #include "content_sao.h"
#include "remoteplayer.h"
#include "server.h" #include "server.h"
#include "hud.h" #include "hud.h"
#include "scripting_server.h" #include "scripting_server.h"

View File

@ -24,7 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "cpp_api/s_base.h" #include "cpp_api/s_base.h"
#include "server.h" #include "server.h"
#include "environment.h" #include "environment.h"
#include "player.h" #include "remoteplayer.h"
#include "log.h" #include "log.h"
#include <algorithm> #include <algorithm>

View File

@ -25,6 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "emerge.h" #include "emerge.h"
#include "environment.h" #include "environment.h"
#include "map.h" #include "map.h"
#include "mapblock.h"
#include "server.h" #include "server.h"
#include "mapgen.h" #include "mapgen.h"
#include "voxelalgorithms.h" #include "voxelalgorithms.h"

View 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_sound.h"
#include "lua_api/l_util.h" #include "lua_api/l_util.h"
#include "lua_api/l_settings.h" #include "lua_api/l_settings.h"
#include "log.h"
extern "C" { extern "C" {
#include "lualib.h" #include "lualib.h"

View File

@ -62,6 +62,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "database.h" #include "database.h"
#include "chatmessage.h" #include "chatmessage.h"
#include "chat_interface.h" #include "chat_interface.h"
#include "remoteplayer.h"
class ClientNotFoundException : public BaseException class ClientNotFoundException : public BaseException
{ {
@ -3122,6 +3123,11 @@ bool Server::hudSetHotbarItemcount(RemotePlayer *player, s32 hotbar_itemcount)
return true; return true;
} }
s32 Server::hudGetHotbarItemcount(RemotePlayer *player) const
{
return player->getHotbarItemcount();
}
void Server::hudSetHotbarImage(RemotePlayer *player, std::string name) void Server::hudSetHotbarImage(RemotePlayer *player, std::string name)
{ {
if (!player) if (!player)
@ -3147,6 +3153,11 @@ void Server::hudSetHotbarSelectedImage(RemotePlayer *player, std::string name)
SendHUDSetParam(player->peer_id, HUD_PARAM_HOTBAR_SELECTED_IMAGE, 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, bool Server::setLocalPlayerAnimations(RemotePlayer *player,
v2s32 animation_frames[4], f32 frame_speed) v2s32 animation_frames[4], f32 frame_speed)
{ {

View File

@ -34,7 +34,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "util/basic_macros.h" #include "util/basic_macros.h"
#include "serverenvironment.h" #include "serverenvironment.h"
#include "clientiface.h" #include "clientiface.h"
#include "remoteplayer.h"
#include "chatmessage.h" #include "chatmessage.h"
#include <string> #include <string>
#include <list> #include <list>
@ -50,6 +49,7 @@ class IWritableCraftDefManager;
class BanManager; class BanManager;
class EventManager; class EventManager;
class Inventory; class Inventory;
class RemotePlayer;
class PlayerSAO; class PlayerSAO;
class IRollbackManager; class IRollbackManager;
struct RollbackAction; struct RollbackAction;
@ -285,15 +285,11 @@ public:
bool hudChange(RemotePlayer *player, u32 id, HudElementStat stat, void *value); bool hudChange(RemotePlayer *player, u32 id, HudElementStat stat, void *value);
bool hudSetFlags(RemotePlayer *player, u32 flags, u32 mask); bool hudSetFlags(RemotePlayer *player, u32 flags, u32 mask);
bool hudSetHotbarItemcount(RemotePlayer *player, s32 hotbar_itemcount); bool hudSetHotbarItemcount(RemotePlayer *player, s32 hotbar_itemcount);
s32 hudGetHotbarItemcount(RemotePlayer *player) const s32 hudGetHotbarItemcount(RemotePlayer *player) const;
{ return player->getHotbarItemcount(); }
void hudSetHotbarImage(RemotePlayer *player, std::string name); void hudSetHotbarImage(RemotePlayer *player, std::string name);
std::string hudGetHotbarImage(RemotePlayer *player); std::string hudGetHotbarImage(RemotePlayer *player);
void hudSetHotbarSelectedImage(RemotePlayer *player, std::string name); void hudSetHotbarSelectedImage(RemotePlayer *player, std::string name);
const std::string &hudGetHotbarSelectedImage(RemotePlayer *player) const const std::string &hudGetHotbarSelectedImage(RemotePlayer *player) const;
{
return player->getHotbarSelectedImage();
}
inline Address getPeerAddress(u16 peer_id) inline Address getPeerAddress(u16 peer_id)
{ return m_con.GetPeerAddress(peer_id); } { return m_con.GetPeerAddress(peer_id); }

View File

@ -21,6 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "content_sao.h" #include "content_sao.h"
#include "settings.h" #include "settings.h"
#include "log.h" #include "log.h"
#include "mapblock.h"
#include "nodedef.h" #include "nodedef.h"
#include "nodemetadata.h" #include "nodemetadata.h"
#include "gamedef.h" #include "gamedef.h"

View File

@ -19,15 +19,17 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#pragma once #pragma once
#include "activeobject.h"
#include "environment.h" #include "environment.h"
#include "mapnode.h" #include "mapnode.h"
#include "mapblock.h" #include "settings.h"
#include "activeobject.h" #include "util/numeric.h"
#include <set> #include <set>
class IGameDef; class IGameDef;
class ServerMap; class ServerMap;
struct GameParams; struct GameParams;
class MapBlock;
class RemotePlayer; class RemotePlayer;
class PlayerDatabase; class PlayerDatabase;
class PlayerSAO; class PlayerSAO;

View File

@ -21,6 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <fstream> #include <fstream>
#include "inventory.h" #include "inventory.h"
#include "constants.h" // BS #include "constants.h" // BS
#include "log.h"
ServerActiveObject::ServerActiveObject(ServerEnvironment *env, v3f pos): ServerActiveObject::ServerActiveObject(ServerEnvironment *env, v3f pos):
ActiveObject(0), ActiveObject(0),

View File

@ -22,6 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "util/pointer.h" #include "util/pointer.h"
#include "util/numeric.h" #include "util/numeric.h"
#include "map.h" #include "map.h"
#include "mapblock.h"
#include "serverenvironment.h" #include "serverenvironment.h"
#include "nodedef.h" #include "nodedef.h"
#include "treegen.h" #include "treegen.h"

View File

@ -22,7 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "irrlichttypes.h" #include "irrlichttypes.h"
#include "irr_v3d.h" #include "irr_v3d.h"
#include <iostream> #include <iostream>
#include "debug.h" #include <cassert>
#include "exceptions.h" #include "exceptions.h"
#include "mapnode.h" #include "mapnode.h"
#include <set> #include <set>

View 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. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#include "settings.h"
#include "wieldmesh.h" #include "wieldmesh.h"
#include "settings.h"
#include "shader.h"
#include "inventory.h" #include "inventory.h"
#include "client.h" #include "client.h"
#include "itemdef.h" #include "itemdef.h"

View File

@ -20,6 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#pragma once #pragma once
#include <string> #include <string>
#include <vector>
#include "irrlichttypes_extrabloated.h" #include "irrlichttypes_extrabloated.h"
struct ItemStack; struct ItemStack;