summaryrefslogtreecommitdiff
path: root/src/nodedef.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-11-15 20:32:56 +0200
committerPerttu Ahola <celeron55@gmail.com>2011-11-29 19:13:44 +0200
commit6da8cb00e27106221e013aa6d93965b95e630a18 (patch)
treec463f02b5ecced9e18672b6b8b9c923b1f2384d0 /src/nodedef.cpp
parenteed727c61b51f46f6d172c56ecd26a3b1752d449 (diff)
downloadminetest-6da8cb00e27106221e013aa6d93965b95e630a18.tar.gz
minetest-6da8cb00e27106221e013aa6d93965b95e630a18.tar.bz2
minetest-6da8cb00e27106221e013aa6d93965b95e630a18.zip
Node definitions transfer
Diffstat (limited to 'src/nodedef.cpp')
-rw-r--r--src/nodedef.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/nodedef.cpp b/src/nodedef.cpp
index 996b20781..c86a3aefc 100644
--- a/src/nodedef.cpp
+++ b/src/nodedef.cpp
@@ -451,6 +451,7 @@ public:
}
void serialize(std::ostream &os)
{
+ u16 count = 0;
std::ostringstream tmp_os(std::ios::binary);
for(u16 i=0; i<=MAX_CONTENT; i++)
{
@@ -459,14 +460,17 @@ public:
continue;
writeU16(tmp_os, i);
f->serialize(tmp_os);
+ count++;
}
+ writeU16(os, count);
os<<serializeLongString(tmp_os.str());
}
void deSerialize(std::istream &is, IGameDef *gamedef)
{
clear();
+ u16 count = readU16(is);
std::istringstream tmp_is(deSerializeLongString(is), std::ios::binary);
- while(!tmp_is.eof()){
+ for(u16 n=0; n<count; n++){
u16 i = readU16(tmp_is);
if(i > MAX_CONTENT){
errorstream<<"ContentFeatures::deSerialize(): "