mirror of
https://github.com/minetest/minetest.git
synced 2024-12-22 22:22:23 +01:00
Make itemdef.h safe to include anywhere
This commit is contained in:
parent
a18355e7e8
commit
4e9aa7dc77
@ -396,12 +396,14 @@ set(independent_SRCS
|
||||
gettext_plural_form.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
|
||||
@ -429,7 +431,6 @@ set(common_SRCS
|
||||
environment.cpp
|
||||
filesys.cpp
|
||||
gettext.cpp
|
||||
inventory.cpp
|
||||
inventorymanager.cpp
|
||||
itemdef.cpp
|
||||
light.cpp
|
||||
@ -440,7 +441,6 @@ set(common_SRCS
|
||||
mapnode.cpp
|
||||
mapsector.cpp
|
||||
nodedef.cpp
|
||||
nodemetadata.cpp
|
||||
pathfinder.cpp
|
||||
player.cpp
|
||||
porting.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"
|
||||
|
@ -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"
|
||||
|
||||
////
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
||||
|
@ -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 <map>
|
||||
|
@ -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"
|
||||
|
@ -34,13 +34,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#include "itemdef.h"
|
||||
#include "client/game.h"
|
||||
#include "util/basic_macros.h"
|
||||
#include "client/texturesource.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
class IrrlichtDevice;
|
||||
}
|
||||
|
||||
using namespace irr;
|
||||
using namespace irr::core;
|
||||
using namespace irr::gui;
|
||||
|
||||
|
@ -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
|
||||
|
@ -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<video::SColor> 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<std::string> &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
|
||||
|
@ -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 <IMeshManipulator.h>
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user