diff options
author | M. Kristall <mkpdev@gmail.com> | 2009-10-28 15:03:04 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:17:09 +0000 |
commit | e3cfb28d459a57050a764e8048626497f4553b4d (patch) | |
tree | 3c478181b962e54c71adb9070ecd7804364809ea /src | |
parent | b7c3532092b803945e539ef71a976bbaae793500 (diff) |
* Stop using numeric constants in logs because they are unreliable (log parsers
will need to be updated)
Diffstat (limited to 'src')
-rw-r--r-- | src/game/bg_public.h | 1 | ||||
-rw-r--r-- | src/game/g_admin.c | 2 | ||||
-rw-r--r-- | src/game/g_buildable.c | 63 | ||||
-rw-r--r-- | src/game/g_combat.c | 49 | ||||
-rw-r--r-- | src/game/g_team.c | 22 |
5 files changed, 66 insertions, 71 deletions
diff --git a/src/game/bg_public.h b/src/game/bg_public.h index 0e687ea4..4440a901 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -905,7 +905,6 @@ typedef enum MOD_ATUBE, MOD_OVERMIND, MOD_DECONSTRUCT, - MOD_REPLACE, MOD_NOCREEP } meansOfDeath_t; diff --git a/src/game/g_admin.c b/src/game/g_admin.c index 96531621..1e613e44 100644 --- a/src/game/g_admin.c +++ b/src/game/g_admin.c @@ -606,7 +606,7 @@ void G_admin_authlog( gentity_t *ent ) ent->client->pers.admin->flags, ( level ) ? level->flags : "" ); - G_LogPrintf( "AdminAuth: %i \"%s" S_COLOR_WHITE "\": \"%s" S_COLOR_WHITE + G_LogPrintf( "AdminAuth: %i \"%s" S_COLOR_WHITE "\" \"%s" S_COLOR_WHITE "\" [%d] (%s): %s\n", ent - g_entities, ent->client->pers.netname, ent->client->pers.admin->name, ent->client->pers.admin->level, diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index 8063bca4..1a1b6197 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -3115,17 +3115,20 @@ G_FreeMarkedBuildables Free up build points for a team by deconstructing marked buildables =============== */ -void G_FreeMarkedBuildables( gentity_t *deconner, char *buffer, int size ) +void G_FreeMarkedBuildables( gentity_t *deconner, char *readable, int rsize, + char *nums, int nsize ) { int i; - int bNum; - int listItems = 0; - int totalListItems = 0; + int bNum; + int listItems = 0; + int totalListItems = 0; gentity_t *ent; - int removalCounts[ BA_NUM_BUILDABLES ] = {0}; + int removalCounts[ BA_NUM_BUILDABLES ] = {0}; - if( buffer ) - buffer[0] = '\0'; + if( readable && rsize ) + readable[ 0 ] = '\0'; + if( nums && nsize ) + nums[ 0 ] = '\0'; if( !g_markDeconstruct.integer ) return; // Not enabled, can't deconstruct anything @@ -3136,28 +3139,36 @@ void G_FreeMarkedBuildables( gentity_t *deconner, char *buffer, int size ) bNum = BG_Buildable( ent->s.modelindex )->number; if( removalCounts[ bNum ] == 0 ) - totalListItems++; + totalListItems++; + + G_Damage( ent, NULL, NULL, NULL, NULL, ent->health, 0, MOD_DECONSTRUCT ); removalCounts[ bNum ]++; - G_Damage( ent, NULL, deconner, NULL, NULL, ent->health, 0, MOD_REPLACE ); + if( nums ) + Q_strcat( nums, nsize, va( " %d", ent - g_entities ) ); + G_FreeEntity( ent ); } + if( !readable ) + return; + for( i = 0; i < BA_NUM_BUILDABLES; i++ ) { - if( buffer && removalCounts[ i ] ) + if( removalCounts[ i ] ) { if( listItems ) { if( listItems == ( totalListItems - 1 ) ) - Q_strcat( buffer, size, va( "%s and ", ( totalListItems > 2 ) ? "," : "" ) ); + Q_strcat( readable, rsize, va( "%s and ", + ( totalListItems > 2 ) ? "," : "" ) ); else - Q_strcat( buffer, size, ", " ); + Q_strcat( readable, rsize, ", " ); } - Q_strcat( buffer, size, va( "%s", BG_Buildable( i )->humanName ) ); + Q_strcat( readable, rsize, va( "%s", BG_Buildable( i )->humanName ) ); if( removalCounts[ i ] > 1 ) - Q_strcat( buffer, size, va( " x%d", removalCounts[ i ] ) ); + Q_strcat( readable, rsize, va( " (%dx)", removalCounts[ i ] ) ); listItems++; } } @@ -3601,10 +3612,12 @@ static gentity_t *G_Build( gentity_t *builder, buildable_t buildable, vec3_t ori { gentity_t *built; vec3_t normal; - char removed[ MAX_STRING_CHARS ]; + char readable[ MAX_STRING_CHARS ]; + char buildnums[ MAX_STRING_CHARS ]; // Free existing buildables - G_FreeMarkedBuildables( builder, removed, sizeof( removed ) ); + G_FreeMarkedBuildables( builder, readable, sizeof( readable ), + buildnums, sizeof( buildnums ) ); // Spawn the buildable built = G_Spawn(); @@ -3825,14 +3838,18 @@ static gentity_t *G_Build( gentity_t *builder, buildable_t buildable, vec3_t ori va( "print \"%s ^2built^7 by %s%s%s\n\"", BG_Buildable( built->s.modelindex )->humanName, builder->client->pers.netname, - ( removed[0] ) ? "^7, ^3replacing^7 " : "", - removed ) ); - G_LogPrintf( "Build: %d %d %d: %s^7 is ^2building^7 %s\n", - builder->client->ps.clientNum, - built->s.modelindex, - level.numBuildablesForRemoval, + ( readable[ 0 ] ) ? "^7, ^3replacing^7 " : "", + readable ) ); + G_LogPrintf( "Construct: %d %d %s%s: %s" S_COLOR_WHITE " is building " + "%s%s%s\n", + builder - g_entities, + built - g_entities, + BG_Buildable( built->s.modelindex )->name, + buildnums, builder->client->pers.netname, - BG_Buildable( built->s.modelindex )->name ); + BG_Buildable( built->s.modelindex )->humanName, + readable[ 0 ] ? ", replacing " : "", + readable ); } return built; diff --git a/src/game/g_combat.c b/src/game/g_combat.c index e603e719..b1007e4c 100644 --- a/src/game/g_combat.c +++ b/src/game/g_combat.c @@ -123,7 +123,6 @@ char *modNames[ ] = "MOD_ATUBE", "MOD_OVERMIND", "MOD_DECONSTRUCT", - "MOD_REPLACE", "MOD_NOCREEP" }; @@ -249,13 +248,17 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int } if( meansOfDeath < 0 || meansOfDeath >= sizeof( modNames ) / sizeof( modNames[0] ) ) - obit = "<bad obituary>"; + // fall back on the number + obit = va( "%d", meansOfDeath ); else obit = modNames[ meansOfDeath ]; - G_LogPrintf("Kill: %i %i %i: %s^7 killed %s^7 by %s\n", - killer, self->s.number, meansOfDeath, killerName, - self->client->pers.netname, obit ); + G_LogPrintf( "Die: %d %d %s: %s" S_COLOR_WHITE " killed %s\n", + killer, + self - g_entities, + obit, + killerName, + self->client->pers.netname ); // deactivate all upgrades for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ ) @@ -1023,13 +1026,13 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, } if( targ->s.eType == ET_BUILDABLE && attacker->client && - mod != MOD_DECONSTRUCT && mod != MOD_REPLACE ) + mod != MOD_DECONSTRUCT ) { - if( targ->buildableTeam == attacker->client->pers.teamSelection ) + if( targ->buildableTeam == attacker->client->pers.teamSelection && + !g_friendlyBuildableFire.integer && mod != MOD_DECONSTRUCT && + mod != MOD_SUICIDE ) { - if( !g_friendlyBuildableFire.integer && mod != MOD_DECONSTRUCT - && mod != MOD_SUICIDE ) - return; + return; } // base is under attack warning if DCC'd @@ -1363,8 +1366,7 @@ void G_LogDestruction( gentity_t *self, gentity_t *actor, int mod ) if( !actor || !actor->client ) return; - if( mod != MOD_REPLACE && - actor->client->ps.stats[ STAT_TEAM ] == + if( actor->client->pers.teamSelection == BG_Buildable( self->s.modelindex )->team ) { G_TeamCommand( actor->client->ps.stats[ STAT_TEAM ], @@ -1374,19 +1376,12 @@ void G_LogDestruction( gentity_t *self, gentity_t *actor, int mod ) actor->client->pers.netname ) ); } - if( mod == MOD_DECONSTRUCT || mod == MOD_REPLACE ) - G_LogPrintf( "Decon: %d %d %d: %s ^3deconstructed^7 %s\n", - actor->client->ps.clientNum, - self->s.modelindex, - mod, - actor->client->pers.netname, - BG_Buildable( self->s.modelindex )->name ); - else - G_LogPrintf( "Decon: %d %d %d: %s ^3destroyed^7 %s by %s\n", - actor->client->ps.clientNum, - self->s.modelindex, - mod, - actor->client->pers.netname, - BG_Buildable( self->s.modelindex )->name, - modNames[ mod ] ); + G_LogPrintf( S_COLOR_YELLOW "Deconstruct: %d %d %s %s: %s %s by %s\n", + actor - g_entities, + self - g_entities, + BG_Buildable( self->s.modelindex )->name, + modNames[ mod ], + BG_Buildable( self->s.modelindex )->humanName, + mod == MOD_DECONSTRUCT ? "deconstructed" : "destroyed", + actor->client->pers.netname ); } diff --git a/src/game/g_team.c b/src/game/g_team.c index 0c198611..d2a55e09 100644 --- a/src/game/g_team.c +++ b/src/game/g_team.c @@ -221,25 +221,9 @@ void G_ChangeTeam( gentity_t *ent, team_t newTeam ) G_UpdateTeamConfigStrings( ); - if( oldTeam != TEAM_NONE && newTeam != TEAM_NONE ) - { - G_LogPrintf( - "team: %i %i %i: %s" S_COLOR_WHITE " left the %ss and joined the %ss\n", - ent->s.number, newTeam, oldTeam, ent->client->pers.netname, - BG_TeamName( oldTeam ), BG_TeamName( newTeam ) ); - } - else if( newTeam == TEAM_NONE ) - { - G_LogPrintf( "team: %i %i %i: %s" S_COLOR_WHITE " left the %ss\n", - ent->s.number, newTeam, oldTeam, ent->client->pers.netname, - BG_TeamName( oldTeam ) ); - } - else - { - G_LogPrintf( "team: %i %i %i: %s" S_COLOR_WHITE " joined the %ss\n", - ent->s.number, newTeam, oldTeam, ent->client->pers.netname, - BG_TeamName( newTeam ) ); - } + G_LogPrintf( "ChangeTeam: %d %s: %s" S_COLOR_WHITE " switched teams\n", + ent - g_entities, BG_TeamName( newTeam ), ent->client->pers.netname ); + TeamplayInfoMessage( ent ); } |