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"
28 #include "inventory.h"
31 struct DiggingProperties
39 DiggingProperties(bool a_diggable, float a_time, u16 a_wear):
46 // Digging time in seconds
52 class MaterialProperties
59 void setDiggingProperties(const std::string toolname,
60 const DiggingProperties &prop)
62 m_digging_properties[toolname] = prop;
65 DiggingProperties getDiggingProperties(const std::string toolname)
67 core::map<std::string, DiggingProperties>::Node *n;
68 n = m_digging_properties.find(toolname);
71 // Not diggable by this tool, try to get defaults
72 n = m_digging_properties.find("");
75 // Not diggable at all
76 return DiggingProperties();
79 // Return found properties
84 // toolname="": default properties (digging by hand)
86 core::map<std::string, DiggingProperties> m_digging_properties;
89 void initializeMaterialProperties();
91 // Material correspond to the CONTENT_* constants
92 MaterialProperties * getMaterialProperties(u8 material);
93 // For getting the default properties, set tool=""
94 DiggingProperties getDiggingProperties(u8 material, const std::string &tool);