diff --git a/src/game.cpp b/src/game.cpp index d6c9910b..7515af8d 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -991,6 +991,7 @@ void the_game( server->start(port); } + try{ do{ // Client scope (breakable do-while(0)) /* @@ -2911,6 +2912,14 @@ void the_game( // Client scope (client is destructed before destructing *def and tsrc) }while(0); + } // try-catch + catch(SerializationError &e) + { + error_message = L"A serialization error occurred:\n" + + narrow_to_wide(e.what()) + L"\n\nThe server is probably " + L" running a different version of Minetest."; + errorstream<name == "") continue; - writeU16(tmp_os, i); - f->serialize(tmp_os); + writeU16(os2, i); + // Wrap it in a string to allow different lengths without + // strict version incompatibilities + std::ostringstream wrapper_os(std::ios::binary); + f->serialize(wrapper_os); + os2< MAX_CONTENT){ errorstream<<"ContentFeatures::deSerialize(): " <<"Too large content id: "<deSerialize(tmp_is); + // Read it from the string wrapper + std::string wrapper = deSerializeString(is2); + std::istringstream wrapper_is(wrapper, std::ios::binary); + f->deSerialize(wrapper_is); if(f->name != "") addNameIdMapping(i, f->name); }