Merge branch 'feature/cdb-packed-ryzomclassic' into temp/more-patches-53

ryzomclassic-develop
kaetemi 4 years ago
commit d1769c586f

@ -0,0 +1,2 @@
F:\tools\xsltproc\xsltproc.exe -o R:\code\ryzom\server\src\entities_game_service\database_plr.h --stringparam output header --stringparam filename DATABASE --stringparam side server --stringparam bank PLR R:\code\ryzom\common\src\game_share\generate_client_db.xslt R:\code\ryzom\common\data_common\database.xml
F:\tools\xsltproc\xsltproc.exe -o R:\code\ryzom\server\src\entities_game_service\database_plr.cpp --stringparam output cpp --stringparam filename database_plr --stringparam side server --stringparam bank PLR R:\code\ryzom\common\src\game_share\generate_client_db.xslt R:\code\ryzom\common\data_common\database.xml

@ -67,7 +67,7 @@ public:
S17, S18, S19, S20, S21, S22, S23, S24, S25, S26, S27, S28, S29, S30, S31, S32,
S33, S34, S35, S36, S37, S38, S39, S40, S41, S42, S43, S44, S45, S46, S47, S48,
S49, S50, S51, S52, S53, S54, S55, S56, S57, S58, S59, S60, S61, S62, S63, S64,
TEXT, Nb_Prop_Type
TEXT, PACKED, Nb_Prop_Type
};

@ -96,6 +96,7 @@ public:
_Property = 0;
_oldProperty = 0;
_Type = UNKNOWN;
_Nullable = false;
_Changed = false;
_LastChangeGC = 0;
}
@ -235,6 +236,9 @@ private:
/// property type
EPropType _Type;
/// nullable
bool _Nullable;
/// true if this value has changed
bool _Changed;

