summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorM. Kristall <mkpdev@gmail.com>2009-10-03 12:09:04 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:15:42 +0000
commit18e91721c4bda2513d6a6e890f3538ee97770123 (patch)
tree42498a7b2440dd007ae3d35b611915adce8ebf31 /src/game
parent32b40f909ad57f01456cf1dbde5d8653ab329634 (diff)
* Handle some broken admin.dat files the same as before
* Make G_TeamName BG_TeamName and use it in cgame for team change messages * Don't use an event for team change notification since clients already know
Diffstat (limited to 'src/game')
-rw-r--r--src/game/bg_misc.c18
-rw-r--r--src/game/bg_public.h4
-rw-r--r--src/game/g_admin.c15
-rw-r--r--src/game/g_cmds.c10
-rw-r--r--src/game/g_local.h1
-rw-r--r--src/game/g_team.c40
6 files changed, 46 insertions, 42 deletions
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c
index 450844d5..cac8f17b 100644
--- a/src/game/bg_misc.c
+++ b/src/game/bg_misc.c
@@ -2784,8 +2784,6 @@ char *eventnames[ ] =
"EV_DEATH3",
"EV_OBITUARY",
- "EV_TEAMJOIN", // teamjoin message
-
"EV_GIB_PLAYER", // gib a previously living player
"EV_BUILD_CONSTRUCT",
@@ -3914,3 +3912,19 @@ int BG_LoadEmoticons( char names[ ][ MAX_EMOTICON_NAME_LEN ], int widths[ ] )
return loaded;
}
+/*
+============
+BG_TeamName
+============
+*/
+char *BG_TeamName( team_t team )
+{
+ if( team == TEAM_NONE )
+ return "spectator";
+ if( team == TEAM_ALIENS )
+ return "alien";
+ if( team == TEAM_HUMANS )
+ return "human";
+ return "<team>";
+}
+
diff --git a/src/game/bg_public.h b/src/game/bg_public.h
index b8938c63..707b6256 100644
--- a/src/game/bg_public.h
+++ b/src/game/bg_public.h
@@ -509,8 +509,6 @@ typedef enum
EV_DEATH3,
EV_OBITUARY,
- EV_TEAMJOIN, // teamjoin message
-
EV_GIB_PLAYER, // gib a previously living player
EV_BUILD_CONSTRUCT,
@@ -1300,3 +1298,5 @@ voiceTrack_t *BG_VoiceTrackFind( voiceTrack_t *head, team_t team,
int enthusiasm, int *trackNum );
int BG_LoadEmoticons( char names[ ][ MAX_EMOTICON_NAME_LEN ], int widths[ ] );
+
+char *BG_TeamName( team_t team );
diff --git a/src/game/g_admin.c b/src/game/g_admin.c
index ca201d8d..5ac2461a 100644
--- a/src/game/g_admin.c
+++ b/src/game/g_admin.c
@@ -484,12 +484,13 @@ static void admin_readconfig_string( char **cnf, char *s, int size )
char *t;
//COM_MatchToken(cnf, "=");
+ s[ 0 ] = '\0';
t = COM_ParseExt( cnf, qfalse );
if( strcmp( t, "=" ) )
{
COM_ParseWarning( "expected '=' before \"%s\"", t );
+ Q_strncpyz( s, t, size );
}
- s[ 0 ] = '\0';
while( 1 )
{
t = COM_ParseExt( cnf, qfalse );
@@ -497,12 +498,10 @@ static void admin_readconfig_string( char **cnf, char *s, int size )
break;
if( strlen( t ) + strlen( s ) >= size )
break;
+ if( *s )
+ Q_strcat( s, size, " " );
Q_strcat( s, size, t );
- Q_strcat( s, size, " " );
}
- // trim the trailing space
- if( strlen( s ) > 0 && s[ strlen( s ) - 1 ] == ' ' )
- s[ strlen( s ) - 1 ] = '\0';
}
static void admin_readconfig_int( char **cnf, int *v )
@@ -1958,7 +1957,7 @@ qboolean G_admin_putteam( gentity_t *ent, int skiparg )
AP( va( "print \"^3!putteam: ^7%s^7 put %s^7 on to the %s team\n\"",
( ent ) ? ent->client->pers.netname : "console",
- vic->client->pers.netname, G_TeamName( teamnum ) ) );
+ vic->client->pers.netname, BG_TeamName( teamnum ) ) );
return qtrue;
}
@@ -2932,7 +2931,7 @@ qboolean G_admin_lock( gentity_t *ent, int skiparg )
}
AP( va( "print \"^3!lock: ^7the %s team has been locked by %s\n\"",
- G_TeamName( team ),
+ BG_TeamName( team ),
( ent ) ? ent->client->pers.netname : "console" ) );
return qtrue;
}
@@ -2976,7 +2975,7 @@ qboolean G_admin_unlock( gentity_t *ent, int skiparg )
}
AP( va( "print \"^3!unlock: ^7the %s team has been unlocked by %s\n\"",
- G_TeamName( team ),
+ BG_TeamName( team ),
( ent ) ? ent->client->pers.netname : "console" ) );
return qtrue;
}
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index 49fc49f7..db8a37b9 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -543,7 +543,6 @@ void Cmd_Team_f( gentity_t *ent )
qboolean force = G_admin_permission(ent, ADMF_FORCETEAMCHANGE);
int aliens = level.numAlienClients;
int humans = level.numHumanClients;
- gentity_t *tempent;
// stop team join spam
if( level.time - ent->client->pers.teamChangeTime < 1000 )
@@ -645,13 +644,6 @@ void Cmd_Team_f( gentity_t *ent )
// Apply the change
G_ChangeTeam( ent, team );
-
- // Send the team join message event to everyone
- tempent = G_TempEntity( ent->r.currentOrigin, EV_TEAMJOIN );
- tempent->s.eventParm = ent->s.number;
- tempent->s.otherEntityNum = team;
- tempent->s.otherEntityNum2 = oldteam;
- tempent->r.svFlags = SVF_BROADCAST;
}
@@ -711,7 +703,7 @@ void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chatText )
if( g_chatTeamPrefix.integer )
{
- prefix = G_TeamName( ent->client->pers.teamSelection );
+ prefix = BG_TeamName( ent->client->pers.teamSelection );
prefix = va( "[%c] ", toupper( *prefix ) );
}
else
diff --git a/src/game/g_local.h b/src/game/g_local.h
index 648774c1..48e17ac4 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -960,7 +960,6 @@ void G_RunClient( gentity_t *ent );
// g_team.c
//
team_t G_TeamFromString( char *str );
-char *G_TeamName( team_t team );
qboolean OnSameTeam( gentity_t *ent1, gentity_t *ent2 );
void G_LeaveTeam( gentity_t *self );
void G_ChangeTeam( gentity_t *ent, team_t newTeam );
diff --git a/src/game/g_team.c b/src/game/g_team.c
index e57da1bd..c3c490e5 100644
--- a/src/game/g_team.c
+++ b/src/game/g_team.c
@@ -63,26 +63,6 @@ team_t G_TeamFromString( char *str )
}
/*
-================
-G_TeamName
-================
-*/
-char *G_TeamName( team_t team )
-{
- switch( team )
- {
- case TEAM_NONE:
- return "spectator";
- case TEAM_ALIENS:
- return "alien";
- case TEAM_HUMANS:
- return "human";
- default:
- return "unknown";
- }
-}
-
-/*
==============
OnSameTeam
==============
@@ -194,6 +174,26 @@ void G_ChangeTeam( gentity_t *ent, team_t newTeam )
}
ClientUserinfoChanged( ent->client->ps.clientNum );
+
+ 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 ) );
+ }
}
/*