summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cgame/cg_consolecmds.c9
-rw-r--r--src/game/bg_alloc.c37
-rw-r--r--src/game/bg_public.h1
-rw-r--r--src/game/g_svcmds.c1
4 files changed, 45 insertions, 3 deletions
diff --git a/src/cgame/cg_consolecmds.c b/src/cgame/cg_consolecmds.c
index da583214..030660a6 100644
--- a/src/cgame/cg_consolecmds.c
+++ b/src/cgame/cg_consolecmds.c
@@ -158,17 +158,19 @@ void CG_ClientList_f( void )
switch( ci->team )
{
case TEAM_ALIENS:
- Com_Printf( "%2d ^1A ^7%s^7\n", i, ci->name );
+ Com_Printf( "%2d " S_COLOR_RED "A " S_COLOR_WHITE "%s\n", i,
+ ci->name );
break;
case TEAM_HUMANS:
- Com_Printf( "%2d ^4H ^7%s^7\n", i, ci->name );
+ Com_Printf( "%2d " S_COLOR_CYAN "H " S_COLOR_WHITE "%s\n", i,
+ ci->name );
break;
default:
case TEAM_NONE:
case NUM_TEAMS:
- Com_Printf( "%2d ^3S ^7%s^7\n", i, ci->name );
+ Com_Printf( "%2d S %s\n", i, ci->name );
break;
}
@@ -187,6 +189,7 @@ static consoleCommand_t commands[ ] =
{
{ "+scores", CG_ScoresDown_f },
{ "-scores", CG_ScoresUp_f },
+ { "cgame_memory", BG_MemoryInfo },
{ "clientlist", CG_ClientList_f },
{ "destroyTestPS", CG_DestroyTestPS_f },
{ "destroyTestTS", CG_DestroyTestTS_f },
diff --git a/src/game/bg_alloc.c b/src/game/bg_alloc.c
index 080bf83a..d8849d16 100644
--- a/src/game/bg_alloc.c
+++ b/src/game/bg_alloc.c
@@ -202,3 +202,40 @@ void BG_DefragmentMemory( void )
startfmn = startfmn->next; // endfmn acts as a 'restart' flag here
}
}
+
+void BG_MemoryInfo( void )
+{
+ // Give a breakdown of memory
+
+ freeMemNode_t *fmn = (freeMemNode_t *)memoryPool;
+ int size, chunks;
+ freeMemNode_t *end = (freeMemNode_t *)( memoryPool + POOLSIZE );
+ void *p;
+
+ Com_Printf( "%p-%p: %d out of %d bytes allocated\n",
+ fmn, end, POOLSIZE - freeMem, POOLSIZE );
+
+ while( fmn < end )
+ {
+ size = chunks = 0;
+ p = fmn;
+ while( fmn < end && fmn->cookie == FREEMEMCOOKIE )
+ {
+ size += fmn->size;
+ chunks++;
+ fmn = (freeMemNode_t *)( (char *)fmn + fmn->size );
+ }
+ if( size )
+ Com_Printf( " %p: %d bytes free (%d chunks)\n", p, size, chunks );
+ size = chunks = 0;
+ p = fmn;
+ while( fmn < end && fmn->cookie != FREEMEMCOOKIE )
+ {
+ size += *(int *)fmn;
+ chunks++;
+ fmn = (freeMemNode_t *)( (size_t)fmn + *(int *)fmn );
+ }
+ if( size )
+ Com_Printf( " %p: %d bytes allocated (%d chunks)\n", p, size, chunks );
+ }
+}
diff --git a/src/game/bg_public.h b/src/game/bg_public.h
index e952624a..fa6d24b7 100644
--- a/src/game/bg_public.h
+++ b/src/game/bg_public.h
@@ -1212,6 +1212,7 @@ void *BG_Alloc( int size );
void BG_InitMemory( void );
void BG_Free( void *ptr );
void BG_DefragmentMemory( void );
+void BG_MemoryInfo( void );
void BG_EvaluateTrajectory( const trajectory_t *tr, int atTime, vec3_t result );
void BG_EvaluateTrajectoryDelta( const trajectory_t *tr, int atTime, vec3_t result );
diff --git a/src/game/g_svcmds.c b/src/game/g_svcmds.c
index f75236ed..20f95bbd 100644
--- a/src/game/g_svcmds.c
+++ b/src/game/g_svcmds.c
@@ -530,6 +530,7 @@ struct svcmd
{ "entityList", qfalse, Svcmd_EntityList_f },
{ "evacuation", qfalse, Svcmd_Evacuation_f },
{ "forceTeam", qfalse, Svcmd_ForceTeam_f },
+ { "game_memory", qfalse, BG_MemoryInfo },
{ "humanWin", qfalse, Svcmd_TeamWin_f },
{ "layoutLoad", qfalse, Svcmd_LayoutLoad_f },
{ "layoutSave", qfalse, Svcmd_LayoutSave_f },