@ -51,6 +51,18 @@ namespace NLMISC{
//-----------------------------------------------
void CCDBNodeLeaf::init( xmlNodePtr node, IProgressCallback &/* progressCallBack */, bool /* mapBanks */, CCDBBankHandler * /* bankHandler */ )
{
// Read nullable
CXMLAutoPtr nullable((const char*)xmlGetProp (node, (xmlChar*)"nullable"));
if ((const char *) nullable != NULL)
{
_Nullable = (nullable.getDatas()[0] == '1');
}
else
{
_Nullable = false;
}
// Read type
CXMLAutoPtr type((const char*)xmlGetProp (node, (xmlChar*)"type"));
nlassert((const char *) type != NULL);
@ -87,6 +99,9 @@ void CCDBNodeLeaf::init( xmlNodePtr node, IProgressCallback &/* progressCallBac
// IF it is a TEXT.
if(!strcmp(type, "TEXT"))
_Type = ICDBNode::TEXT;
// IF it is a PACKED.
else if (!strcmp(type, "PACKED"))
_Type = ICDBNode::PACKED;
// ELSE type unknown.
else
{
@ -131,6 +146,15 @@ void CCDBNodeLeaf::write( CTextId& id, FILE * f)
fprintf(f,"%" NL_I64 "d\t%s\n",_Property,id.toString().c_str());
} // write //
inline uint readPackedBitCount(CBitMemStream & f)
{
uint64 nibbleCount;
f.serial(nibbleCount, 4);
uint bits = (nibbleCount << 2);
// nlinfo("PACKED: %u bits", (uint32)(bits));
return bits;
}
//-----------------------------------------------
// readDelta
//-----------------------------------------------
@ -141,15 +165,26 @@ void CCDBNodeLeaf::readDelta(TGameCycle gc, CBitMemStream & f )
{
// Read the Property Value according to the Property Type.
uint64 recvd = 0;
uint bits;
if (_Type == TEXT)
bits = 32;
else if (_Type <= I64)
bits = _Type;
else
bits = _Type - 64;
f.serial(recvd, bits);
uint64 isNull = 0;
if (_Nullable)
{
f.serial(isNull, 1);
}
uint bits;
if (!isNull)
{
if (_Type == TEXT)
bits = 32;
else if (_Type == PACKED)
bits = readPackedBitCount(f);
else if (_Type <= I64)
bits = _Type;
else
bits = _Type - 64;
f.serial(recvd, bits);
}
// if the DB update is older than last DB update, abort (but after the read!!)
if(gc<_LastChangeGC)
@ -162,18 +197,24 @@ void CCDBNodeLeaf::readDelta(TGameCycle gc, CBitMemStream & f )
_Property = (sint64)recvd;
// if signed
if (! ((_Type == TEXT) || (_Type <= I64)))
if (! ((_Type == TEXT) || (_Type == PACKED) || (_Type <= I64)))
{
// extend bit sign
sint64 mask = (((sint64)1)<<bits)-(sint64)1;
if( (_Property >> (bits-1))==1 )
if (!isNull)
{
_Property |= ~mask;
// extend bit sign
sint64 mask = (((sint64)1)<<bits)-(sint64)1;
if( (_Property >> (bits-1))==1 )
{
_Property |= ~mask;
}
}
}
if ( verboseDatabase )
{
nlinfo( "CDB: Read value (%u bits) %" NL_I64 "d", bits, _Property );
if (!isNull)
nlinfo( "CDB: Read value (%u bits) %" NL_I64 "d", bits, _Property );
else
nlinfo( "CDB: Read null value %" NL_I64 "d", _Property );
}
// bkup the date of change

@ -1,4 +1,8 @@
<database_description>
<!-- 2014-09-12: Now possible to use nullable="1" in leafs. This will
add 1 additional bit to the field, which will be the only bit sent
when the value of the field is 0. Use only for fields which are
updated less frequently and which are often reset. -KAE -->
<!-- Define bank superclass -->
<bank_superclass>
<bank name="PLR" class="CCDBSynchronised" />
@ -61,7 +65,7 @@
<leaf name="VALUE" type="I32" />
</branch>
<branch name="NPC_CONTROL" bank="PLR">
<leaf name="SHEET" type="I32" cppType="NLMISC::CSheetId" />
<leaf name="SHEET" type="I32" nullable="1" cppType="NLMISC::CSheetId" />
<leaf name="RUN" type="I32" />
<leaf name="WALK" type="I32" />
</branch>
@ -87,7 +91,7 @@
<branch name="BRICK_TICK_RANGE">
<!-- tick range for each power -->
<branch name="" count="64">
<leaf name="TICK_RANGE" type="I64" />
<leaf name="TICK_RANGE" type="I64" nullable="1" />
<!-- 32b for start tick and 32b for end tick -->
</branch>
</branch>
@ -113,11 +117,11 @@
</branch>
<!-- ContextMenu (Bot options etc...) -->
<branch name="CONTEXT_MENU" atom="1">
<leaf name="PROGRAMMES" type="I32" />
<leaf name="PROGRAMMES" type="I32" nullable="1" />
<!-- options for missions in the context menu -->
<branch name="MISSIONS_OPTIONS">
<branch name="" count="8">
<leaf name="TITLE" type="I32" />
<leaf name="TITLE" type="I32" nullable="1" />
<!-- a text ID of 0 means there's no action. Text ID are reseted when a new character is targeted -->
<leaf name="PLAYER_GIFT_NEEDED" type="I1" />
<!-- want a player gift ? -->
@ -126,18 +130,18 @@
</branch>
</branch>
<!-- A NPC may offer to view a webpage -->
<leaf name="WEB_PAGE_TITLE" type="I32" />
<leaf name="WEB_PAGE_TITLE" type="I32" nullable="1" />
<!-- a text ID of 0 means there's no WebPage -->
<leaf name="WEB_PAGE_URL" type="I32" />
<leaf name="WEB_PAGE_URL" type="I32" nullable="1" />
<!-- the URL text ID of the web page -->
<leaf name="OUTPOST" type="I32" cppType="NLMISC::CSheetId" />
<leaf name="OUTPOST" type="I32" nullable="1" cppType="NLMISC::CSheetId" />
<!-- outpost this bot give access to (sheet id inside) -->
<!-- Mission rings -->
<branch name="MISSION_RING">
<branch name="" count="4">
<leaf name="TITLE" type="I32" />
<leaf name="TITLE" type="I32" nullable="1" />
<!-- a text ID of 0 means there's no action. Text ID are reseted when a new character is targeted -->
<leaf name="ID" type="I32" />
<leaf name="ID" type="I32" nullable="1" />
<!-- the id of the action if selected -->
</branch>
</branch>
@ -167,27 +171,27 @@
<branch name="" count="15">
<!-- see game_share/mission_desc.h TMissionType -->
<leaf name="TYPE" type="I2" />
<leaf name="ICON" type="I32" cppType="NLMISC::CSheetId" />
<leaf name="ICON" type="I32" nullable="1" cppType="NLMISC::CSheetId" />
<!-- sheet id of a .mission_icon sheet -->
<leaf name="TITLE" type="I32" />
<leaf name="DETAIL_TEXT" type="I32" />
<leaf name="TITLE" type="I32" nullable="1" />
<leaf name="DETAIL_TEXT" type="I32" nullable="1" />
<!-- begin date in tick -->
<leaf name="BEGIN_DATE" type="I32" />
<leaf name="BEGIN_DATE" type="I32" nullable="1" />
<!-- end date in tick -->
<leaf name="END_DATE" type="I32" />
<leaf name="END_DATE" type="I32" nullable="1" />
<!-- true if the step are "OR" -->
<leaf name="OR_STEPS" type="I1" />
<branch name="GOALS">
<branch name="" count="20">
<leaf name="TEXT" type="I32" />
<leaf name="NPC_ALIAS" type="I32" />
<leaf name="TEXT" type="I32" nullable="1" />
<leaf name="NPC_ALIAS" type="I32" nullable="1" />
</branch>
</branch>
<!-- Targets -->
<branch name="TARGET" count="8" atom="1">
<leaf name="TITLE" type="I32" />
<leaf name="X" type="I32" />
<leaf name="Y" type="I32" />
<leaf name="TITLE" type="I32" nullable="1" />
<leaf name="X" type="I32" nullable="1" />
<leaf name="Y" type="I32" nullable="1" />
</branch>
<!-- Indicate if the mission is finished (0-not 1-success 2-failed) -->
<leaf name="FINISHED" type="I2" />
@ -198,14 +202,14 @@
<!-- Historic -->
<branch name="HISTO">
<branch name="" count="30">
<leaf name="TEXT" type="I32" />
<leaf name="TEXT" type="I32" nullable="1" />
</branch>
</branch>
</branch>
</branch>
</branch>
<!-- Common Item Data : For correct HELP, all items must have this structure:
<leaf name="SHEET" type="I32" cppType="NLMISC::CSheetId" />
<leaf name="SHEET" type="I32" nullable="1" cppType="NLMISC::CSheetId" />
<leaf name="QUALITY" type="I10" />
<leaf name="QUANTITY" type="I10" />
<leaf name="USER_COLOR" type="I3" />
@ -213,7 +217,7 @@
<leaf name="LOCKED" type="I10" />
<leaf name="ACCESS" type="I2" />
<leaf name="WEIGHT" type="I16" />
<leaf name="NAMEID" type="I32" />
<leaf name="NAMEID" type="I32" nullable="1" />
<leaf name="ENCHANT" type="I10" />
<leaf name="RM_CLASS_TYPE" type="I3" />
<leaf name="RM_FABER_STAT_TYPE" type="I5" />
@ -238,7 +242,7 @@
<branch name="GIVE">
<branch name="" count="8">
<!-- Common Item Data -->
<leaf name="SHEET" type="I32" cppType="NLMISC::CSheetId" />
<leaf name="SHEET" type="I32" nullable="1" cppType="NLMISC::CSheetId" />
<leaf name="QUALITY" type="I10" />
<leaf name="QUANTITY" type="I10" />
<leaf name="USER_COLOR" type="I3" />
@ -246,7 +250,7 @@
<!-- <leaf name="LOCKED" type="I10" /> -->
<!-- <leaf name="ACCESS" type="I2" /> --> <!-- TGuildGrade access grade -->
<leaf name="WEIGHT" type="I16" /> <!-- weight. see DB_WEIGHT_SCALE -->
<leaf name="NAMEID" type="I32" /> <!-- 0 or special name of item -->
<leaf name="NAMEID" type="I32" nullable="1" /> <!-- 0 or special name of item -->
<leaf name="ENCHANT" type="I10" /> <!-- 0=not enchanted, 1=enchanted nbcharge 0, 10=e. nbcharge 9 -->
<leaf name="RM_CLASS_TYPE" type="I3" /> <!-- RM_CLASS_TYPE enum -->
<leaf name="RM_FABER_STAT_TYPE" type="I6" /> <!-- RM_FABER_STAT_TYPE enum -->
@ -260,7 +264,7 @@
<branch name="RECEIVE">
<branch name="" count="8">
<!-- Common Item Data -->
<leaf name="SHEET" type="I32" cppType="NLMISC::CSheetId" />
<leaf name="SHEET" type="I32" nullable="1" cppType="NLMISC::CSheetId" />
<leaf name="QUALITY" type="I10" />
<leaf name="QUANTITY" type="I10" />
<leaf name="USER_COLOR" type="I3" />
@ -268,7 +272,7 @@
<!-- <leaf name="LOCKED" type="I10" /> -->
<!-- <leaf name="ACCESS" type="I2" /> --> <!-- TGuildGrade access grade -->
<leaf name="WEIGHT" type="I16" /> <!-- weight. see DB_WEIGHT_SCALE -->
<leaf name="NAMEID" type="I32" /> <!-- 0 or special name of item -->
<leaf name="NAMEID" type="I32" nullable="1" /> <!-- 0 or special name of item -->
<leaf name="ENCHANT" type="I10" /> <!-- 0=not enchanted, 1=enchanted nbcharge 0, 10=e. nbcharge 9 -->
<leaf name="RM_CLASS_TYPE" type="I3" /> <!-- RM_CLASS_TYPE enum -->
<leaf name="RM_FABER_STAT_TYPE" type="I6" /> <!-- RM_FABER_STAT_TYPE enum -->
@ -350,7 +354,7 @@
<branch name="" count="16">
<!-- client/inventory_manager.h MAX_TEMPINV_ENTRIES and egs/player_inv_temp.h TempInvSize -->
<!-- Common Item Data -->
<leaf name="SHEET" type="I32" cppType="NLMISC::CSheetId" />
<leaf name="SHEET" type="I32" nullable="1" cppType="NLMISC::CSheetId" />
<leaf name="QUALITY" type="I10" />
<leaf name="QUANTITY" type="I10" />
<leaf name="USER_COLOR" type="I3" />
@ -358,7 +362,7 @@
<!-- <leaf name="LOCKED" type="I10" /> -->
<!-- <leaf name="ACCESS" type="I2" /> --> <!-- TGuildGrade access grade -->
<leaf name="WEIGHT" type="I16" /> <!-- weight. see DB_WEIGHT_SCALE -->
<leaf name="NAMEID" type="I32" /> <!-- 0 or special name of item -->
<leaf name="NAMEID" type="I32" nullable="1" /> <!-- 0 or special name of item -->
<leaf name="ENCHANT" type="I10" /> <!-- 0=not enchanted, 1=enchanted nbcharge 0, 10=e. nbcharge 9 -->
<leaf name="RM_CLASS_TYPE" type="I3" /> <!-- RM_CLASS_TYPE enum -->
<leaf name="RM_FABER_STAT_TYPE" type="I6" /> <!-- RM_FABER_STAT_TYPE enum -->
@ -378,7 +382,7 @@
<!-- session id -->
<branch name="" count="16">
<!-- Common Item Data -->
<leaf name="SHEET" type="I32" cppType="NLMISC::CSheetId" />
<leaf name="SHEET" type="I32" nullable="1" cppType="NLMISC::CSheetId" />
<leaf name="QUALITY" type="I10" />
<leaf name="QUANTITY" type="I10" />
<leaf name="USER_COLOR" type="I3" />
@ -386,7 +390,7 @@
<!-- <leaf name="LOCKED" type="I10" /> -->
<!-- <leaf name="ACCESS" type="I2" /> --> <!-- TGuildGrade access grade -->
<leaf name="WEIGHT" type="I16" /> <!-- weight. see DB_WEIGHT_SCALE -->
<leaf name="NAMEID" type="I32" /> <!-- 0 or special name of item -->
<leaf name="NAMEID" type="I32" nullable="1" /> <!-- 0 or special name of item -->
<leaf name="ENCHANT" type="I10" /> <!-- 0=not enchanted, 1=enchanted nbcharge 0, 10=e. nbcharge 9 -->
<leaf name="RM_CLASS_TYPE" type="I3" /> <!-- RM_CLASS_TYPE enum -->
<leaf name="RM_FABER_STAT_TYPE" type="I6" /> <!-- RM_FABER_STAT_TYPE enum -->
@ -444,37 +448,37 @@
<!-- This is the malus ratio*50 (ie percentage/2) -->
<branch name="BONUS">
<branch name="" count="12">
<leaf name="SHEET" type="I32" cppType="NLMISC::CSheetId" />
<leaf name="SHEET" type="I32" nullable="1" cppType="NLMISC::CSheetId" />
<leaf name="DISABLED" type="I1" />
<leaf name="DISABLED_TIME" type="I32" />
<leaf name="DISABLED_TIME" type="I32" nullable="1" />
</branch>
</branch>
<branch name="MALUS">
<branch name="" count="12">
<leaf name="SHEET" type="I32" cppType="NLMISC::CSheetId" />
<leaf name="SHEET" type="I32" nullable="1" cppType="NLMISC::CSheetId" />
<leaf name="DISABLED" type="I1" />
<leaf name="DISABLED_TIME" type="I32" />
<leaf name="DISABLED_TIME" type="I32" nullable="1" />
</branch>
</branch>
</branch>
<branch name="DISABLE_CONSUMABLE" bank="PLR">
<branch name="" count="12">
<leaf name="FAMILY" type="I16" />
<leaf name="FAMILY" type="I16" nullable="1" />
<!-- Disable consumablel family -->
<leaf name="DISABLE_TIME" type="I32" />
<leaf name="DISABLE_TIME" type="I32" nullable="1" />
<!-- End date of diable time in tick -->
</branch>
</branch>
<!-- botchat texts -->
<branch name="BOTCHAT" bank="PLR">
<!-- intro for player gift -->
<leaf name="PLAYER_GIFT" type="I32" />
<leaf name="PLAYER_GIFT" type="I32" nullable="1" />
<!-- intro for guild creation -->
<leaf name="CREATE_GUILD" type="I32" />
<leaf name="CREATE_GUILD" type="I32" nullable="1" />
<!-- intro for trade window (pacts, action, item, or skills ..)-->
<leaf name="TRADE" type="I32" />
<leaf name="TRADE" type="I32" nullable="1" />
<!-- intro for choose mission -->
<leaf name="CHOOSE_MISSION" type="I32" />
<leaf name="CHOOSE_MISSION" type="I32" nullable="1" />
<!-- intro before the reward of the mission -->
<!-- <leaf name="MISSION_END_REWARD" type="I32"/> -->
<!-- text of the mission end -->
@ -483,15 +487,15 @@
<!-- <leaf name="NEWS" type="I32"/> -->
<!-- choice dynamic missions -->
<branch name="DM_CHOICE" count="3">
<leaf name="TITLE" type="I32" />
<leaf name="TITLE" type="I32" nullable="1" />
<branch name="" count="8">
<leaf name="TEXT" type="I32" />
<leaf name="TEXT" type="I32" nullable="1" />
</branch>
</branch>
<!-- title of dynamic mission -->
<leaf name="DM_TITLE" type="I32" />
<leaf name="DM_TITLE" type="I32" nullable="1" />
<!-- description of dynamic mission -->
<leaf name="DM_DESCRIPTION" type="I32" />
<leaf name="DM_DESCRIPTION" type="I32" nullable="1" />
<!-- the rolemaster type on 2 bits -->
<leaf name="ROLEMASTER_TYPE" type="I2" />
</branch>
@ -507,8 +511,8 @@
if high order bit == 0 : guild icon : 58 low order bits - back:3 bits, symbol:6 bits, Invert:1 bit, color1&2:24 bits each
if high order bit == 1 : low order bits = entry in the LIFT_ICONS::TLiftIcon enum
-->
<leaf name="ICON" type="I64" />
<leaf name="NAME" type="I32" />
<leaf name="ICON" type="I64" nullable="1" />
<leaf name="NAME" type="I32" nullable="1" />
</branch>
</branch>
<branch name="CHOOSE_MISSIONS" bank="PLR" atom="1">
@ -518,10 +522,10 @@
<leaf name="HAS_NEXT" type="I1" />
<!-- are there pages left ? -->
<branch name="" count="8">
<leaf name="ICON" type="I32" cppType="NLMISC::CSheetId" />
<leaf name="ICON" type="I32" nullable="1" cppType="NLMISC::CSheetId" />
<!-- sheet id of a .mission_icon sheet -->
<leaf name="TEXT" type="I32" />
<leaf name="DETAIL_TEXT" type="I32" />
<leaf name="TEXT" type="I32" nullable="1" />
<leaf name="DETAIL_TEXT" type="I32" nullable="1" />
<leaf name="PREREQ_STATE" type="I8" />
<!-- game_share/mission_desc.h/TPreReqState -->
</branch>
@ -549,7 +553,7 @@
<!-- 10000*factor to apply on item price, so if this value = 10000, factor is 1.0 -->
<branch name="" count="8">
<!-- Common Item Data -->
<leaf name="SHEET" type="I32" cppType="NLMISC::CSheetId" />
<leaf name="SHEET" type="I32" nullable="1" cppType="NLMISC::CSheetId" />
<leaf name="QUALITY" type="I10" />
<leaf name="QUANTITY" type="I10" />
<leaf name="USER_COLOR" type="I3" />
@ -557,7 +561,7 @@
<!-- <leaf name="LOCKED" type="I10" /> -->
<!-- <leaf name="ACCESS" type="I2" /> --> <!-- TGuildGrade access grade -->
<leaf name="WEIGHT" type="I16" /> <!-- weight. see DB_WEIGHT_SCALE -->
<leaf name="NAMEID" type="I32" /> <!-- 0 or special name of item -->
<leaf name="NAMEID" type="I32" nullable="1" /> <!-- 0 or special name of item -->
<leaf name="ENCHANT" type="I10" /> <!-- 0=not enchanted, 1=enchanted nbcharge 0, 10=e. nbcharge 9 -->
<leaf name="RM_CLASS_TYPE" type="I3" /> <!-- RM_CLASS_TYPE enum -->
<leaf name="RM_FABER_STAT_TYPE" type="I6" /> <!-- RM_FABER_STAT_TYPE enum -->
@ -571,7 +575,7 @@
<!-- The currency type RYMSG::TTradeCurrency -->
<leaf name="RRP_LEVEL" type="I4" />
<!-- For rrp curency, specify the rrp level -->
<leaf name="MONEY_SHEET" type="I32" cppType="NLMISC::CSheetId" />
<leaf name="MONEY_SHEET" type="I32" nullable="1" cppType="NLMISC::CSheetId" />
<!-- For item curency, specify the item sheet -->
<leaf name="BASE_SKILL" type="I4" />
<!-- For skill curency, specify the base skill as in EGSPD::CSPType::TSPType -->
@ -582,7 +586,7 @@
<!-- Special Trade -->
<leaf name="PRICE_RETIRE" type="I32" />
<leaf name="RESALE_TIME_LEFT" type="I16" />
<leaf name="VENDOR_NAMEID" type="TEXT" />
<leaf name="VENDOR_NAMEID" type="TEXT" nullable="1" />
<!-- name id of player vendor -->
<leaf name="FACTION_POINT_PRICE" type="I32" />
<!-- 0 for standard behaviour -->
@ -596,7 +600,7 @@
</branch>
<branch name="BRICK_FAMILY" bank="PLR">
<branch name="" count="1024">
<leaf name="BRICKS" type="I64" />
<leaf name="BRICKS" type="PACKED" nullable="1" />
</branch>
</branch>
<!--
@ -610,27 +614,27 @@
<branch name="" count="15">
<!-- see game_share/mission_desc.h TMissionType -->
<leaf name="TYPE" type="I2" />
<leaf name="ICON" type="I32" cppType="NLMISC::CSheetId" />
<leaf name="ICON" type="I32" nullable="1" cppType="NLMISC::CSheetId" />
<!-- sheet id of a .mission_icon sheet -->
<leaf name="TITLE" type="I32" />
<leaf name="DETAIL_TEXT" type="I32" />
<leaf name="TITLE" type="I32" nullable="1" />
<leaf name="DETAIL_TEXT" type="I32" nullable="1" />
<!-- begin date in tick -->
<leaf name="BEGIN_DATE" type="I32" />
<leaf name="BEGIN_DATE" type="I32" nullable="1" />
<!-- end date in tick -->
<leaf name="END_DATE" type="I32" />
<leaf name="END_DATE" type="I32" nullable="1" />
<!-- true if the step are "OR" -->
<leaf name="OR_STEPS" type="I1" />
<branch name="GOALS">
<branch name="" count="20">
<leaf name="TEXT" type="I32" />
<leaf name="NPC_ALIAS" type="I32" />
<leaf name="TEXT" type="I32" nullable="1" />
<leaf name="NPC_ALIAS" type="I32" nullable="1" />
</branch>
</branch>
<!-- Targets -->
<branch name="TARGET" count="8" atom="1">
<leaf name="TITLE" type="I32" />
<leaf name="X" type="I32" />
<leaf name="Y" type="I32" />
<leaf name="TITLE" type="I32" nullable="1" />
<leaf name="X" type="I32" nullable="1" />
<leaf name="Y" type="I32" nullable="1" />
</branch>
<!-- Indicate if the mission is finished (0-not 1-success 2-failed) -->
<leaf name="FINISHED" type="I2" />
@ -641,7 +645,7 @@
<!-- Historic -->
<branch name="HISTO">
<branch name="" count="30">
<leaf name="TEXT" type="I32" />
<leaf name="TEXT" type="I32" nullable="1" />
</branch>
</branch>
</branch>
@ -650,7 +654,7 @@
<!-- The index of the phrase in the spell book that is being executed right now -->
<leaf name="PHRASE" type="I16" />
<!-- If not a phrase in the speel book, give the associated brick sheet id -->
<leaf name="SHEET" type="I32" cppType="NLMISC::CSheetId" />
<leaf name="SHEET" type="I32" nullable="1" cppType="NLMISC::CSheetId" />
<!-- When the NEXT_COUNTER reach the one on client, reset -->
<leaf name="NEXT_COUNTER" type="I8" />
<!-- When the CYCLE_COUNTER reach the one on client, reset -->
@ -665,7 +669,7 @@
<leaf name="SAP_COST" type="I16" />
<leaf name="STA_COST" type="I16" />
<!-- Entity name -->
<leaf name="TARGET_NAME" type="TEXT" />
<leaf name="TARGET_NAME" type="TEXT" nullable="1" />
<!-- Entity State -->
<leaf name="TARGET_HP" type="I7" />
<leaf name="TARGET_SAP" type="I7" />
@ -712,13 +716,13 @@
<branch name="MEMBERS">
<!-- Guild Members -->
<branch name="" count="256">
<leaf name="NAME" type="TEXT" />
<leaf name="NAME" type="TEXT" nullable="1" />
<!-- player name -->
<leaf name="GRADE" type="I3" />
<!-- player grade-->
<leaf name="ONLINE" type="I2" cppType="TCharConnectionState" />
<!-- enum TCharConnectionState -->
<leaf name="ENTER_DATE" type="I32" />
<leaf name="ENTER_DATE" type="I32" nullable="1" />
<!-- tick when player entered the guild-->
</branch>
</branch>
@ -810,7 +814,7 @@
<branch name="SQUAD_SHOP">
<!-- list of squad that we can buy -->
<branch name="" count="16">
<leaf name="SHEET" type="I32" cppType="NLMISC::CSheetId" />
<leaf name="SHEET" type="I32" nullable="1" cppType="NLMISC::CSheetId" />
</branch>
</branch>
<branch name="SQUADS">
@ -820,11 +824,11 @@
-->
<branch name="SP" count="24">
<!-- Spawned -->
<leaf name="SHEET" type="I32" cppType="NLMISC::CSheetId" />
<leaf name="SHEET" type="I32" nullable="1" cppType="NLMISC::CSheetId" />
</branch>
<branch name="T" count="24">
<!-- Training -->
<leaf name="SHEET" type="I32" cppType="NLMISC::CSheetId" />
<leaf name="SHEET" type="I32" nullable="1" cppType="NLMISC::CSheetId" />
<leaf name="SPAWN" type="I4" />
<!-- Index in SQUAD_SPAWN_ZONE list -->
</branch>
@ -835,7 +839,7 @@
<branch name="BUILDINGS">
<!-- list of buildings on the outpost -->
<branch name="" count="4">
<leaf name="SHEET" type="I32" cppType="NLMISC::CSheetId" />
<leaf name="SHEET" type="I32" nullable="1" cppType="NLMISC::CSheetId" />
</branch>
</branch>
</branch>
@ -984,7 +988,7 @@
<!-- X uint32 << 32 | Y uint32 -->
<leaf name="HUNGER" type="I5" />
<leaf name="DESPAWN" type="I7" />
<leaf name="NAME" type="I32" is_true="1" />
<leaf name="NAME" type="I32" nullable="1" is_true="1" />
</branch>
</branch>
<branch name="DEBUG_INFO" bank="PLR">
@ -1056,9 +1060,9 @@
<!-- DynChat channels -->
<branch name="DYN_CHAT" bank="PLR">
<branch name="CHANNEL" count="8" atom="1">
<leaf name="NAME" type="I32" />
<leaf name="NAME" type="I32" nullable="1" />
<!-- channel not available if anme is 0 -->
<leaf name="ID" type="I64" />
<leaf name="ID" type="I64" nullable="1" />
<!-- unique ID of channel (eid) -->
<leaf name="WRITE_RIGHT" type="I1" />
</branch>

@ -722,7 +722,8 @@ void <xsl:call-template name="makeFullClassName"/>::init(ICDBStructNode *parent<
<xsl:when test="$leafType = 'S63'"> <xsl:text>sint64</xsl:text> </xsl:when>
<xsl:when test="$leafType = 'S64'"> <xsl:text>sint64</xsl:text> </xsl:when>
<xsl:when test="$leafType = 'TEXT'"> <xsl:text>ucstring</xsl:text> </xsl:when>
<xsl:when test="$leafType = 'TEXT'"> <xsl:text>ucstring</xsl:text> </xsl:when>
<xsl:when test="$leafType = 'PACKED'"> <xsl:text>uint64</xsl:text> </xsl:when>
<xsl:otherwise> <xsl:message terminate="yes">Unsupported leaf type <xsl:value-of select="$leafType"/></xsl:message></xsl:otherwise>
</xsl:choose>
</xsl:if>

@ -43,7 +43,6 @@ CBankAccessor_PLR::TASCENSOR CBankAccessor_PLR::_ASCENSOR;
CBankAccessor_PLR::TCHOOSE_MISSIONS CBankAccessor_PLR::_CHOOSE_MISSIONS;
CBankAccessor_PLR::TTRADING CBankAccessor_PLR::_TRADING;
CBankAccessor_PLR::TBRICK_FAMILY CBankAccessor_PLR::_BRICK_FAMILY;
CBankAccessor_PLR::TFABER_PLANS CBankAccessor_PLR::_FABER_PLANS;
CBankAccessor_PLR::TMISSIONS CBankAccessor_PLR::_MISSIONS;
CBankAccessor_PLR::TEXECUTE_PHRASE CBankAccessor_PLR::_EXECUTE_PHRASE;
CBankAccessor_PLR::TCHARACTER_INFO CBankAccessor_PLR::_CHARACTER_INFO;
@ -155,11 +154,6 @@ void CBankAccessor_PLR::init()
// call sub branch init
_BRICK_FAMILY.init(node);
node = bank->getICDBStructNodeFromName( BankTag, "FABER_PLANS" );
nlassert(node != NULL);
// call sub branch init
_FABER_PLANS.init(node);
node = bank->getICDBStructNodeFromName( BankTag, "MISSIONS" );
nlassert(node != NULL);
// call sub branch init
@ -2285,45 +2279,6 @@ void CBankAccessor_PLR::TBRICK_FAMILY::TArray::init(ICDBStructNode *parent, uint
}
void CBankAccessor_PLR::TFABER_PLANS::init(ICDBStructNode *parent)
{
ICDBStructNode *node = parent;
_BranchNode = node;
// leaf init
// branch init
for (uint i=0; i<64; ++i)
{
node = parent->getNode( ICDBStructNode::CTextId(NLMISC::toString("%u", i)), false );
nlassert(node != NULL);
_Array[i].init(node, i);
}
}
void CBankAccessor_PLR::TFABER_PLANS::TArray::init(ICDBStructNode *parent, uint index)
{
ICDBStructNode *node = parent;
_BranchNode = node;
// leaf init
node = parent->getNode( ICDBStructNode::CTextId("KNOWN"), false );
nlassert(node != NULL);
_KNOWN = node;
// branch init
}
void CBankAccessor_PLR::TMISSIONS::init(ICDBStructNode *parent)
{
ICDBStructNode *node = parent;

@ -6723,77 +6723,6 @@ inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, NLMISC::C
};
class TFABER_PLANS
{
public:
class TArray
{
public:
private:
ICDBStructNode *_BranchNode;
ICDBStructNode *_KNOWN;
public:
void init(ICDBStructNode *parent, uint index);
// accessor to branch node
ICDBStructNode *getCDBNode()
{
return _BranchNode;
}
void setKNOWN(CCDBSynchronised &dbGroup, uint64 value, bool forceSending = false)
{
_setProp(dbGroup, _KNOWN, value, forceSending);
}
uint64 getKNOWN(const CCDBSynchronised &dbGroup)
{
uint64 value;
_getProp(dbGroup, _KNOWN, value);
return value;
}
ICDBStructNode *getKNOWNCDBNode()
{
return _KNOWN;
}
};
private:
ICDBStructNode *_BranchNode;
TArray _Array[64];
public:
void init(ICDBStructNode *parent);
// accessor to branch node
ICDBStructNode *getCDBNode()
{
return _BranchNode;
}
TArray &getArray(uint32 index)
{
nlassert(index < 64);
return _Array[index];
}
};
class TMISSIONS
{
public:
@ -10507,8 +10436,6 @@ inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, NLMISC::C
static TBRICK_FAMILY _BRICK_FAMILY;
static TFABER_PLANS _FABER_PLANS;
static TMISSIONS _MISSIONS;
static TEXECUTE_PHRASE _EXECUTE_PHRASE;
@ -10617,10 +10544,6 @@ inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, NLMISC::C
{
return _BRICK_FAMILY;
}
static TFABER_PLANS &getFABER_PLANS()
{
return _FABER_PLANS;
}
static TMISSIONS &getMISSIONS()
{
return _MISSIONS;

@ -55,7 +55,7 @@ public:
I17, I18, I19, I20, I21, I22, I23, I24, I25, I26, I27, I28, I29, I30, I31, I32,
I33, I34, I35, I36, I37, I38, I39, I40, I41, I42, I43, I44, I45, I46, I47, I48,
I49, I50, I51, I52, I53, I54, I55, I56, I57, I58, I59, I60, I61, I62, I63, I64,
TEXT, Nb_Prop_Type
TEXT, PACKED, Nb_Prop_Type
};

@ -45,6 +45,18 @@ using namespace std;
//-----------------------------------------------
void CCDBStructNodeLeaf::init( xmlNodePtr node, NLMISC::IProgressCallback &progressCallBack )
{
// Read nullable
CXMLAutoPtr nullable((const char*)xmlGetProp (node, (xmlChar*)"nullable"));
if ((const char *) nullable != NULL)
{
_Nullable = (nullable.getDatas()[0] == '1');
}
else
{
_Nullable = false;
}
// Read type
CXMLAutoPtr type((const char*)xmlGetProp (node, (xmlChar*)"type"));
nlassert((const char *) type != NULL);
@ -79,6 +91,9 @@ void CCDBStructNodeLeaf::init( xmlNodePtr node, NLMISC::IProgressCallback &progr
// IF it is a TEXT.
if(!strcmp(type, "TEXT"))
_Type = ICDBStructNode::TEXT;
// IF it is a PACKED.
else if(!strcmp(type, "PACKED"))
_Type = ICDBStructNode::PACKED;
// ELSE type unknown.
else
{

@ -36,6 +36,9 @@ public:
/// Return the type of the property.
inline const EPropType & type() const {return _Type;}
/// Return the type of the property.
inline bool nullable() const {return _Nullable;}
/// The overridden version that is usable from ICDBStructNode
virtual EPropType getType() const {return _Type;}
@ -46,7 +49,7 @@ public:
/**
* Default constructor
*/
CCDBStructNodeLeaf() : ICDBStructNode(), _Parent( NULL ), _Type( UNKNOWN ) {}
CCDBStructNodeLeaf() : ICDBStructNode(), _Parent( NULL ), _Type( UNKNOWN ), _Nullable( false ) {}
/**
* Build the structure of the database from a file
@ -178,6 +181,9 @@ private:
/// property type
EPropType _Type;
/// nullable
bool _Nullable;
/// Binary property id of the leaf (precalculated & stored to avoid having to get back in the tree to build it)
CBinId _LeafId;
};

@ -516,6 +516,55 @@ bool CCDBSynchronised::writePermanentDelta( NLMISC::CBitMemStream& s )
return true;
}
inline void pushPackedValue( CBitMemStream& s, uint64 value, uint32& bitsize, uint &bits )
{
// fast count of max bit
uint32 next = (uint32)(value >> 32);
uint32 test;
bits = 0;
if (next) // 64bit
{
bits += 32;
test = next; // 32 msb
}
else
{
test = (uint32)(value & 0xFFFFFFFF); // 32 lsb
}
next = (test >> 16);
if (next)
{
bits += 16;
test = next; // 16 msb
}
else
{
test = (test & 0xFFFF); // 16 lsb
}
next = (test >> 8);
if (next)
{
bits += 8;
test = next; // 8 msb
}
else
{
test = (test & 0xFF); // 8 lsb
}
next = (test >> 4);
if (next)
{
bits += 8;
}
else if (test & 0xF)
{
bits += 4;
}
uint64 nibbleCount = (bits >> 2);
s.serialAndLog2( nibbleCount, 4 );
s.serialAndLog2( value, bits );
bitsize += (4 + bits);
}
/*
* Push one change to the stream
@ -532,19 +581,42 @@ void CCDBSynchronised::pushDelta( CBitMemStream& s, CCDBStructNodeLeaf *node, ui
value = (uint64)_DataContainer.getValue64( index );
//_DataContainer.archiveCurrentValue( index );
if ( node->type() == ICDBStructNode::TEXT )
if ( node->nullable() && value == 0 )
{
s.serialAndLog2( value, 32 );
bitsize += 32;
if ( VerboseDatabase )
nldebug( "CDB: Pushing value %" NL_I64 "d (TEXT-32) for index %d prop %s", (sint64)value, index, node->buildTextId().toString().c_str() );
uint64 isNull = 1;
s.serialAndLog2( isNull, 1 );
bitsize += 1;
}
else
{
s.serialAndLog2( value, (uint)node->type() );
bitsize += (uint32)node->type();
if ( VerboseDatabase )
nldebug( "CDB: Pushing 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 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 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 value %" NL_I64 "d (%u bits) for index %d prop %s", (sint64)value, (uint32)node->type(), index, node->buildTextId().toString().c_str() );
}
}
}
else
@ -573,6 +645,13 @@ void CCDBSynchronised::pushDeltaPermanent( NLMISC::CBitMemStream& s, CCDBStructN
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() );

Loading…
Cancel
Save