1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Node definitions transfer

This commit is contained in:
Perttu Ahola 2011-11-15 20:32:56 +02:00
parent eed727c61b
commit 6da8cb00e2
6 changed files with 80 additions and 2 deletions

View file

@ -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(): "