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
This commit is contained in:
dfighter1985 2012-07-14 01:46:22 +02:00
parent e2abe1e33e
commit b8030b966a
6 changed files with 17 additions and 17 deletions

View file

@ -35,12 +35,6 @@ class CCDBNodeLeaf;
class CCDBNodeBranch; class CCDBNodeBranch;
class CCDBBankHandler; 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 * Interface to manage a database node, can contain a unique property or a set of property
* \author Stephane Coutelas * \author Stephane Coutelas
@ -330,6 +324,9 @@ public :
/// release string mapper /// release string mapper
static void releaseStringMapper(); static void releaseStringMapper();
static bool isDatabaseVerbose(){ return verboseDatabase; }
static void setVerboseDatabase( bool b ){ verboseDatabase = b; }
protected: protected:
/// Constructor /// Constructor
@ -359,6 +356,8 @@ protected:
static CStringMapper *_DBSM; static CStringMapper *_DBSM;
static bool verboseDatabase;
}; };

View file

@ -31,6 +31,7 @@ using namespace std;
namespace NLMISC{ namespace NLMISC{
CStringMapper *ICDBNode::_DBSM = NULL; CStringMapper *ICDBNode::_DBSM = NULL;
bool ICDBNode::verboseDatabase = false;
std::string ICDBNode::getFullName() std::string ICDBNode::getFullName()

View file

@ -401,7 +401,7 @@ void CCDBNodeBranch::readAndMapDelta( TGameCycle gc, CBitMemStream& s, uint bank
} }
// Display the Name if we are in verbose mode // Display the Name if we are in verbose mode
if ( VerboseDatabase ) if ( verboseDatabase )
{ {
string displayStr = string("Reading: ") + *(_Nodes[idx]->getName()); string displayStr = string("Reading: ") + *(_Nodes[idx]->getName());
//CInterfaceManager::getInstance()->getChatOutput()->addTextChild( ucstring( displayStr ),CRGBA(255,255,255,255)); //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 // Read the atom bitfield
uint nbAtomElements = countLeaves(); uint nbAtomElements = countLeaves();
if(VerboseDatabase) if(verboseDatabase)
nlinfo( "CDB/ATOM: %u leaves", nbAtomElements ); nlinfo( "CDB/ATOM: %u leaves", nbAtomElements );
CBitSet bitfield( nbAtomElements ); CBitSet bitfield( nbAtomElements );
f.readBits( bitfield ); f.readBits( bitfield );
if ( ! bitfield.getVector().empty() ) if ( ! bitfield.getVector().empty() )
{ {
if(VerboseDatabase) if(verboseDatabase)
{ {
nldebug( "CDB/ATOM: Bitfield: %s LastBits:", bitfield.toString().c_str() ); nldebug( "CDB/ATOM: Bitfield: %s LastBits:", bitfield.toString().c_str() );
f.displayLastBits( bitfield.size() ); f.displayLastBits( bitfield.size() );
@ -442,7 +442,7 @@ void CCDBNodeBranch::readDelta( TGameCycle gc, CBitMemStream & f )
{ {
if ( bitfield[i] ) if ( bitfield[i] )
{ {
if(VerboseDatabase) if(verboseDatabase)
{ {
nldebug( "CDB/ATOM: Reading prop[%u] of atom", i ); 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 // Display the Name if we are in verbose mode
if ( VerboseDatabase ) if ( verboseDatabase )
{ {
string displayStr = string("Reading: ") + *(_Nodes[idx]->getName()); string displayStr = string("Reading: ") + *(_Nodes[idx]->getName());
//CInterfaceManager::getInstance()->getChatOutput()->addTextChild( ucstring( displayStr ),CRGBA(255,255,255,255)); //CInterfaceManager::getInstance()->getChatOutput()->addTextChild( ucstring( displayStr ),CRGBA(255,255,255,255));

View file

@ -163,7 +163,7 @@ void CCDBNodeLeaf::readDelta(TGameCycle gc, CBitMemStream & f )
_Property |= ~mask; _Property |= ~mask;
} }
} }
if ( VerboseDatabase ) if ( verboseDatabase )
{ {
nlinfo( "CDB: Read value (%u bits) %"NL_I64"d", bits, _Property ); nlinfo( "CDB: Read value (%u bits) %"NL_I64"d", bits, _Property );
} }

View file

@ -49,8 +49,6 @@
using namespace NLMISC; using namespace NLMISC;
using namespace std; using namespace std;
bool NLMISC::VerboseDatabase = false;
uint32 NbDatabaseChanges = 0; uint32 NbDatabaseChanges = 0;
@ -191,7 +189,7 @@ void CCDBSynchronised::readDelta( NLMISC::TGameCycle gc, CBitMemStream& s, uint
uint16 propertyCount = 0; uint16 propertyCount = 0;
s.serial( propertyCount ); s.serial( propertyCount );
if ( VerboseDatabase ) if ( NLMISC::ICDBNode::isDatabaseVerbose() )
nlinfo( "CDB: Reading delta (%hu changes)", propertyCount ); nlinfo( "CDB: Reading delta (%hu changes)", propertyCount );
NbDatabaseChanges += propertyCount; NbDatabaseChanges += propertyCount;

View file

@ -985,8 +985,10 @@ NLMISC_COMMAND(verboseDatabase, "Enable/Disable the log for the database", "")
if(args.size() != 0) if(args.size() != 0)
return false; return false;
VerboseDatabase = !VerboseDatabase; bool v = NLMISC::ICDBNode::isDatabaseVerbose();
if(VerboseDatabase) NLMISC::ICDBNode::setVerboseDatabase( !v );
if( !v )
nlinfo("Enable VerboseDatabase"); nlinfo("Enable VerboseDatabase");
else else
nlinfo("Disable VerboseDatabase"); nlinfo("Disable VerboseDatabase");