Cleanup various headers to reduce compilation times (#6255)

* Cleanup various headers to reduce compilation times
This commit is contained in:
Loïc Blot 2017-08-16 22:11:45 +02:00 committed by GitHub
parent 816bca32ac
commit 85511a642f
51 changed files with 94 additions and 84 deletions

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

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

@ -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 <ICameraSceneNode.h>
#include <ISceneNode.h>
#include <list>
#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();

@ -22,6 +22,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <sstream>
#include <cmath>
#include <IFileSystem.h>
#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"

@ -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 <fstream>
#include "filesys.h"
#define CLIENT_CHAT_MESSAGE_LIMIT_PER_10S 10.0f

@ -247,8 +247,8 @@ public:
}
return m_mousepos;
}
virtual void setMousePos(s32 x, s32 y)
{
if (RenderingEngine::get_raw_device()->getCursorControl()) {

@ -21,10 +21,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <IrrlichtDevice.h>
#include <irrlicht.h>
#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"

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

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <ISceneManager.h>
#include "environment.h"
#include "clientobject.h"
#include "util/numeric.h"
class ClientSimpleObject;
class ClientMap;

@ -18,18 +18,17 @@ with this program; if not, write to the Free Software Foundation, Inc.,
*/
#include <sstream>
#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"

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

@ -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 <algorithm>
#include "client/renderingengine.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 <IMeshManipulator.h>

@ -36,9 +36,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <atomic>
#include <mutex>
#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;

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

@ -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 <string>
#if USE_GETTEXT
#include <libintl.h>

@ -24,7 +24,6 @@
#include "irrlichttypes_extrabloated.h"
#include "modalMenu.h"
#include "client.h"
#include "gettext.h"
#include "keycode.h"
#include <string>

@ -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 <string>
#include "client.h"
#include <IGUICheckBox.h>
#include <IGUIEditBox.h>
#include <IGUIButton.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 <string>
class Client;
class GUIPasswordChange : public GUIModalMenu
{
public:

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

@ -28,7 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
* regardless of the compiler.
*/
#ifndef _MSC_VER
# include <stdint.h>
# include <cstdint>
#endif
#include <irrTypes.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);

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

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

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

@ -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 <math.h>
#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<v3s16, MinimapMapblock *>::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<QueuedMinimapUpdate>::iterator
it = m_update_queue.begin();
it != m_update_queue.end(); ++it) {
QueuedMinimapUpdate &q = *it;
for (auto &q : m_update_queue) {
delete q.data;
}
}

@ -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 <map>
#include <string>
#include <vector>
#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,

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

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

@ -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<u8> &data_)
{

@ -18,7 +18,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
*/
#include "networkpacket.h"
#include "debug.h"
#include <sstream>
#include "exceptions.h"
#include "util/serialize.h"

@ -20,9 +20,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#ifndef NETWORKPACKET_HEADER
#define NETWORKPACKET_HEADER
#include <SColor.h>
#include "util/pointer.h"
#include "util/numeric.h"
#include "networkprotocol.h"
class NetworkPacket
{

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

@ -25,7 +25,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <iostream>
#include <map>
#include <list>
#include "util/numeric.h"
#include "mapnode.h"
#ifndef SERVER
#include "client/tile.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_,

@ -24,8 +24,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <deque>
#include <map>
#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 = "";

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <iostream>
#include <string>
#include <thread>
#include <mutex>
#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"

@ -30,6 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <thread>
#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()

@ -30,7 +30,7 @@ extern "C" {
}
#ifndef SERVER
#include "client.h"
class Client;
#endif
class ScriptApiBase;

@ -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)
{

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

@ -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[] =
{

@ -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)
{

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

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

@ -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 <string>
#include <list>
#include <map>
#include <vector>
class ChatEvent;
struct ChatEventChat;
struct ChatInterface;
class IWritableItemDefManager;
class IWritableNodeDefManager;
class IWritableCraftDefManager;

@ -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 <set>
class IGameDef;

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

@ -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 <sstream>
struct ChatInterface;
class TermLogOutput : public ILogOutput {
public:

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

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