diff options
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/g_admin.c | 48 | ||||
-rw-r--r-- | src/game/g_cmds.c | 14 | ||||
-rw-r--r-- | src/game/g_local.h | 3 |
3 files changed, 47 insertions, 18 deletions
diff --git a/src/game/g_admin.c b/src/game/g_admin.c index 018639a7..efcdad97 100644 --- a/src/game/g_admin.c +++ b/src/game/g_admin.c @@ -2631,13 +2631,27 @@ qboolean G_admin_lock( gentity_t *ent, int skiparg ) ADMP( va( "^3!lock: ^7invalid team\"%c\"\n", teamName[0] ) ); return qfalse; } - if( level.teamLocked[ team ] ) + + if( team == PTE_ALIENS ) { - ADMP( va( "^3!lock: ^7%s team is already locked\n", - ( team == PTE_ALIENS ) ? "Alien" : "Human" ) ); - return qfalse; + if( level.alienTeamLocked ) + { + ADMP( "^3!lock: ^7Alien team is already locked\n" ); + return qfalse; + } + else + level.alienTeamLocked = qtrue; } - level.teamLocked[ team ] = qtrue; + else if( team == PTE_HUMANS ) { + if( level.humanTeamLocked ) + { + ADMP( "^3!lock: ^7Human team is already locked\n" ); + return qfalse; + } + else + level.humanTeamLocked = qtrue; + } + AP( va( "print \"^3!lock: ^7%s team has been locked by %s\n\"", ( team == PTE_ALIENS ) ? "Alien" : "Human", ( ent ) ? ent->client->pers.netname : "console" ) ); @@ -2664,13 +2678,27 @@ qboolean G_admin_unlock( gentity_t *ent, int skiparg ) ADMP( va( "^3!unlock: ^7invalid team\"%c\"\n", teamName[0] ) ); return qfalse; } - if( !level.teamLocked[ team ] ) + + if( team == PTE_ALIENS ) { - ADMP( va( "^3!lock: ^7%s team is not locked\n", - ( team == PTE_ALIENS ) ? "Alien" : "Human" ) ); - return qfalse; + if( !level.alienTeamLocked ) + { + ADMP( "^3!unlock: ^7Alien team is not currently locked\n" ); + return qfalse; + } + else + level.alienTeamLocked = qfalse; } - level.teamLocked[ team ] = qfalse; + else if( team == PTE_HUMANS ) { + if( !level.humanTeamLocked ) + { + ADMP( "^3!unlock: ^7Human team is not currently locked\n" ); + return qfalse; + } + else + level.humanTeamLocked = qfalse; + } + AP( va( "print \"^3!unlock: ^7%s team has been unlocked by %s\n\"", ( team == PTE_ALIENS ) ? "Alien" : "Human", ( ent ) ? ent->client->pers.netname : "console" ) ); diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 666d2765..10ef878d 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -668,13 +668,13 @@ void Cmd_Team_f( gentity_t *ent ) team = PTE_NONE; else if( !Q_stricmp( s, "aliens" ) ) { - if( level.teamLocked[ PTE_ALIENS ] ) + if( level.alienTeamLocked ) { trap_SendServerCommand( ent-g_entities, va( "print \"Alien team has been ^1LOCKED\n\"", s ) ); return; } - else if( level.teamLocked[ PTE_HUMANS ] ) + else if( level.humanTeamLocked ) { // if only one team has been locked, let people join the other // regardless of balance @@ -694,13 +694,13 @@ void Cmd_Team_f( gentity_t *ent ) } else if( !Q_stricmp( s, "humans" ) ) { - if( level.teamLocked[ PTE_HUMANS ] ) + if( level.humanTeamLocked ) { trap_SendServerCommand( ent-g_entities, va( "print \"Human team has been ^1LOCKED\n\"", s ) ); return; } - else if( level.teamLocked[ PTE_ALIENS ] ) + else if( level.alienTeamLocked ) { // if only one team has been locked, let people join the other // regardless of balance @@ -720,7 +720,7 @@ void Cmd_Team_f( gentity_t *ent ) } else if( !Q_stricmp( s, "auto" ) ) { - if( level.teamLocked[ PTE_HUMANS ] && level.teamLocked[ PTE_ALIENS ] ) + if( level.humanTeamLocked && level.alienTeamLocked ) team = PTE_NONE; else if( level.numHumanClients > level.numAlienClients ) team = PTE_ALIENS; @@ -729,9 +729,9 @@ void Cmd_Team_f( gentity_t *ent ) else team = PTE_ALIENS + ( rand( ) % 2 ); - if( team == PTE_ALIENS && level.teamLocked[ PTE_ALIENS ] ) + if( team == PTE_ALIENS && level.alienTeamLocked ) team = PTE_HUMANS; - else if( team == PTE_HUMANS && level.teamLocked[ PTE_HUMANS ] ) + else if( team == PTE_HUMANS && level.humanTeamLocked ) team = PTE_ALIENS; } else diff --git a/src/game/g_local.h b/src/game/g_local.h index 304c9f62..a905e15d 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -622,7 +622,8 @@ typedef struct qboolean uncondAlienWin; qboolean uncondHumanWin; - qboolean teamLocked[ TEAM_NUM_TEAMS ]; + qboolean alienTeamLocked; + qboolean humanTeamLocked; } level_locals_t; // |