summaryrefslogtreecommitdiff
path: root/src/nodemetadata.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-11-14 00:19:48 +0200
committerPerttu Ahola <celeron55@gmail.com>2011-11-29 19:13:41 +0200
commitabceeee92f99b84ebb79968269835a4f509bfb90 (patch)
tree669edeca68fae4eb086ac4e4c1846b55d3aa779d /src/nodemetadata.cpp
parent5fc791ac9a15ea6f234ca2d23041c83679255746 (diff)
downloadminetest-abceeee92f99b84ebb79968269835a4f509bfb90.tar.gz
minetest-abceeee92f99b84ebb79968269835a4f509bfb90.tar.bz2
minetest-abceeee92f99b84ebb79968269835a4f509bfb90.zip
Create framework for getting rid of global definitions of node/tool/item/whatever types
Diffstat (limited to 'src/nodemetadata.cpp')
-rw-r--r--src/nodemetadata.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/nodemetadata.cpp b/src/nodemetadata.cpp
index 6fbfc2dba..ef6ea1cd2 100644
--- a/src/nodemetadata.cpp
+++ b/src/nodemetadata.cpp
@@ -32,7 +32,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
core::map<u16, NodeMetadata::Factory> NodeMetadata::m_types;
-NodeMetadata::NodeMetadata()
+NodeMetadata::NodeMetadata(IGameDef *gamedef):
+ m_gamedef(gamedef)
{
}
@@ -40,7 +41,7 @@ NodeMetadata::~NodeMetadata()
{
}
-NodeMetadata* NodeMetadata::deSerialize(std::istream &is)
+NodeMetadata* NodeMetadata::deSerialize(std::istream &is, IGameDef *gamedef)
{
// Read id
u8 buf[2];
@@ -67,7 +68,7 @@ NodeMetadata* NodeMetadata::deSerialize(std::istream &is)
std::istringstream iss(data, std::ios_base::binary);
Factory f = n->getValue();
- NodeMetadata *meta = (*f)(iss);
+ NodeMetadata *meta = (*f)(iss, gamedef);
return meta;
}
catch(SerializationError &e)
@@ -128,7 +129,7 @@ void NodeMetadataList::serialize(std::ostream &os)
}
}
-void NodeMetadataList::deSerialize(std::istream &is)
+void NodeMetadataList::deSerialize(std::istream &is, IGameDef *gamedef)
{
m_data.clear();
@@ -159,7 +160,7 @@ void NodeMetadataList::deSerialize(std::istream &is)
p16 -= p.Y * MAP_BLOCKSIZE;
p.X += p16;
- NodeMetadata *data = NodeMetadata::deSerialize(is);
+ NodeMetadata *data = NodeMetadata::deSerialize(is, gamedef);
if(data == NULL)
continue;