Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Cleanup various headers to reduce compilation times (#6255)
* Cleanup various headers to reduce compilation times
  • Loading branch information
nerzhul committed Aug 16, 2017
1 parent 816bca3 commit 85511a6
Show file tree
Hide file tree
Showing 51 changed files with 94 additions and 84 deletions.
2 changes: 1 addition & 1 deletion src/ban.h
Expand Up @@ -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();
Expand Down
19 changes: 9 additions & 10 deletions src/camera.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 1 addition & 4 deletions src/camera.h
Expand Up @@ -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;
Expand Down Expand Up @@ -120,7 +117,7 @@ class Camera
// 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();
Expand Down
5 changes: 3 additions & 2 deletions src/client.cpp
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
1 change: 0 additions & 1 deletion src/client.h
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/client/inputhandler.h
Expand Up @@ -247,8 +247,8 @@ class RealInputHandler : public InputHandler
}

return m_mousepos;

}

virtual void setMousePos(s32 x, s32 y)
{
if (RenderingEngine::get_raw_device()->getCursorControl()) {
Expand Down
2 changes: 2 additions & 0 deletions src/client/renderingengine.cpp
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions src/clientenvironment.cpp
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions src/clientenvironment.h
Expand Up @@ -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;
Expand Down
5 changes: 2 additions & 3 deletions src/clientiface.cpp
Expand Up @@ -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"

Expand Down
1 change: 1 addition & 0 deletions src/clientiface.h
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions src/content_cao.cpp
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/content_mapblock.h
Expand Up @@ -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>

Expand Down
3 changes: 1 addition & 2 deletions src/environment.h
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions src/game.cpp
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions src/gettext.h
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion src/guiKeyChangeMenu.h
Expand Up @@ -24,7 +24,6 @@

#include "irrlichttypes_extrabloated.h"
#include "modalMenu.h"
#include "client.h"
#include "gettext.h"
#include "keycode.h"
#include <string>
Expand Down
4 changes: 1 addition & 3 deletions src/guiPasswordChange.cpp
Expand Up @@ -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>
Expand Down
3 changes: 2 additions & 1 deletion src/guiPasswordChange.h
Expand Up @@ -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:
Expand Down
5 changes: 2 additions & 3 deletions src/guiVolumeChange.h
Expand Up @@ -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
Expand All @@ -32,7 +31,7 @@ class GUIVolumeChange : public GUIModalMenu
gui::IGUIElement* parent, s32 id,
IMenuManager *menumgr);
~GUIVolumeChange();

void removeChildren();
/*
Remove and re-add (or reposition) stuff
Expand All @@ -42,7 +41,7 @@ class GUIVolumeChange : public GUIModalMenu
void drawMenu();

bool OnEvent(const SEvent& event);

bool pausesGame() { return true; }
};

Expand Down
2 changes: 1 addition & 1 deletion src/irrlichttypes.h
Expand Up @@ -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>
Expand Down
2 changes: 2 additions & 0 deletions src/localplayer.h
Expand Up @@ -144,7 +144,9 @@ class LocalPlayer : public Player
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);

Expand Down
6 changes: 1 addition & 5 deletions src/main.cpp
Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/mapblock_mesh.cpp
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions src/mg_ore.cpp
Expand Up @@ -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>


Expand Down
19 changes: 4 additions & 15 deletions src/minimap.cpp
Expand Up @@ -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"


Expand All @@ -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;
}
}
Expand Down
9 changes: 5 additions & 4 deletions src/minimap.h
Expand Up @@ -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,
Expand Down

0 comments on commit 85511a6

Please sign in to comment.