forked from Mirrorlandia_minetest/minetest
Clean InventoryItem interface a bit
This commit is contained in:
parent
7a29b14a20
commit
f68fa667c8
@ -451,7 +451,7 @@ void Camera::updateSettings()
|
||||
|
||||
void Camera::wield(const InventoryItem* item, IGameDef *gamedef)
|
||||
{
|
||||
ITextureSource *tsrc = gamedef->tsrc();
|
||||
//ITextureSource *tsrc = gamedef->tsrc();
|
||||
INodeDefManager *ndef = gamedef->ndef();
|
||||
|
||||
if (item != NULL)
|
||||
@ -475,7 +475,7 @@ void Camera::wield(const InventoryItem* item, IGameDef *gamedef)
|
||||
// If that failed, make an extruded sprite.
|
||||
if (!isCube)
|
||||
{
|
||||
m_wieldnode->setSprite(item->getImageRaw(tsrc));
|
||||
m_wieldnode->setSprite(item->getImageRaw());
|
||||
m_wieldnode->setScale(v3f(40));
|
||||
}
|
||||
|
||||
|
@ -224,7 +224,7 @@ void ItemCAO::addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc)
|
||||
<<std::endl;
|
||||
if(item)
|
||||
{
|
||||
texture = item->getImage(tsrc);
|
||||
texture = item->getImage();
|
||||
delete item;
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ void drawInventoryItem(video::IVideoDriver *driver,
|
||||
return;
|
||||
|
||||
video::ITexture *texture = NULL;
|
||||
texture = item->getImage(tsrc);
|
||||
texture = item->getImage();
|
||||
|
||||
if(texture != NULL)
|
||||
{
|
||||
|
@ -179,7 +179,7 @@ MaterialItem::MaterialItem(IGameDef *gamedef, content_t content, u16 count):
|
||||
}
|
||||
|
||||
#ifndef SERVER
|
||||
video::ITexture * MaterialItem::getImage(ITextureSource *tsrc) const
|
||||
video::ITexture * MaterialItem::getImage() const
|
||||
{
|
||||
return m_gamedef->getNodeDefManager()->get(m_nodename).inventory_texture;
|
||||
}
|
||||
@ -232,10 +232,9 @@ std::string ToolItem::getImageBasename() const
|
||||
}
|
||||
|
||||
#ifndef SERVER
|
||||
video::ITexture * ToolItem::getImage(ITextureSource *tsrc) const
|
||||
video::ITexture * ToolItem::getImage() const
|
||||
{
|
||||
if(tsrc == NULL)
|
||||
return NULL;
|
||||
ITextureSource *tsrc = m_gamedef->tsrc();
|
||||
|
||||
std::string basename = getImageBasename();
|
||||
|
||||
@ -253,10 +252,9 @@ video::ITexture * ToolItem::getImage(ITextureSource *tsrc) const
|
||||
return tsrc->getTextureRaw(os.str());
|
||||
}
|
||||
|
||||
video::ITexture * ToolItem::getImageRaw(ITextureSource *tsrc) const
|
||||
video::ITexture * ToolItem::getImageRaw() const
|
||||
{
|
||||
if(tsrc == NULL)
|
||||
return NULL;
|
||||
ITextureSource *tsrc = m_gamedef->tsrc();
|
||||
|
||||
return tsrc->getTextureRaw(getImageBasename());
|
||||
}
|
||||
@ -267,10 +265,9 @@ video::ITexture * ToolItem::getImageRaw(ITextureSource *tsrc) const
|
||||
*/
|
||||
|
||||
#ifndef SERVER
|
||||
video::ITexture * CraftItem::getImage(ITextureSource *tsrc) const
|
||||
video::ITexture * CraftItem::getImage() const
|
||||
{
|
||||
if(tsrc == NULL)
|
||||
return NULL;
|
||||
ITextureSource *tsrc = m_gamedef->tsrc();
|
||||
|
||||
std::string name = item_craft_get_image_name(m_subname, m_gamedef);
|
||||
|
||||
|
@ -51,11 +51,11 @@ public:
|
||||
virtual std::string getImageBasename() const { return ""; }
|
||||
#ifndef SERVER
|
||||
// Shall return an image of the item (or NULL)
|
||||
virtual video::ITexture * getImage(ITextureSource *tsrc) const
|
||||
virtual video::ITexture * getImage() const
|
||||
{ return NULL; }
|
||||
// Shall return an image of the item without embellishments (or NULL)
|
||||
virtual video::ITexture * getImageRaw(ITextureSource *tsrc) const
|
||||
{ return getImage(tsrc); }
|
||||
virtual video::ITexture * getImageRaw() const
|
||||
{ return getImage(); }
|
||||
#endif
|
||||
// Shall return a text to show in the GUI
|
||||
virtual std::string getText() { return ""; }
|
||||
@ -161,7 +161,7 @@ public:
|
||||
return new MaterialItem(m_gamedef, m_nodename, m_count);
|
||||
}
|
||||
#ifndef SERVER
|
||||
video::ITexture * getImage(ITextureSource *tsrc) const;
|
||||
video::ITexture * getImage() const;
|
||||
#endif
|
||||
std::string getText()
|
||||
{
|
||||
@ -235,7 +235,7 @@ public:
|
||||
return new CraftItem(m_gamedef, m_subname, m_count);
|
||||
}
|
||||
#ifndef SERVER
|
||||
video::ITexture * getImage(ITextureSource *tsrc) const;
|
||||
video::ITexture * getImage() const;
|
||||
#endif
|
||||
std::string getText()
|
||||
{
|
||||
@ -316,8 +316,8 @@ public:
|
||||
|
||||
std::string getImageBasename() const;
|
||||
#ifndef SERVER
|
||||
video::ITexture * getImage(ITextureSource *tsrc) const;
|
||||
video::ITexture * getImageRaw(ITextureSource *tsrc) const;
|
||||
video::ITexture * getImage() const;
|
||||
video::ITexture * getImageRaw() const;
|
||||
#endif
|
||||
|
||||
std::string getText()
|
||||
|
Loading…
Reference in New Issue
Block a user