Added convenience functions to check for log messages of various

types.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@8477 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2011-04-28 04:25:58 +00:00
parent 92b0d334de
commit afad571929
2 changed files with 19 additions and 8 deletions

View File

@ -284,11 +284,6 @@ enum AnimType {ANIMS_NONE = 0,
*/
namespace UserConfigParams
{
/** Some constants to bitmask to enable various messages to be printed. */
enum { LOG_MEMORY = 0x0001,
LOG_GUI = 0x0002,
LOG_ADDONS = 0x0004,
LOG_MISC = 0x0008};
// ---- Audio
PARAM_PREFIX GroupUserConfigParam m_audio_group
@ -497,6 +492,22 @@ namespace UserConfigParams
PARAM_PREFIX PtrVector<PlayerProfile> m_all_players;
/** Some constants to bitmask to enable various messages to be printed. */
enum { LOG_MEMORY = 0x0001,
LOG_GUI = 0x0002,
LOG_ADDONS = 0x0004,
LOG_MISC = 0x0008};
/** Returns true if the user want additional messages for memory usage. */
static bool logMemory() { return (m_verbosity&LOG_MEMORY) == LOG_MEMORY;}
/** Returns true if the user want additional messages related to GUI. */
static bool logGUI () { return (m_verbosity&LOG_GUI) == LOG_GUI; }
/** Returns true if the user want additional messages related to addons. */
static bool logAddons() { return (m_verbosity&LOG_ADDONS) == LOG_ADDONS;}
/** Returns true if the user want additional messages for general items. */
static bool logMisc () { return (m_verbosity&LOG_MISC) == LOG_MISC; }
}
#undef PARAM_PREFIX
#undef PARAM_SUFFIX

View File

@ -177,7 +177,7 @@ void Track::cleanup()
// remove temporary materials loaded by the material manager
material_manager->popTempMaterial();
if(UserConfigParams::m_verbosity&UserConfigParams::LOG_MEMORY)
if(UserConfigParams::logMemory())
{
printf("[memory] Number of meshes in cache after cleaning up '%s': %d.\n",
getIdent().c_str(),
@ -962,7 +962,7 @@ void Track::createWater(const XMLNode &node)
void Track::loadTrackModel(World* parent, unsigned int mode_id)
{
assert(m_all_cached_meshes.size()==0);
if(UserConfigParams::m_verbosity&UserConfigParams::LOG_MEMORY)
if(UserConfigParams::logMemory())
{
printf("[memory] Number of meshes in cache before loading '%s': %d.\n",
getIdent().c_str(),
@ -1287,7 +1287,7 @@ void Track::loadTrackModel(World* parent, unsigned int mode_id)
printf("Lap counting will not work, and start positions might be incorrect.\n");
}
if(UserConfigParams::m_verbosity&UserConfigParams::LOG_MEMORY)
if(UserConfigParams::logMemory())
printf("[memory] Number of meshes in cache after loading '%s': %d.\n",
getIdent().c_str(),
irr_driver->getSceneManager()->getMeshCache()->getMeshCount());