diff options
Diffstat (limited to 'common')
| -rw-r--r-- | common/bitstream.h | 9 | ||||
| -rw-r--r-- | common/debug-channels.h | 11 | ||||
| -rw-r--r-- | common/debug.cpp | 16 | 
3 files changed, 33 insertions, 3 deletions
diff --git a/common/bitstream.h b/common/bitstream.h index 0fe16b5beb..b789f2ac8d 100644 --- a/common/bitstream.h +++ b/common/bitstream.h @@ -52,6 +52,9 @@ public:  	/** Skip the specified amount of bits. */  	virtual void skip(uint32 n) = 0; +	/** Skip the bits to closest data value border. */ +	virtual void align() = 0; +  	/** Read a bit from the bit stream. */  	virtual uint32 getBit() = 0; @@ -276,6 +279,12 @@ public:  			getBit();  	} +	/** Skip the bits to closest data value border. */ +	void align() { +		while (_inValue) +			getBit(); +	} +  	/** Return the stream position in bits. */  	uint32 pos() const {  		if (_stream->pos() == 0) diff --git a/common/debug-channels.h b/common/debug-channels.h index 83f416a3b8..1414a1053a 100644 --- a/common/debug-channels.h +++ b/common/debug-channels.h @@ -95,8 +95,6 @@ public:  	 */  	bool disableDebugChannel(const String &name); - -  	typedef List<DebugChannel> DebugChannelList;  	/** @@ -106,6 +104,15 @@ public:  	 */  	DebugChannelList listDebugChannels(); +	/** +	 * Enable all debug channels. +	 */ +	void enableAllDebugChannels(); + +	/** +	 * Disable all debug channels. +	 */ +	void disableAllDebugChannels();  	/**  	 * Test whether the given debug channel is enabled. diff --git a/common/debug.cpp b/common/debug.cpp index 58cc0287a8..182b28afdf 100644 --- a/common/debug.cpp +++ b/common/debug.cpp @@ -46,6 +46,11 @@ struct DebugLevelComperator {  } // end of anonymous namespace  bool DebugManager::addDebugChannel(uint32 channel, const String &name, const String &description) { +	if (name.equalsIgnoreCase("all")) { +		warning("Debug channel 'all' is reserved for internal use"); +		return false; +	} +  	if (gDebugChannels.contains(name))  		warning("Duplicate declaration of engine debug channel '%s'", name.c_str()); @@ -85,7 +90,6 @@ bool DebugManager::disableDebugChannel(const String &name) {  	}  } -  DebugManager::DebugChannelList DebugManager::listDebugChannels() {  	DebugChannelList tmp;  	for (DebugChannelMap::iterator i = gDebugChannels.begin(); i != gDebugChannels.end(); ++i) @@ -95,6 +99,16 @@ DebugManager::DebugChannelList DebugManager::listDebugChannels() {  	return tmp;  } +void DebugManager::enableAllDebugChannels() { +	for (DebugChannelMap::iterator i = gDebugChannels.begin(); i != gDebugChannels.end(); ++i) +		enableDebugChannel(i->_value.name); +} + +void DebugManager::disableAllDebugChannels() { +	for (DebugChannelMap::iterator i = gDebugChannels.begin(); i != gDebugChannels.end(); ++i) +		disableDebugChannel(i->_value.name); +} +  bool DebugManager::isDebugChannelEnabled(uint32 channel) {  	// Debug level 11 turns on all special debug level messages  	if (gDebugLevel == 11)  | 
