Reduce number of recursively included headers

This should improve compilation speed.

Things changed:
* Prefer forward-declarations in headers.
* Move header-includes out of headers if possible.
* Move some functions definitions out of headers.
* Put some member variables into unique_ptrs (see Client).
This commit is contained in:
Desour 2023-03-08 22:58:47 +01:00 committed by DS
parent e9e8eed360
commit 8b73743baa
35 changed files with 109 additions and 56 deletions

@ -22,6 +22,7 @@ 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 "client/tile.h" #include "client/tile.h"
#include "client/localplayer.h"
#include <ICameraSceneNode.h> #include <ICameraSceneNode.h>
#include <ISceneNode.h> #include <ISceneNode.h>
#include <plane3d.h> #include <plane3d.h>

@ -32,6 +32,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "client/renderingengine.h" #include "client/renderingengine.h"
#include "client/sound.h" #include "client/sound.h"
#include "client/tile.h" #include "client/tile.h"
#include "client/mesh_generator_thread.h"
#include "client/particles.h"
#include "client/localplayer.h"
#include "util/auth.h" #include "util/auth.h"
#include "util/directiontables.h" #include "util/directiontables.h"
#include "util/pointedthing.h" #include "util/pointedthing.h"
@ -60,6 +63,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "chatmessage.h" #include "chatmessage.h"
#include "translation.h" #include "translation.h"
#include "content/mod_configuration.h" #include "content/mod_configuration.h"
#include "mapnode.h"
extern gui::IGUIEnvironment* guienv; extern gui::IGUIEnvironment* guienv;
@ -112,12 +116,12 @@ Client::Client(
m_sound(sound), m_sound(sound),
m_event(event), m_event(event),
m_rendering_engine(rendering_engine), m_rendering_engine(rendering_engine),
m_mesh_update_manager(this), m_mesh_update_manager(std::make_unique<MeshUpdateManager>(this)),
m_env( m_env(
new ClientMap(this, rendering_engine, control, 666), new ClientMap(this, rendering_engine, control, 666),
tsrc, this tsrc, this
), ),
m_particle_manager(&m_env), m_particle_manager(std::make_unique<ParticleManager>(&m_env)),
m_con(new con::Connection(PROTOCOL_ID, 512, CONNECTION_TIMEOUT, ipv6, this)), m_con(new con::Connection(PROTOCOL_ID, 512, CONNECTION_TIMEOUT, ipv6, this)),
m_address_name(address_name), m_address_name(address_name),
m_allow_login_or_register(allow_login_or_register), m_allow_login_or_register(allow_login_or_register),
@ -314,7 +318,7 @@ void Client::Stop()
if (m_mods_loaded) if (m_mods_loaded)
m_script->on_shutdown(); m_script->on_shutdown();
//request all client managed threads to stop //request all client managed threads to stop
m_mesh_update_manager.stop(); m_mesh_update_manager->stop();
// Save local server map // Save local server map
if (m_localdb) { if (m_localdb) {
infostream << "Local map saving ended." << std::endl; infostream << "Local map saving ended." << std::endl;
@ -327,7 +331,7 @@ void Client::Stop()
bool Client::isShutdown() bool Client::isShutdown()
{ {
return m_shutdown || !m_mesh_update_manager.isRunning(); return m_shutdown || !m_mesh_update_manager->isRunning();
} }
Client::~Client() Client::~Client()
@ -337,11 +341,11 @@ Client::~Client()
deleteAuthData(); deleteAuthData();
m_mesh_update_manager.stop(); m_mesh_update_manager->stop();
m_mesh_update_manager.wait(); m_mesh_update_manager->wait();
MeshUpdateResult r; MeshUpdateResult r;
while (m_mesh_update_manager.getNextResult(r)) { while (m_mesh_update_manager->getNextResult(r)) {
for (auto block : r.map_blocks) for (auto block : r.map_blocks)
if (block) if (block)
block->refDrop(); block->refDrop();
@ -553,7 +557,7 @@ void Client::step(float dtime)
std::vector<v3s16> blocks_to_ack; std::vector<v3s16> blocks_to_ack;
bool force_update_shadows = false; bool force_update_shadows = false;
MeshUpdateResult r; MeshUpdateResult r;
while (m_mesh_update_manager.getNextResult(r)) while (m_mesh_update_manager->getNextResult(r))
{ {
num_processed_meshes++; num_processed_meshes++;
@ -1128,12 +1132,14 @@ void Client::startAuth(AuthMechanism chosen_auth_mechanism)
{ {
m_chosen_auth_mech = chosen_auth_mechanism; m_chosen_auth_mech = chosen_auth_mechanism;
std::string playername = m_env.getLocalPlayer()->getName();
switch (chosen_auth_mechanism) { switch (chosen_auth_mechanism) {
case AUTH_MECHANISM_FIRST_SRP: { case AUTH_MECHANISM_FIRST_SRP: {
// send srp verifier to server // send srp verifier to server
std::string verifier; std::string verifier;
std::string salt; std::string salt;
generate_srp_verifier_and_salt(getPlayerName(), m_password, generate_srp_verifier_and_salt(playername, m_password,
&verifier, &salt); &verifier, &salt);
NetworkPacket resp_pkt(TOSERVER_FIRST_SRP, 0); NetworkPacket resp_pkt(TOSERVER_FIRST_SRP, 0);
@ -1147,13 +1153,13 @@ void Client::startAuth(AuthMechanism chosen_auth_mechanism)
u8 based_on = 1; u8 based_on = 1;
if (chosen_auth_mechanism == AUTH_MECHANISM_LEGACY_PASSWORD) { if (chosen_auth_mechanism == AUTH_MECHANISM_LEGACY_PASSWORD) {
m_password = translate_password(getPlayerName(), m_password); m_password = translate_password(playername, m_password);
based_on = 0; based_on = 0;
} }
std::string playername_u = lowercase(getPlayerName()); std::string playername_u = lowercase(playername);
m_auth_data = srp_user_new(SRP_SHA256, SRP_NG_2048, m_auth_data = srp_user_new(SRP_SHA256, SRP_NG_2048,
getPlayerName().c_str(), playername_u.c_str(), playername.c_str(), playername_u.c_str(),
(const unsigned char *) m_password.c_str(), (const unsigned char *) m_password.c_str(),
m_password.length(), NULL, NULL); m_password.length(), NULL, NULL);
char *bytes_A = 0; char *bytes_A = 0;
@ -1695,12 +1701,12 @@ void Client::addUpdateMeshTask(v3s16 p, bool ack_to_server, bool urgent)
if (b == NULL) if (b == NULL)
return; return;
m_mesh_update_manager.updateBlock(&m_env.getMap(), p, ack_to_server, urgent); m_mesh_update_manager->updateBlock(&m_env.getMap(), p, ack_to_server, urgent);
} }
void Client::addUpdateMeshTaskWithEdge(v3s16 blockpos, bool ack_to_server, bool urgent) void Client::addUpdateMeshTaskWithEdge(v3s16 blockpos, bool ack_to_server, bool urgent)
{ {
m_mesh_update_manager.updateBlock(&m_env.getMap(), blockpos, ack_to_server, urgent, true); m_mesh_update_manager->updateBlock(&m_env.getMap(), blockpos, ack_to_server, urgent, true);
} }
void Client::addUpdateMeshTaskForNode(v3s16 nodepos, bool ack_to_server, bool urgent) void Client::addUpdateMeshTaskForNode(v3s16 nodepos, bool ack_to_server, bool urgent)
@ -1714,7 +1720,7 @@ void Client::addUpdateMeshTaskForNode(v3s16 nodepos, bool ack_to_server, bool ur
v3s16 blockpos = getNodeBlockPos(nodepos); v3s16 blockpos = getNodeBlockPos(nodepos);
v3s16 blockpos_relative = blockpos * MAP_BLOCKSIZE; v3s16 blockpos_relative = blockpos * MAP_BLOCKSIZE;
m_mesh_update_manager.updateBlock(&m_env.getMap(), blockpos, ack_to_server, urgent, false); m_mesh_update_manager->updateBlock(&m_env.getMap(), blockpos, ack_to_server, urgent, false);
// Leading edge // Leading edge
if (nodepos.X == blockpos_relative.X) if (nodepos.X == blockpos_relative.X)
addUpdateMeshTask(blockpos + v3s16(-1, 0, 0), false, urgent); addUpdateMeshTask(blockpos + v3s16(-1, 0, 0), false, urgent);
@ -1724,6 +1730,11 @@ void Client::addUpdateMeshTaskForNode(v3s16 nodepos, bool ack_to_server, bool ur
addUpdateMeshTask(blockpos + v3s16(0, 0, -1), false, urgent); addUpdateMeshTask(blockpos + v3s16(0, 0, -1), false, urgent);
} }
void Client::updateCameraOffset(v3s16 camera_offset)
{
m_mesh_update_manager->m_camera_offset = camera_offset;
}
ClientEvent *Client::getClientEvent() ClientEvent *Client::getClientEvent()
{ {
FATAL_ERROR_IF(m_client_event_queue.empty(), FATAL_ERROR_IF(m_client_event_queue.empty(),
@ -1828,7 +1839,7 @@ void Client::afterContentReceived()
// Start mesh update thread after setting up content definitions // Start mesh update thread after setting up content definitions
infostream<<"- Starting mesh update thread"<<std::endl; infostream<<"- Starting mesh update thread"<<std::endl;
m_mesh_update_manager.start(); m_mesh_update_manager->start();
m_state = LC_Ready; m_state = LC_Ready;
sendReady(); sendReady();
@ -1979,7 +1990,7 @@ MtEventManager* Client::getEventManager()
ParticleManager* Client::getParticleManager() ParticleManager* Client::getParticleManager()
{ {
return &m_particle_manager; return m_particle_manager.get();
} }
scene::IAnimatedMesh* Client::getMesh(const std::string &filename, bool cache) scene::IAnimatedMesh* Client::getMesh(const std::string &filename, bool cache)
@ -2078,3 +2089,8 @@ ModChannel* Client::getModChannel(const std::string &channel)
{ {
return m_modchannel_mgr->getModChannel(channel); return m_modchannel_mgr->getModChannel(channel);
} }
const std::string &Client::getFormspecPrepend() const
{
return m_env.getLocalPlayer()->formspec_prepend;
}

@ -23,18 +23,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "irrlichttypes_extrabloated.h" #include "irrlichttypes_extrabloated.h"
#include <ostream> #include <ostream>
#include <map> #include <map>
#include <memory>
#include <set> #include <set>
#include <vector> #include <vector>
#include <unordered_set> #include <unordered_set>
#include "clientobject.h" #include "clientobject.h"
#include "gamedef.h" #include "gamedef.h"
#include "inventorymanager.h" #include "inventorymanager.h"
#include "localplayer.h"
#include "client/hud.h" #include "client/hud.h"
#include "particles.h"
#include "mapnode.h"
#include "tileanimation.h" #include "tileanimation.h"
#include "mesh_generator_thread.h"
#include "network/address.h" #include "network/address.h"
#include "network/peerhandler.h" #include "network/peerhandler.h"
#include "gameparams.h" #include "gameparams.h"
@ -61,10 +58,14 @@ struct MapDrawControl;
class ModChannelMgr; class ModChannelMgr;
class MtEventManager; class MtEventManager;
struct PointedThing; struct PointedThing;
struct MapNode;
class MapDatabase; class MapDatabase;
class Minimap; class Minimap;
struct MinimapMapblock; struct MinimapMapblock;
class MeshUpdateManager;
class ParticleManager;
class Camera; class Camera;
struct PlayerControl;
class NetworkPacket; class NetworkPacket;
namespace con { namespace con {
class Connection; class Connection;
@ -315,8 +316,7 @@ public:
void addUpdateMeshTaskWithEdge(v3s16 blockpos, bool ack_to_server=false, bool urgent=false); void addUpdateMeshTaskWithEdge(v3s16 blockpos, bool ack_to_server=false, bool urgent=false);
void addUpdateMeshTaskForNode(v3s16 nodepos, bool ack_to_server=false, bool urgent=false); void addUpdateMeshTaskForNode(v3s16 nodepos, bool ack_to_server=false, bool urgent=false);
void updateCameraOffset(v3s16 camera_offset) void updateCameraOffset(v3s16 camera_offset);
{ m_mesh_update_manager.m_camera_offset = camera_offset; }
bool hasClientEvents() const { return !m_client_event_queue.empty(); } bool hasClientEvents() const { return !m_client_event_queue.empty(); }
// Get event from queue. If queue is empty, it triggers an assertion failure. // Get event from queue. If queue is empty, it triggers an assertion failure.
@ -436,10 +436,7 @@ public:
const std::string &message) override; const std::string &message) override;
ModChannel *getModChannel(const std::string &channel) override; ModChannel *getModChannel(const std::string &channel) override;
const std::string &getFormspecPrepend() const const std::string &getFormspecPrepend() const;
{
return m_env.getLocalPlayer()->formspec_prepend;
}
inline MeshGrid getMeshGrid() inline MeshGrid getMeshGrid()
{ {
return m_mesh_grid; return m_mesh_grid;
@ -470,10 +467,6 @@ private:
void sendGotBlocks(const std::vector<v3s16> &blocks); void sendGotBlocks(const std::vector<v3s16> &blocks);
void sendRemovedSounds(std::vector<s32> &soundList); void sendRemovedSounds(std::vector<s32> &soundList);
// Helper function
inline std::string getPlayerName()
{ return m_env.getLocalPlayer()->getName(); }
bool canSendChatMessage() const; bool canSendChatMessage() const;
float m_packetcounter_timer = 0.0f; float m_packetcounter_timer = 0.0f;
@ -491,9 +484,9 @@ private:
RenderingEngine *m_rendering_engine; RenderingEngine *m_rendering_engine;
MeshUpdateManager m_mesh_update_manager; std::unique_ptr<MeshUpdateManager> m_mesh_update_manager;
ClientEnvironment m_env; ClientEnvironment m_env;
ParticleManager m_particle_manager; std::unique_ptr<ParticleManager> m_particle_manager;
std::unique_ptr<con::Connection> m_con; std::unique_ptr<con::Connection> m_con;
std::string m_address_name; std::string m_address_name;
ELoginRegister m_allow_login_or_register = ELoginRegister::Any; ELoginRegister m_allow_login_or_register = ELoginRegister::Any;

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "clientenvironment.h" #include "clientenvironment.h"
#include "clientsimpleobject.h" #include "clientsimpleobject.h"
#include "clientmap.h" #include "clientmap.h"
#include "localplayer.h"
#include "scripting_client.h" #include "scripting_client.h"
#include "mapblock_mesh.h" #include "mapblock_mesh.h"
#include "mtevent.h" #include "mtevent.h"

@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <matrix4.h> #include <matrix4.h>
#include "mapsector.h" #include "mapsector.h"
#include "mapblock.h" #include "mapblock.h"
#include "nodedef.h"
#include "profiler.h" #include "profiler.h"
#include "settings.h" #include "settings.h"
#include "camera.h" // CameraModes #include "camera.h" // CameraModes

@ -26,6 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "client/renderingengine.h" #include "client/renderingengine.h"
#include "client/sound.h" #include "client/sound.h"
#include "client/tile.h" #include "client/tile.h"
#include "client/mapblock_mesh.h"
#include "util/basic_macros.h" #include "util/basic_macros.h"
#include "util/numeric.h" #include "util/numeric.h"
#include "util/serialize.h" #include "util/serialize.h"

@ -30,6 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "client/tile.h" // For TextureSource #include "client/tile.h" // For TextureSource
#include "client/keys.h" #include "client/keys.h"
#include "client/joystick_controller.h" #include "client/joystick_controller.h"
#include "client/mapblock_mesh.h"
#include "clientmap.h" #include "clientmap.h"
#include "clouds.h" #include "clouds.h"
#include "config.h" #include "config.h"

@ -21,6 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "client.h" #include "client.h"
#include "mapblock.h" #include "mapblock.h"
#include "map.h" #include "map.h"
#include "noise.h"
#include "profiler.h" #include "profiler.h"
#include "shader.h" #include "shader.h"
#include "mesh.h" #include "mesh.h"
@ -31,6 +32,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "client/renderingengine.h" #include "client/renderingengine.h"
#include <array> #include <array>
#include <algorithm> #include <algorithm>
#include <cmath>
/* /*
MeshMakeData MeshMakeData

@ -20,6 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "pipeline.h" #include "pipeline.h"
#include "client/client.h" #include "client/client.h"
#include "client/hud.h" #include "client/hud.h"
#include "IRenderTarget.h"
#include <vector> #include <vector>
#include <memory> #include <memory>

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "client/client.h" #include "client/client.h"
#include "client/shader.h" #include "client/shader.h"
#include "client/tile.h" #include "client/tile.h"
#include "settings.h"
PostProcessingStep::PostProcessingStep(u32 _shader_id, const std::vector<u8> &_texture_map) : PostProcessingStep::PostProcessingStep(u32 _shader_id, const std::vector<u8> &_texture_map) :
shader_id(_shader_id), texture_map(_texture_map) shader_id(_shader_id), texture_map(_texture_map)

@ -29,6 +29,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "client/client.h" #include "client/client.h"
#include "client/clientmap.h" #include "client/clientmap.h"
#include "profiler.h" #include "profiler.h"
#include "EShaderTypes.h"
#include "IGPUProgrammingServices.h"
#include "IMaterialRenderer.h"
ShadowRenderer::ShadowRenderer(IrrlichtDevice *device, Client *client) : ShadowRenderer::ShadowRenderer(IrrlichtDevice *device, Client *client) :
m_smgr(device->getSceneManager()), m_driver(device->getVideoDriver()), m_smgr(device->getSceneManager()), m_driver(device->getVideoDriver()),

@ -35,8 +35,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <atomic> #include <atomic>
#include <mutex> #include <mutex>
#include "irr_v3d.h" #include "irr_v3d.h"
#include "network/networkprotocol.h" // for AccessDeniedCode
#include "util/basic_macros.h" #include "util/basic_macros.h"
#include "line3d.h"
class IGameDef; class IGameDef;
class Map; class Map;

@ -25,6 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "irrlichttypes_extrabloated.h" #include "irrlichttypes_extrabloated.h"
#include "irr_ptr.h" #include "irr_ptr.h"
#include "inventory.h"
#include "inventorymanager.h" #include "inventorymanager.h"
#include "modalMenu.h" #include "modalMenu.h"
#include "guiInventoryList.h" #include "guiInventoryList.h"

@ -25,6 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "client/client.h" #include "client/client.h"
#include "client/renderingengine.h" #include "client/renderingengine.h"
#include "hud.h" #include "hud.h"
#include "inventory.h"
#include "util/string.h" #include "util/string.h"
#include "irrlicht_changes/CGUITTFont.h" #include "irrlicht_changes/CGUITTFont.h"

@ -19,6 +19,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "guiItemImage.h" #include "guiItemImage.h"
#include "client/client.h" #include "client/client.h"
#include "inventory.h"
GUIItemImage::GUIItemImage(gui::IGUIEnvironment *env, gui::IGUIElement *parent, GUIItemImage::GUIItemImage(gui::IGUIEnvironment *env, gui::IGUIElement *parent,
s32 id, const core::rect<s32> &rectangle, const std::string &item_name, s32 id, const core::rect<s32> &rectangle, const std::string &item_name,

@ -23,7 +23,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <algorithm> #include <algorithm>
#include <sstream> #include <sstream>
#include "log.h" #include "log.h"
#include "itemdef.h"
#include "util/strfnd.h" #include "util/strfnd.h"
#include "content_mapnode.h" // For loading legacy MaterialItems #include "content_mapnode.h" // For loading legacy MaterialItems
#include "nameidmapping.h" // For loading legacy MaterialItems #include "nameidmapping.h" // For loading legacy MaterialItems

@ -28,6 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "rollback_interface.h" #include "rollback_interface.h"
#include "util/strfnd.h" #include "util/strfnd.h"
#include "util/basic_macros.h" #include "util/basic_macros.h"
#include "inventory.h"
#define PLAYER_TO_SA(p) p->getEnv()->getScriptIface() #define PLAYER_TO_SA(p) p->getEnv()->getScriptIface()

@ -19,10 +19,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#pragma once #pragma once
#include "inventory.h" #include "irr_v3d.h"
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <vector>
class ServerActiveObject; class ServerActiveObject;
struct ItemStack;
class Inventory;
class IGameDef;
struct InventoryLocation struct InventoryLocation
{ {

@ -30,7 +30,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "modifiedstate.h" #include "modifiedstate.h"
#include "util/numeric.h" // getContainerPos #include "util/numeric.h" // getContainerPos
#include "settings.h" #include "settings.h"
#include "mapgen/mapgen.h"
class Map; class Map;
class NodeMetadataList; class NodeMetadataList;

@ -21,6 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "util/base64.h" #include "util/base64.h"
#include "client/camera.h" #include "client/camera.h"
#include "client/mesh_generator_thread.h"
#include "chatmessage.h" #include "chatmessage.h"
#include "client/clientmedia.h" #include "client/clientmedia.h"
#include "log.h" #include "log.h"
@ -30,12 +31,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "modchannels.h" #include "modchannels.h"
#include "nodedef.h" #include "nodedef.h"
#include "serialization.h" #include "serialization.h"
#include "server.h"
#include "util/strfnd.h" #include "util/strfnd.h"
#include "client/clientevent.h" #include "client/clientevent.h"
#include "client/sound.h" #include "client/sound.h"
#include "network/clientopcodes.h" #include "network/clientopcodes.h"
#include "network/connection.h" #include "network/connection.h"
#include "network/networkpacket.h"
#include "script/scripting_client.h" #include "script/scripting_client.h"
#include "util/serialize.h" #include "util/serialize.h"
#include "util/srp.h" #include "util/srp.h"
@ -43,6 +44,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "tileanimation.h" #include "tileanimation.h"
#include "gettext.h" #include "gettext.h"
#include "skyparams.h" #include "skyparams.h"
#include "particles.h"
#include <memory> #include <memory>
void Client::handleCommand_Deprecated(NetworkPacket* pkt) void Client::handleCommand_Deprecated(NetworkPacket* pkt)
@ -672,7 +674,7 @@ void Client::handleCommand_AnnounceMedia(NetworkPacket* pkt)
// Mesh update thread must be stopped while // Mesh update thread must be stopped while
// updating content definitions // updating content definitions
sanity_check(!m_mesh_update_manager.isRunning()); sanity_check(!m_mesh_update_manager->isRunning());
for (u16 i = 0; i < num_files; i++) { for (u16 i = 0; i < num_files; i++) {
std::string name, sha1_base64; std::string name, sha1_base64;
@ -732,7 +734,7 @@ void Client::handleCommand_Media(NetworkPacket* pkt)
if (init_phase) { if (init_phase) {
// Mesh update thread must be stopped while // Mesh update thread must be stopped while
// updating content definitions // updating content definitions
sanity_check(!m_mesh_update_manager.isRunning()); sanity_check(!m_mesh_update_manager->isRunning());
} }
for (u32 i = 0; i < num_files; i++) { for (u32 i = 0; i < num_files; i++) {
@ -769,7 +771,7 @@ void Client::handleCommand_NodeDef(NetworkPacket* pkt)
// Mesh update thread must be stopped while // Mesh update thread must be stopped while
// updating content definitions // updating content definitions
sanity_check(!m_mesh_update_manager.isRunning()); sanity_check(!m_mesh_update_manager->isRunning());
// Decompress node definitions // Decompress node definitions
std::istringstream tmp_is(pkt->readLongString(), std::ios::binary); std::istringstream tmp_is(pkt->readLongString(), std::ios::binary);
@ -788,7 +790,7 @@ void Client::handleCommand_ItemDef(NetworkPacket* pkt)
// Mesh update thread must be stopped while // Mesh update thread must be stopped while
// updating content definitions // updating content definitions
sanity_check(!m_mesh_update_manager.isRunning()); sanity_check(!m_mesh_update_manager->isRunning());
// Decompress item definitions // Decompress item definitions
std::istringstream tmp_is(pkt->readLongString(), std::ios::binary); std::istringstream tmp_is(pkt->readLongString(), std::ios::binary);

@ -23,6 +23,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "client/client.h" #include "client/client.h"
#include "common/c_converter.h" #include "common/c_converter.h"
#include "common/c_content.h" #include "common/c_content.h"
#include "lua_api/l_item.h"
#include "itemdef.h"
#include "s_item.h" #include "s_item.h"
void ScriptApiClient::on_mods_loaded() void ScriptApiClient::on_mods_loaded()

@ -20,19 +20,19 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#pragma once #pragma once
#include "util/pointedthing.h"
#include "cpp_api/s_base.h" #include "cpp_api/s_base.h"
#include "mapnode.h" #include "mapnode.h"
#include "itemdef.h"
#include "util/string.h" #include "util/string.h"
#include "util/pointedthing.h" #include "util/pointedthing.h"
#include "lua_api/l_item.h"
#ifdef _CRT_MSVCP_CURRENT #ifdef _CRT_MSVCP_CURRENT
#include <cstdint> #include <cstdint>
#endif #endif
class ClientEnvironment; class ClientEnvironment;
struct ItemStack;
class Inventory;
struct ItemDefinition;
class ScriptApiClient : virtual public ScriptApiBase class ScriptApiClient : virtual public ScriptApiBase
{ {

@ -19,6 +19,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "s_modchannels.h" #include "s_modchannels.h"
#include "s_internal.h" #include "s_internal.h"
#include "modchannels.h"
void ScriptApiModChannels::on_modchannel_message(const std::string &channel, void ScriptApiModChannels::on_modchannel_message(const std::string &channel,
const std::string &sender, const std::string &message) const std::string &sender, const std::string &message)

@ -20,7 +20,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#pragma once #pragma once
#include "cpp_api/s_base.h" #include "cpp_api/s_base.h"
#include "modchannels.h"
enum ModChannelSignal : u8;
class ScriptApiModChannels : virtual public ScriptApiBase class ScriptApiModChannels : virtual public ScriptApiBase
{ {

@ -73,6 +73,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "database/database-files.h" #include "database/database-files.h"
#include "database/database-dummy.h" #include "database/database-dummy.h"
#include "gameparams.h" #include "gameparams.h"
#include "particles.h"
class ClientNotFoundException : public BaseException class ClientNotFoundException : public BaseException
{ {

@ -27,8 +27,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "content/mods.h" #include "content/mods.h"
#include "inventorymanager.h" #include "inventorymanager.h"
#include "content/subgames.h" #include "content/subgames.h"
#include "tileanimation.h" // TileAnimationParams
#include "particles.h" // ParticleParams
#include "network/peerhandler.h" #include "network/peerhandler.h"
#include "network/address.h" #include "network/address.h"
#include "util/numeric.h" #include "util/numeric.h"
@ -38,6 +36,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "serverenvironment.h" #include "serverenvironment.h"
#include "clientiface.h" #include "clientiface.h"
#include "chatmessage.h" #include "chatmessage.h"
#include "sound.h"
#include "translation.h" #include "translation.h"
#include <string> #include <string>
#include <list> #include <list>
@ -74,6 +73,8 @@ class ServerThread;
class ServerModManager; class ServerModManager;
class ServerInventoryManager; class ServerInventoryManager;
struct PackedValue; struct PackedValue;
struct ParticleParameters;
struct ParticleSpawnerParameters;
enum ClientDeletionReason { enum ClientDeletionReason {
CDR_LEAVE, CDR_LEAVE,

@ -21,6 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "luaentity_sao.h" #include "luaentity_sao.h"
#include "collision.h" #include "collision.h"
#include "constants.h" #include "constants.h"
#include "inventory.h"
#include "player_sao.h" #include "player_sao.h"
#include "scripting_server.h" #include "scripting_server.h"
#include "server.h" #include "server.h"

@ -21,6 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#pragma once #pragma once
#include "constants.h" #include "constants.h"
#include "metadata.h"
#include "network/networkprotocol.h" #include "network/networkprotocol.h"
#include "unit_sao.h" #include "unit_sao.h"
#include "util/numeric.h" #include "util/numeric.h"

@ -20,6 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "serveractiveobject.h" #include "serveractiveobject.h"
#include <fstream> #include <fstream>
#include "inventory.h" #include "inventory.h"
#include "inventorymanager.h"
#include "constants.h" // BS #include "constants.h" // BS
#include "log.h" #include "log.h"
@ -89,3 +90,8 @@ void ServerActiveObject::markForDeactivation()
m_pending_deactivation = true; m_pending_deactivation = true;
} }
} }
InventoryLocation ServerActiveObject::getInventoryLocation() const
{
return InventoryLocation();
}

@ -19,10 +19,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#pragma once #pragma once
#include <cassert>
#include <unordered_set> #include <unordered_set>
#include "irrlichttypes_bloated.h" #include "irrlichttypes_bloated.h"
#include "activeobject.h" #include "activeobject.h"
#include "inventorymanager.h"
#include "itemgroup.h" #include "itemgroup.h"
#include "util/container.h" #include "util/container.h"
@ -47,6 +47,8 @@ struct ItemStack;
struct ToolCapabilities; struct ToolCapabilities;
struct ObjectProperties; struct ObjectProperties;
struct PlayerHPChangeReason; struct PlayerHPChangeReason;
class Inventory;
struct InventoryLocation;
class ServerActiveObject : public ActiveObject class ServerActiveObject : public ActiveObject
{ {
@ -184,8 +186,7 @@ public:
// Inventory and wielded item // Inventory and wielded item
virtual Inventory *getInventory() const virtual Inventory *getInventory() const
{ return NULL; } { return NULL; }
virtual InventoryLocation getInventoryLocation() const virtual InventoryLocation getInventoryLocation() const;
{ return InventoryLocation(); }
virtual void setInventoryModified() virtual void setInventoryModified()
{} {}
virtual std::string getWieldList() const virtual std::string getWieldList() const

@ -20,8 +20,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#pragma once #pragma once
#include "inventorymanager.h" #include "inventorymanager.h"
#include <cassert>
#include <functional> #include <functional>
#include <unordered_map>
class IItemDefManager;
class ServerEnvironment; class ServerEnvironment;
class ServerInventoryManager : public InventoryManager class ServerInventoryManager : public InventoryManager

@ -21,6 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "unit_sao.h" #include "unit_sao.h"
#include "scripting_server.h" #include "scripting_server.h"
#include "serverenvironment.h" #include "serverenvironment.h"
#include "util/serialize.h"
UnitSAO::UnitSAO(ServerEnvironment *env, v3f pos) : ServerActiveObject(env, pos) UnitSAO::UnitSAO(ServerEnvironment *env, v3f pos) : ServerActiveObject(env, pos)
{ {

@ -41,6 +41,8 @@ struct StaticObject;
class ServerActiveObject; class ServerActiveObject;
class Server; class Server;
class ServerScripting; class ServerScripting;
enum AccessDeniedCode : u8;
typedef u16 session_t;
/* /*
{Active, Loading} block modifier interface. {Active, Loading} block modifier interface.

@ -18,6 +18,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
*/ */
#include <gamedef.h> #include <gamedef.h>
#include <inventory.h>
#include <inventorymanager.h> #include <inventorymanager.h>
class MockInventoryManager : public InventoryManager class MockInventoryManager : public InventoryManager

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "voxelalgorithms.h" #include "voxelalgorithms.h"
#include "util/numeric.h" #include "util/numeric.h"
#include "dummymap.h" #include "dummymap.h"
#include "nodedef.h"
class TestVoxelAlgorithms : public TestBase { class TestVoxelAlgorithms : public TestBase {
public: public: