summaryrefslogtreecommitdiff
path: root/src/materials.h
diff options
context:
space:
mode:
authorNils Dagsson Moskopp <nils@dieweltistgarnichtso.net>2011-06-27 06:56:26 -0700
committerNils Dagsson Moskopp <nils@dieweltistgarnichtso.net>2011-06-27 06:56:26 -0700
commitf37a3a84fafb91bcfc109fed95aa6d42726f1bf7 (patch)
treecde1e5f47f191beb4a9cefcd87872aef53b5fcec /src/materials.h
parente261cc9e8fa67c9020fa0a82bd1a7041ecd351a0 (diff)
parent13cf5425db613dc0a4323c87a4988bb18fb87aca (diff)
downloadminetest-f37a3a84fafb91bcfc109fed95aa6d42726f1bf7.tar.gz
minetest-f37a3a84fafb91bcfc109fed95aa6d42726f1bf7.tar.bz2
minetest-f37a3a84fafb91bcfc109fed95aa6d42726f1bf7.zip
Merge pull request #13 from Bahamada/upstream_merge
Upstream merge
Diffstat (limited to 'src/materials.h')
-rw-r--r--src/materials.h24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/materials.h b/src/materials.h
index 422149753..f061ecbfa 100644
--- a/src/materials.h
+++ b/src/materials.h
@@ -25,7 +25,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
*/
#include "common_irrlicht.h"
-#include "inventory.h"
#include <string>
struct DiggingProperties
@@ -49,20 +48,26 @@ struct DiggingProperties
u16 wear;
};
-class MaterialProperties
+/*
+ This is a bad way of determining mining characteristics.
+ TODO: Get rid of this and set up some attributes like toughness,
+ fluffyness, and a funciton to calculate time and durability loss
+ (and sound? and whatever else) from them
+*/
+class DiggingPropertiesList
{
public:
- MaterialProperties()
+ DiggingPropertiesList()
{
}
- void setDiggingProperties(const std::string toolname,
+ void set(const std::string toolname,
const DiggingProperties &prop)
{
m_digging_properties[toolname] = prop;
}
- DiggingProperties getDiggingProperties(const std::string toolname)
+ DiggingProperties get(const std::string toolname)
{
core::map<std::string, DiggingProperties>::Node *n;
n = m_digging_properties.find(toolname);
@@ -80,16 +85,17 @@ public:
return n->getValue();
}
+ void clear()
+ {
+ m_digging_properties.clear();
+ }
+
private:
// toolname="": default properties (digging by hand)
// Key is toolname
core::map<std::string, DiggingProperties> m_digging_properties;
};
-void initializeMaterialProperties();
-
-// Material correspond to the CONTENT_* constants
-MaterialProperties * getMaterialProperties(u8 material);
// For getting the default properties, set tool=""
DiggingProperties getDiggingProperties(u8 material, const std::string &tool);