Skip to content
Permalink
Browse files

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
  • Loading branch information
nerzhul committed Aug 18, 2017
1 parent c427533 commit fd3afbced5410639325e730d5710b8b5039b320e
@@ -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"
@@ -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>
@@ -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"
@@ -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"
@@ -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"
@@ -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"
@@ -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
@@ -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;
@@ -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
@@ -19,14 +19,14 @@ 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"
#include <istream>
#include <ostream>
#include <string>
#include <vector>
#include <cassert>

struct ToolCapabilities;

@@ -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"
@@ -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"
@@ -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;
@@ -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"
@@ -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"
@@ -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"

@@ -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"

@@ -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"
@@ -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"
@@ -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
@@ -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"

@@ -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;
@@ -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

@@ -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"

@@ -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:
@@ -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
@@ -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
@@ -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"

/*
@@ -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"
@@ -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>

@@ -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"
@@ -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"
@@ -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)
{
@@ -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 @@ class Server : public con::PeerHandler, public MapEventReceiver,
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); }

0 comments on commit fd3afbc

Please sign in to comment.