-
-class CItemDefManager: public IWritableItemDefManager
-{
-public:
- CItemDefManager();
- virtual ~CItemDefManager();
- virtual const ItemDefinition& get(const std::string &name_) const;
- virtual std::string getAlias(const std::string &name) const;
- virtual std::set<std::string> getAll() const;
- virtual bool isKnown(const std::string &name_) const;
-
-#ifndef SERVER
- // Get item inventory texture
- virtual video::ITexture* getInventoryTexture(const std::string &name,
- IGameDef *gamedef) const;
-
- // Get item wield mesh
- virtual scene::IMesh* getWieldMesh(const std::string &name,
- IGameDef *gamedef) const;
-#endif
- void clear();
-
- virtual void registerItem(const ItemDefinition &def);
- virtual void registerAlias(const std::string &name,
- const std::string &convert_to);
- void serialize(std::ostream &os, u16 protocol_version);
- void deSerialize(std::istream &is);
-
- void processQueue(IGameDef *gamedef);
-
-private:
-
-#ifndef SERVER
- struct ClientCached
- {
- video::ITexture *inventory_texture;
- scene::IMesh *wield_mesh;
-
- ClientCached();
- };
-
- void createNodeItemTexture(const std::string& name,
- const ItemDefinition& def, INodeDefManager* nodedef,
- ClientCached* cc, IGameDef* gamedef, ITextureSource* tsrc) const;
-
- void createMeshItemTexture(const std::string& name,
- const ItemDefinition& def, INodeDefManager* nodedef,
- ClientCached* cc, IGameDef* gamedef, ITextureSource* tsrc) const;
-
- void renderMeshToTexture(const ItemDefinition& def, scene::IMesh* mesh,
- ClientCached* cc, ITextureSource* tsrc) const;
-
- ClientCached* createClientCachedDirect(const std::string &name,
- IGameDef *gamedef) const;
-
- ClientCached* getClientCached(const std::string &name,
- IGameDef *gamedef) const;
-
- // The id of the thread that is allowed to use irrlicht directly
- threadid_t m_main_thread;
-
- // A reference to this can be returned when nothing is found, to avoid NULLs
- mutable ClientCached m_dummy_clientcached;
-
- // Cached textures and meshes
- mutable MutexedMap<std::string, ClientCached*> m_clientcached;
-
- // Queued clientcached fetches (to be processed by the main thread)
- mutable RequestQueue<std::string, ClientCached*, u8, u8> m_get_clientcached_queue;
-#endif
-
- // Key is name
- std::map<std::string, ItemDefinition*> m_item_definitions;
-
- // Aliases
- std::map<std::string, std::string> m_aliases;
-};
-