diff --git a/ryzom/server/src/entities_game_service/player_manager/cdb_synchronised.cpp b/ryzom/server/src/entities_game_service/player_manager/cdb_synchronised.cpp index 99805ee44..3a3bdab26 100644 --- a/ryzom/server/src/entities_game_service/player_manager/cdb_synchronised.cpp +++ b/ryzom/server/src/entities_game_service/player_manager/cdb_synchronised.cpp @@ -587,6 +587,8 @@ void CCDBSynchronised::pushDelta( CBitMemStream& s, CCDBStructNodeLeaf *node, ui uint64 isNull = 1; s.serialAndLog2( isNull, 1 ); bitsize += 1; + if ( VerboseDatabase ) + nldebug( "CDB: Pushing permanent value NULL for index %d prop %s", index, node->buildTextId().toString().c_str() ); } else { @@ -639,26 +641,44 @@ void CCDBSynchronised::pushDeltaPermanent( NLMISC::CBitMemStream& s, CCDBStructN uint64 value; value = (uint64)_DataContainer.getValue64( index ); // "delta from 0" - if ( node->type() == ICDBStructNode::TEXT ) - { - s.serialAndLog2( value, 32 ); - bitsize += 32; - if ( VerboseDatabase ) - nldebug( "CDB: Pushing permanent value %" NL_I64 "d (TEXT-32) for index %d prop %s", (sint64)value, index, node->buildTextId().toString().c_str() ); - } - else if ( node->type() == ICDBStructNode::PACKED ) + if ( node->nullable() && value == 0 ) { - uint bits; - pushPackedValue( s, value, bitsize, bits ); + uint64 isNull = 1; + s.serialAndLog2( isNull, 1 ); + bitsize += 1; if ( VerboseDatabase ) - nldebug( "CDB: Pushing permanent value %" NL_I64 "d (PACKED %u bits) for index %d prop %s", (sint64)value, bits, index, node->buildTextId().toString().c_str() ); + nldebug( "CDB: Pushing permanent value NULL for index %d prop %s", index, node->buildTextId().toString().c_str() ); } else { - s.serialAndLog2( value, (uint)node->type() ); - bitsize += (uint32)node->type(); - if ( VerboseDatabase ) - nldebug( "CDB: Pushing permanent value %" NL_I64 "d (%u bits) for index %d prop %s", (sint64)value, (uint32)node->type(), index, node->buildTextId().toString().c_str() ); + if ( node->nullable() ) + { + uint64 isNull = 0; + s.serialAndLog2( isNull, 1 ); + bitsize += 1; + } + + if ( node->type() == ICDBStructNode::TEXT ) + { + s.serialAndLog2( value, 32 ); + bitsize += 32; + if ( VerboseDatabase ) + nldebug( "CDB: Pushing permanent value %" NL_I64 "d (TEXT-32) for index %d prop %s", (sint64)value, index, node->buildTextId().toString().c_str() ); + } + else if ( node->type() == ICDBStructNode::PACKED ) + { + uint bits; + pushPackedValue( s, value, bitsize, bits ); + if ( VerboseDatabase ) + nldebug( "CDB: Pushing permanent value %" NL_I64 "d (PACKED %u bits) for index %d prop %s", (sint64)value, bits, index, node->buildTextId().toString().c_str() ); + } + else + { + s.serialAndLog2( value, (uint)node->type() ); + bitsize += (uint32)node->type(); + if ( VerboseDatabase ) + nldebug( "CDB: Pushing permanent value %" NL_I64 "d (%u bits) for index %d prop %s", (sint64)value, (uint32)node->type(), index, node->buildTextId().toString().c_str() ); + } } } else