summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorChristopher Schwarz <lakitu7@gmail.com>2009-12-06 20:57:24 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:17:23 +0000
commit9040fbd03fee6f5d098abd49518a0a85ea9f65a2 (patch)
tree30e01c56fa62321990bd13d35c3816656aceeffa /src/game
parent27c26322272a10df75b28efd24e552d0a5e5cff0 (diff)
* Fix votes failing when they shouldn't (Rezyn)
* Fix INACTIVITY flag (Rezyn) * Fix being able to call a teamvote for someone not on your team (thanks Rezyn) * Fix IMMUNITY flag (Rezyn) * Fix there being 2 instances of g_dretchpunt in the cvar table (Rezyn)
Diffstat (limited to 'src/game')
-rw-r--r--src/game/g_active.c13
-rw-r--r--src/game/g_client.c3
-rw-r--r--src/game/g_cmds.c9
-rw-r--r--src/game/g_local.h2
-rw-r--r--src/game/g_main.c15
5 files changed, 25 insertions, 17 deletions
diff --git a/src/game/g_active.c b/src/game/g_active.c
index 619362ba..2c4b443a 100644
--- a/src/game/g_active.c
+++ b/src/game/g_active.c
@@ -512,8 +512,10 @@ ClientInactivityTimer
Returns qfalse if the client is dropped
=================
*/
-qboolean ClientInactivityTimer( gclient_t *client )
+qboolean ClientInactivityTimer( gentity_t *ent )
{
+ gclient_t *client = ent->client;
+
if( ! g_inactivity.integer )
{
// give everyone some time, so if the operator sets g_inactivity during
@@ -531,13 +533,16 @@ qboolean ClientInactivityTimer( gclient_t *client )
}
else if( !client->pers.localClient )
{
- if( level.time > client->inactivityTime )
+ if( level.time > client->inactivityTime &&
+ !G_admin_permission( ent, ADMF_ACTIVITY ) )
{
trap_DropClient( client - level.clients, "Dropped due to inactivity" );
return qfalse;
}
- if( level.time > client->inactivityTime - 10000 && !client->inactivityWarning )
+ if( level.time > client->inactivityTime - 10000 &&
+ !client->inactivityWarning &&
+ !G_admin_permission( ent, ADMF_ACTIVITY ) )
{
client->inactivityWarning = qtrue;
trap_SendServerCommand( client - level.clients, "cp \"Ten seconds until inactivity drop!\n\"" );
@@ -1293,7 +1298,7 @@ void ClientThink_real( gentity_t *ent )
G_UpdatePTRConnection( client );
// check for inactivity timer, but never drop the local client of a non-dedicated server
- if( !ClientInactivityTimer( client ) )
+ if( !ClientInactivityTimer( ent ) )
return;
// calculate where ent is currently seeing all the other active clients
diff --git a/src/game/g_client.c b/src/game/g_client.c
index 7e5ccc6b..1dad4acd 100644
--- a/src/game/g_client.c
+++ b/src/game/g_client.c
@@ -1224,6 +1224,8 @@ char *ClientConnect( int clientNum, qboolean firstTime )
value = Info_ValueForKey( userinfo, "ip" );
Q_strncpyz( client->pers.ip, value, sizeof( client->pers.ip ) );
+ client->pers.admin = G_admin_admin( client->pers.guid );
+
// check for admin ban
if( G_admin_ban_check( ent, reason, sizeof( reason ) ) )
{
@@ -1263,7 +1265,6 @@ char *ClientConnect( int clientNum, qboolean firstTime )
// check for local client
if( !strcmp( client->pers.ip, "localhost" ) )
client->pers.localClient = qtrue;
- client->pers.admin = G_admin_admin( client->pers.guid );
client->pers.connected = CON_CONNECTING;
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index 07f9153f..1816b8f5 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -1087,6 +1087,15 @@ void Cmd_CallVote_f( gentity_t *ent )
va( "print \"%s: admin is immune\n\"", cmd ) );
return;
}
+
+ if( team != TEAM_NONE &&
+ ( ent->client->pers.teamSelection !=
+ level.clients[ clientNum ].pers.teamSelection ) )
+ {
+ trap_SendServerCommand( ent-g_entities,
+ va( "print \"%s: player is not on your team\n\"", cmd ) );
+ return;
+ }
}
}
diff --git a/src/game/g_local.h b/src/game/g_local.h
index 1b90ea44..d2b482ff 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -1123,8 +1123,6 @@ extern vmCvar_t g_admin;
extern vmCvar_t g_adminTempBan;
extern vmCvar_t g_adminMaxBan;
-extern vmCvar_t g_dretchPunt;
-
extern vmCvar_t g_privateMessages;
extern vmCvar_t g_specChat;
extern vmCvar_t g_publicAdminMessages;
diff --git a/src/game/g_main.c b/src/game/g_main.c
index b733bce0..c956b9a5 100644
--- a/src/game/g_main.c
+++ b/src/game/g_main.c
@@ -128,8 +128,6 @@ vmCvar_t g_admin;
vmCvar_t g_adminTempBan;
vmCvar_t g_adminMaxBan;
-vmCvar_t g_dretchPunt;
-
vmCvar_t g_privateMessages;
vmCvar_t g_specChat;
vmCvar_t g_publicAdminMessages;
@@ -164,7 +162,7 @@ static cvarTable_t gameCvarTable[ ] =
{ &g_friendlyFire, "g_friendlyFire", "0", CVAR_SERVERINFO | CVAR_ARCHIVE, 0, qtrue },
{ &g_friendlyBuildableFire, "g_friendlyBuildableFire", "0", CVAR_SERVERINFO | CVAR_ARCHIVE, 0, qtrue },
- { &g_dretchPunt, "g_dretchPunt", "0", CVAR_ARCHIVE, 0, qtrue },
+ { &g_dretchPunt, "g_dretchPunt", "1", CVAR_ARCHIVE, 0, qtrue },
{ &g_teamForceBalance, "g_teamForceBalance", "0", CVAR_ARCHIVE },
@@ -251,8 +249,6 @@ static cvarTable_t gameCvarTable[ ] =
{ &g_adminTempBan, "g_adminTempBan", "2m", CVAR_ARCHIVE, 0, qfalse },
{ &g_adminMaxBan, "g_adminMaxBan", "2w", CVAR_ARCHIVE, 0, qfalse },
- { &g_dretchPunt, "g_dretchPunt", "0", CVAR_ARCHIVE, 0, qfalse },
-
{ &g_privateMessages, "g_privateMessages", "1", CVAR_ARCHIVE, 0, qfalse },
{ &g_specChat, "g_specChat", "1", CVAR_ARCHIVE, 0, qfalse },
{ &g_publicAdminMessages, "g_publicAdminMessages", "1", CVAR_ARCHIVE, 0, qfalse },
@@ -2093,7 +2089,6 @@ void G_CheckVote( team_t team )
qboolean pass = qfalse;
char *msg;
int i;
- float yesPercent;
if( level.voteExecuteTime[ team ] &&
level.voteExecuteTime[ team ] < level.time )
@@ -2104,16 +2099,16 @@ void G_CheckVote( team_t team )
if( !level.voteTime[ team ] )
return;
- yesPercent = (float)level.voteYes[ team ] / (float)level.numVotingClients[ team ];
-
if( ( level.time - level.voteTime[ team ] >= VOTE_TIME ) ||
( level.voteYes[ team ] + level.voteNo[ team ] == level.numVotingClients[ team ] ) )
{
- pass = ( yesPercent > votePassThreshold || level.voteNo[ team ] == 0 );
+ pass = ( level.voteYes[ team ] &&
+ (float)level.voteYes[ team ] / ( (float)level.voteYes[ team ] + (float)level.voteNo[ team ] ) > votePassThreshold );
}
else
{
- if( yesPercent > (float)level.numVotingClients[ team ] * votePassThreshold )
+ if( (float)level.voteYes[ team ] >
+ (float)level.numVotingClients[ team ] * votePassThreshold )
{
pass = qtrue;
}