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
57 dstream<<__FUNCTION_NAME<<std::endl;
60 void setDiggingProperties(const std::string toolname,
61 const DiggingProperties &prop)
63 m_digging_properties[toolname] = prop;
66 DiggingProperties getDiggingProperties(const std::string toolname)
68 core::map<std::string, DiggingProperties>::Node *n;
69 n = m_digging_properties.find(toolname);
72 // Not diggable by this tool, try to get defaults
73 n = m_digging_properties.find("");
76 // Not diggable at all
77 return DiggingProperties();
80 // Return found properties
85 // toolname="": default properties (digging by hand)
87 core::map<std::string, DiggingProperties> m_digging_properties;
90 void initializeMaterialProperties();
92 // Material correspond to the CONTENT_* constants
93 MaterialProperties * getMaterialProperties(u8 material);
94 // For getting the default properties, set tool=""
95 DiggingProperties getDiggingProperties(u8 material, const std::string &tool);