diff options
author | Perttu Ahola <celeron55@gmail.com> | 2011-11-13 16:38:14 +0200 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2011-11-29 19:13:41 +0200 |
commit | 5fc791ac9a15ea6f234ca2d23041c83679255746 (patch) | |
tree | 079a5b2d0b2131aa545a6e0f13d3c9b362382168 /src/inventory.h | |
parent | 72884bf85fe71ddab69cdb94262d8c650359f265 (diff) | |
download | minetest-5fc791ac9a15ea6f234ca2d23041c83679255746.tar.gz minetest-5fc791ac9a15ea6f234ca2d23041c83679255746.tar.bz2 minetest-5fc791ac9a15ea6f234ca2d23041c83679255746.zip |
Move tool stuff to tool.{h,cpp}
Diffstat (limited to 'src/inventory.h')
-rw-r--r-- | src/inventory.h | 40 |
1 files changed, 6 insertions, 34 deletions
diff --git a/src/inventory.h b/src/inventory.h index c202d5533..b163fde90 100644 --- a/src/inventory.h +++ b/src/inventory.h @@ -52,7 +52,7 @@ public: virtual InventoryItem* clone() = 0; #ifndef SERVER // Return the name of the image for this item - virtual std::string getBasename() const { return ""; } + virtual std::string getImageBasename() const { return ""; } // Shall return an image of the item (or NULL) virtual video::ITexture * getImage() const { return NULL; } // Shall return an image of the item without embellishments (or NULL) @@ -300,44 +300,16 @@ public: { return new ToolItem(m_toolname, m_wear); } + + std::string getImageBasename() const; + #ifndef SERVER - std::string getBasename() const { - if(m_toolname == "WPick") - return "tool_woodpick.png"; - else if(m_toolname == "STPick") - return "tool_stonepick.png"; - else if(m_toolname == "SteelPick") - return "tool_steelpick.png"; - else if(m_toolname == "MesePick") - return "tool_mesepick.png"; - else if(m_toolname == "WShovel") - return "tool_woodshovel.png"; - else if(m_toolname == "STShovel") - return "tool_stoneshovel.png"; - else if(m_toolname == "SteelShovel") - return "tool_steelshovel.png"; - else if(m_toolname == "WAxe") - return "tool_woodaxe.png"; - else if(m_toolname == "STAxe") - return "tool_stoneaxe.png"; - else if(m_toolname == "SteelAxe") - return "tool_steelaxe.png"; - else if(m_toolname == "WSword") - return "tool_woodsword.png"; - else if(m_toolname == "STSword") - return "tool_stonesword.png"; - else if(m_toolname == "SteelSword") - return "tool_steelsword.png"; - else - return "cloud.png"; -} - video::ITexture * getImage() const { if(g_texturesource == NULL) return NULL; - std::string basename = getBasename(); + std::string basename = getImageBasename(); /* Calculate a progress value with sane amount of @@ -358,7 +330,7 @@ public: if(g_texturesource == NULL) return NULL; - return g_texturesource->getTextureRaw(getBasename()); + return g_texturesource->getTextureRaw(getImageBasename()); } #endif std::string getText() |