From b8030b966a91ff69eb50c894d202a88c08fee054 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Sat, 14 Jul 2012 01:46:22 +0200 Subject: [PATCH] CHANGED: #1471 Apparently it's a bad idea for NLMISC to depend on a global in Ryzom client, since then it cannot be linked with other binaries. --HG-- branch : gui-refactoring --- code/nel/include/nel/misc/cdb.h | 11 +++++------ code/nel/src/misc/cdb.cpp | 1 + code/nel/src/misc/cdb_branch.cpp | 10 +++++----- code/nel/src/misc/cdb_leaf.cpp | 2 +- code/ryzom/client/src/cdb_synchronised.cpp | 4 +--- code/ryzom/client/src/commands.cpp | 6 ++++-- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/code/nel/include/nel/misc/cdb.h b/code/nel/include/nel/misc/cdb.h index d23986b0c..39426b6b9 100644 --- a/code/nel/include/nel/misc/cdb.h +++ b/code/nel/include/nel/misc/cdb.h @@ -35,12 +35,6 @@ class CCDBNodeLeaf; class CCDBNodeBranch; class CCDBBankHandler; -///global bool, must be set to true if we want to display database modification. See displayDBModifs in commands.cpp -extern bool VerboseDatabase; - - - - /** * Interface to manage a database node, can contain a unique property or a set of property * \author Stephane Coutelas @@ -330,6 +324,9 @@ public : /// release string mapper static void releaseStringMapper(); + static bool isDatabaseVerbose(){ return verboseDatabase; } + static void setVerboseDatabase( bool b ){ verboseDatabase = b; } + protected: /// Constructor @@ -359,6 +356,8 @@ protected: static CStringMapper *_DBSM; + static bool verboseDatabase; + }; diff --git a/code/nel/src/misc/cdb.cpp b/code/nel/src/misc/cdb.cpp index 8d4c6527f..1f39aae05 100644 --- a/code/nel/src/misc/cdb.cpp +++ b/code/nel/src/misc/cdb.cpp @@ -31,6 +31,7 @@ using namespace std; namespace NLMISC{ CStringMapper *ICDBNode::_DBSM = NULL; +bool ICDBNode::verboseDatabase = false; std::string ICDBNode::getFullName() diff --git a/code/nel/src/misc/cdb_branch.cpp b/code/nel/src/misc/cdb_branch.cpp index 6d8301049..143699eb5 100644 --- a/code/nel/src/misc/cdb_branch.cpp +++ b/code/nel/src/misc/cdb_branch.cpp @@ -401,7 +401,7 @@ void CCDBNodeBranch::readAndMapDelta( TGameCycle gc, CBitMemStream& s, uint bank } // Display the Name if we are in verbose mode - if ( VerboseDatabase ) + if ( verboseDatabase ) { string displayStr = string("Reading: ") + *(_Nodes[idx]->getName()); //CInterfaceManager::getInstance()->getChatOutput()->addTextChild( ucstring( displayStr ),CRGBA(255,255,255,255)); @@ -423,13 +423,13 @@ void CCDBNodeBranch::readDelta( TGameCycle gc, CBitMemStream & f ) { // Read the atom bitfield uint nbAtomElements = countLeaves(); - if(VerboseDatabase) + if(verboseDatabase) nlinfo( "CDB/ATOM: %u leaves", nbAtomElements ); CBitSet bitfield( nbAtomElements ); f.readBits( bitfield ); if ( ! bitfield.getVector().empty() ) { - if(VerboseDatabase) + if(verboseDatabase) { nldebug( "CDB/ATOM: Bitfield: %s LastBits:", bitfield.toString().c_str() ); f.displayLastBits( bitfield.size() ); @@ -442,7 +442,7 @@ void CCDBNodeBranch::readDelta( TGameCycle gc, CBitMemStream & f ) { if ( bitfield[i] ) { - if(VerboseDatabase) + if(verboseDatabase) { nldebug( "CDB/ATOM: Reading prop[%u] of atom", i ); } @@ -468,7 +468,7 @@ void CCDBNodeBranch::readDelta( TGameCycle gc, CBitMemStream & f ) } // Display the Name if we are in verbose mode - if ( VerboseDatabase ) + if ( verboseDatabase ) { string displayStr = string("Reading: ") + *(_Nodes[idx]->getName()); //CInterfaceManager::getInstance()->getChatOutput()->addTextChild( ucstring( displayStr ),CRGBA(255,255,255,255)); diff --git a/code/nel/src/misc/cdb_leaf.cpp b/code/nel/src/misc/cdb_leaf.cpp index fce66bd4a..efd49224e 100644 --- a/code/nel/src/misc/cdb_leaf.cpp +++ b/code/nel/src/misc/cdb_leaf.cpp @@ -163,7 +163,7 @@ void CCDBNodeLeaf::readDelta(TGameCycle gc, CBitMemStream & f ) _Property |= ~mask; } } - if ( VerboseDatabase ) + if ( verboseDatabase ) { nlinfo( "CDB: Read value (%u bits) %"NL_I64"d", bits, _Property ); } diff --git a/code/ryzom/client/src/cdb_synchronised.cpp b/code/ryzom/client/src/cdb_synchronised.cpp index 415024b17..eaca7a39b 100644 --- a/code/ryzom/client/src/cdb_synchronised.cpp +++ b/code/ryzom/client/src/cdb_synchronised.cpp @@ -49,8 +49,6 @@ using namespace NLMISC; using namespace std; - -bool NLMISC::VerboseDatabase = false; uint32 NbDatabaseChanges = 0; @@ -191,7 +189,7 @@ void CCDBSynchronised::readDelta( NLMISC::TGameCycle gc, CBitMemStream& s, uint uint16 propertyCount = 0; s.serial( propertyCount ); - if ( VerboseDatabase ) + if ( NLMISC::ICDBNode::isDatabaseVerbose() ) nlinfo( "CDB: Reading delta (%hu changes)", propertyCount ); NbDatabaseChanges += propertyCount; diff --git a/code/ryzom/client/src/commands.cpp b/code/ryzom/client/src/commands.cpp index bf2de0603..9af8275ab 100644 --- a/code/ryzom/client/src/commands.cpp +++ b/code/ryzom/client/src/commands.cpp @@ -985,8 +985,10 @@ NLMISC_COMMAND(verboseDatabase, "Enable/Disable the log for the database", "") if(args.size() != 0) return false; - VerboseDatabase = !VerboseDatabase; - if(VerboseDatabase) + bool v = NLMISC::ICDBNode::isDatabaseVerbose(); + NLMISC::ICDBNode::setVerboseDatabase( !v ); + + if( !v ) nlinfo("Enable VerboseDatabase"); else nlinfo("Disable VerboseDatabase");