1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

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

View file

@ -21,6 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "luaentity_sao.h"
#include "collision.h"
#include "constants.h"
#include "inventory.h"
#include "player_sao.h"
#include "scripting_server.h"
#include "server.h"
@ -409,7 +410,7 @@ void LuaEntitySAO::setHP(s32 hp, const PlayerHPChangeReason &reason)
m_env->getScriptIface()->luaentity_on_death(m_id, killer);
}
markForRemoval();
}
}
}
u16 LuaEntitySAO::getHP() const

View file

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

View file

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

View file

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

View file

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

View file

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