diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7c14c5312..bdbd8c4ad 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -395,12 +395,14 @@ set(independent_SRCS face_position_cache.cpp httpfetch.cpp hud.cpp + inventory.cpp itemstackmetadata.cpp lighting.cpp log.cpp metadata.cpp modchannels.cpp nameidmapping.cpp + nodemetadata.cpp nodetimer.cpp noise.cpp objdef.cpp @@ -428,7 +430,6 @@ set(common_SRCS environment.cpp filesys.cpp gettext.cpp - inventory.cpp inventorymanager.cpp itemdef.cpp light.cpp @@ -439,7 +440,6 @@ set(common_SRCS mapnode.cpp mapsector.cpp nodedef.cpp - nodemetadata.cpp pathfinder.cpp player.cpp porting.cpp diff --git a/src/client/client.cpp b/src/client/client.cpp index b14ef7004..706f5a0c1 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -33,6 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "client/renderingengine.h" #include "client/sound.h" #include "client/texturepaths.h" +#include "client/texturesource.h" #include "client/mesh_generator_thread.h" #include "client/particles.h" #include "client/localplayer.h" diff --git a/src/client/minimap.cpp b/src/client/minimap.cpp index 13dca5fe9..f959d00be 100644 --- a/src/client/minimap.cpp +++ b/src/client/minimap.cpp @@ -25,6 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "shader.h" #include "mapblock.h" #include "client/renderingengine.h" +#include "client/texturesource.h" #include "gettext.h" //// diff --git a/src/client/particles.cpp b/src/client/particles.cpp index 1eab93579..3bff8e155 100644 --- a/src/client/particles.cpp +++ b/src/client/particles.cpp @@ -25,6 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "client/content_cao.h" #include "client/clientevent.h" #include "client/renderingengine.h" +#include "client/texturesource.h" #include "util/numeric.h" #include "light.h" #include "localplayer.h" diff --git a/src/client/renderingengine.cpp b/src/client/renderingengine.cpp index c4933e062..927bee34e 100644 --- a/src/client/renderingengine.cpp +++ b/src/client/renderingengine.cpp @@ -27,6 +27,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "guiscalingfilter.h" #include "localplayer.h" #include "client/hud.h" +#include "client/texturesource.h" #include "camera.h" #include "minimap.h" #include "clientmap.h" diff --git a/src/client/sky.cpp b/src/client/sky.cpp index 65577418e..c7c159a49 100644 --- a/src/client/sky.cpp +++ b/src/client/sky.cpp @@ -31,6 +31,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "profiler.h" #include "util/numeric.h" #include "client/renderingengine.h" +#include "client/texturesource.h" #include "settings.h" #include "camera.h" // CameraModes diff --git a/src/client/wieldmesh.cpp b/src/client/wieldmesh.cpp index e66214ae6..81ca99b5f 100644 --- a/src/client/wieldmesh.cpp +++ b/src/client/wieldmesh.cpp @@ -29,6 +29,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "mapblock_mesh.h" #include "client/meshgen/collector.h" #include "client/tile.h" +#include "client/texturesource.h" #include "log.h" #include "util/numeric.h" #include diff --git a/src/gui/guiHyperText.cpp b/src/gui/guiHyperText.cpp index 6f30ac8ce..483149583 100644 --- a/src/gui/guiHyperText.cpp +++ b/src/gui/guiHyperText.cpp @@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "IVideoDriver.h" #include "client/client.h" #include "client/renderingengine.h" +#include "client/texturesource.h" #include "hud.h" #include "inventory.h" #include "util/string.h" diff --git a/src/gui/touchcontrols.h b/src/gui/touchcontrols.h index 102c85f09..36b8da8e4 100644 --- a/src/gui/touchcontrols.h +++ b/src/gui/touchcontrols.h @@ -33,13 +33,13 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "itemdef.h" #include "client/game.h" +#include "client/texturesource.h" namespace irr { class IrrlichtDevice; } -using namespace irr; using namespace irr::core; using namespace irr::gui; diff --git a/src/itemdef.cpp b/src/itemdef.cpp index 0bb90929e..773cadaec 100644 --- a/src/itemdef.cpp +++ b/src/itemdef.cpp @@ -28,6 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "client/mesh.h" #include "client/wieldmesh.h" #include "client/client.h" +#include "client/texturesource.h" #endif #include "log.h" #include "settings.h" @@ -448,8 +449,9 @@ public: // Get the definition return m_item_definitions.find(name) != m_item_definitions.cend(); } + #if CHECK_CLIENT_BUILD() -public: +protected: ClientCached* createClientCachedDirect(const ItemStack &item, Client *client) const { // This is not thread-safe @@ -490,6 +492,7 @@ public: return ptr; } +public: // Get item inventory texture virtual video::ITexture* getInventoryTexture(const ItemStack &item, Client *client) const diff --git a/src/itemdef.h b/src/itemdef.h index 1cfd475e5..f0d780173 100644 --- a/src/itemdef.h +++ b/src/itemdef.h @@ -35,11 +35,11 @@ with this program; if not, write to the Free Software Foundation, Inc., class IGameDef; class Client; struct ToolCapabilities; -#if CHECK_CLIENT_BUILD() -#include "client/texturesource.h" struct ItemMesh; struct ItemStack; -#endif +typedef std::vector Palette; // copied from src/client/texturesource.h +namespace irr::video { class ITexture; } +using namespace irr; /* Base item definition @@ -155,25 +155,32 @@ public: virtual void getAll(std::set &result) const=0; // Check if item is known virtual bool isKnown(const std::string &name) const=0; -#if CHECK_CLIENT_BUILD() + + virtual void serialize(std::ostream &os, u16 protocol_version)=0; + + /* Client-specific methods */ + // TODO: should be moved elsewhere in the future + // Get item inventory texture - virtual video::ITexture* getInventoryTexture(const ItemStack &item, Client *client) const=0; + virtual video::ITexture* getInventoryTexture(const ItemStack &item, Client *client) const + { return nullptr; } /** * Get wield mesh - * - * Returns nullptr if there is an inventory image + * @returns nullptr if there is an inventory image */ - virtual ItemMesh* getWieldMesh(const ItemStack &item, Client *client) const = 0; + virtual ItemMesh* getWieldMesh(const ItemStack &item, Client *client) const + { return nullptr; } + // Get item palette - virtual Palette* getPalette(const ItemStack &item, Client *client) const = 0; + virtual Palette* getPalette(const ItemStack &item, Client *client) const + { return nullptr; } + // Returns the base color of an item stack: the color of all // tiles that do not define their own color. virtual video::SColor getItemstackColor(const ItemStack &stack, - Client *client) const = 0; -#endif - - virtual void serialize(std::ostream &os, u16 protocol_version)=0; + Client *client) const + { return video::SColor(0); } }; class IWritableItemDefManager : public IItemDefManager diff --git a/src/nodedef.cpp b/src/nodedef.cpp index 2b3b3b1fb..06a74ccef 100644 --- a/src/nodedef.cpp +++ b/src/nodedef.cpp @@ -25,6 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "client/shader.h" #include "client/client.h" #include "client/renderingengine.h" +#include "client/texturesource.h" #include "client/tile.h" #include #endif