3 Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #ifndef MATERIALS_HEADER
21 #define MATERIALS_HEADER
27 #include "common_irrlicht.h"
30 struct DiggingProperties
38 DiggingProperties(bool a_diggable, float a_time, u16 a_wear):
45 // Digging time in seconds
52 This is a bad way of determining mining characteristics.
53 TODO: Get rid of this and set up some attributes like toughness,
54 fluffyness, and a funciton to calculate time and durability loss
55 (and sound? and whatever else) from them
57 class DiggingPropertiesList
60 DiggingPropertiesList()
64 void set(const std::string toolname,
65 const DiggingProperties &prop)
67 m_digging_properties[toolname] = prop;
70 DiggingProperties get(const std::string toolname)
72 core::map<std::string, DiggingProperties>::Node *n;
73 n = m_digging_properties.find(toolname);
76 // Not diggable by this tool, try to get defaults
77 n = m_digging_properties.find("");
80 // Not diggable at all
81 return DiggingProperties();
84 // Return found properties
90 m_digging_properties.clear();
94 // toolname="": default properties (digging by hand)
96 core::map<std::string, DiggingProperties> m_digging_properties;
99 // For getting the default properties, set tool=""
100 DiggingProperties getDiggingProperties(u16 material, const std::string &tool);