summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIronClawTrem <louie.nutman@gmail.com>2020-02-20 22:37:51 +0000
committerIronClawTrem <louie.nutman@gmail.com>2020-02-20 22:37:51 +0000
commitdc04b10082a4c6994d8730467fc861fdde816c93 (patch)
treef38579c0bcda3b30f3894eee467162566dd745c7
parent57938b6734c9551e3e7a8d213762391d1f370368 (diff)
fix g_admin.c code for admin level checking
-rw-r--r--src/game/g_admin.c31
1 files changed, 9 insertions, 22 deletions
diff --git a/src/game/g_admin.c b/src/game/g_admin.c
index 287c664..c42bf68 100644
--- a/src/game/g_admin.c
+++ b/src/game/g_admin.c
@@ -449,6 +449,12 @@ g_admin_ban_t *g_admin_bans[ MAX_ADMIN_BANS ];
g_admin_command_t *g_admin_commands[ MAX_ADMIN_COMMANDS ];
g_admin_namelog_t *g_admin_namelog[ MAX_ADMIN_NAMELOGS ];
+static int admin_adminlog_index = 0;
+g_admin_adminlog_t *g_admin_adminlog[ MAX_ADMIN_ADMINLOGS ];
+
+static int admin_tklog_index = 0;
+g_admin_tklog_t *g_admin_tklog[ MAX_ADMIN_TKLOGS ];
+
int G_admin_parse_time( const char *time );
// match a certain flag within these flags
@@ -483,12 +489,6 @@ static qboolean admin_permission( char *flags, const char *flag, qboolean *perm
return qfalse;
}
-static int admin_adminlog_index = 0;
-g_admin_adminlog_t *g_admin_adminlog[ MAX_ADMIN_ADMINLOGS ];
-
-static int admin_tklog_index = 0;
-g_admin_tklog_t *g_admin_tklog[ MAX_ADMIN_TKLOGS ];
-
// This function should only be used directly when the client is connecting and thus has no GUID.
// Else, use G_admin_permission()
qboolean G_admin_permission_guid( char *guid, const char* flag )
@@ -620,18 +620,13 @@ static qboolean admin_higher_guid( char *admin_guid, char *victim_guid )
{
int i;
int alevel = 0;
- int alevel2 = 0;
+ qboolean perm = qfalse;
for( i = 0; i < MAX_ADMIN_ADMINS && g_admin_admins[ i ]; i++ )
{
if( !Q_stricmp( admin_guid, g_admin_admins[ i ]->guid ) )
{
alevel = g_admin_admins[ i ]->level;
-
- // Novelty Levels should be equivelant to level 1
- if( alevel > 9 )
- alevel = 1;
-
break;
}
}
@@ -639,17 +634,9 @@ static qboolean admin_higher_guid( char *admin_guid, char *victim_guid )
{
if( !Q_stricmp( victim_guid, g_admin_admins[ i ]->guid ) )
{
- alevel2 = g_admin_admins[ i ]->level;
-
- // Novelty Levels should be equivelant to level 1
- if( alevel2 > 9 )
- alevel2 = 1;
-
- if( alevel < alevel2 )
- return qfalse;
-
- if( strstr( g_admin_admins[ i ]->flags, va( "%s", ADMF_IMMUTABLE ) ) )
+ if( alevel < g_admin_admins[ i ]->level )
return qfalse;
+ return ( !admin_permission( g_admin_admins[ i ]->flags, ADMF_IMMUTABLE, &perm ) || !perm );
}
}
return qtrue;