]> git.lizzy.rs Git - minetest.git/blobdiff - src/mineral.h
Properly use time_from_last_punch for limiting PvP punch damage
[minetest.git] / src / mineral.h
index e43e48ab88076f66b655947235bd2da4edb2d038..4949fe07ec42cbc6ecd5a15de21ffb06f6e7b1d8 100644 (file)
@@ -29,29 +29,25 @@ with this program; if not, write to the Free Software Foundation, Inc.,
        type param.
 */
 
+// Caches textures
+void init_mineral();
+
 #define MINERAL_NONE 0
 #define MINERAL_COAL 1
 #define MINERAL_IRON 2
 
-inline const char * mineral_block_texture(u8 mineral)
-{
-       switch(mineral)
-       {
-       case MINERAL_COAL:
-               return "mineral_coal.png";
-       case MINERAL_IRON:
-               return "mineral_iron.png";
-       default:
-               return "";
-       }
-}
+#define MINERAL_COUNT 3
+
+std::string mineral_block_texture(u8 mineral);
+
+class IGameDef;
 
-inline CraftItem * getDiggedMineralItem(u8 mineral)
+inline CraftItem * getDiggedMineralItem(u8 mineral, IGameDef *gamedef)
 {
        if(mineral == MINERAL_COAL)
-               return new CraftItem("lump_of_coal", 1);
+               return new CraftItem(gamedef, "lump_of_coal", 1);
        else if(mineral == MINERAL_IRON)
-               return new CraftItem("lump_of_iron", 1);
+               return new CraftItem(gamedef, "lump_of_iron", 1);
 
        return NULL;
 }