Skip to content

Commit

Permalink
g_emptyTeamsSkipMapTime
Browse files Browse the repository at this point in the history
if the teams are empty after this amount of game time, the map is skipped (prevents players joining long-running empty games)
  • Loading branch information
cu-kai committed Dec 11, 2015
1 parent be1b099 commit ef359dd
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/sgame/sg_main.cpp
Expand Up @@ -195,6 +195,7 @@ vmCvar_t g_debugEntities;


vmCvar_t g_instantBuilding; vmCvar_t g_instantBuilding;


vmCvar_t g_emptyTeamsSkipMapTime;


// <bot stuff> // <bot stuff>


Expand Down Expand Up @@ -403,6 +404,8 @@ static cvarTable_t gameCvarTable[] =


{ &g_instantBuilding, "g_instantBuilding", "0", 0, 0, true , nullptr }, { &g_instantBuilding, "g_instantBuilding", "0", 0, 0, true , nullptr },


{ &g_emptyTeamsSkipMapTime, "g_emptyTeamsSkipMapTime", "0", 0, 0, true , nullptr },

// bots: buying // bots: buying
{ &g_bot_buy, "g_bot_buy", "1", CVAR_NORESTART, 0, false, nullptr }, { &g_bot_buy, "g_bot_buy", "1", CVAR_NORESTART, 0, false, nullptr },
{ &g_bot_rifle, "g_bot_rifle", "1", CVAR_NORESTART, 0, false, nullptr }, { &g_bot_rifle, "g_bot_rifle", "1", CVAR_NORESTART, 0, false, nullptr },
Expand Down Expand Up @@ -2449,6 +2452,18 @@ void CheckExitRules()
LogExit( "Aliens win." ); LogExit( "Aliens win." );
G_MapLog_Result( 'a' ); G_MapLog_Result( 'a' );
} }
else if( g_emptyTeamsSkipMapTime.integer &&
( level.time - level.startTime ) / 60000 >=
g_emptyTeamsSkipMapTime.integer &&
level.team[ TEAM_ALIENS ].numClients == 0 && level.team[ TEAM_HUMANS ].numClients == 0 )
{
//nobody wins because the teams are empty after x amount of game time
level.lastWin = TEAM_NONE;
trap_SendServerCommand( -1, "print \"Empty teams skip map time exceeded.\n\"" );
trap_SetConfigstring( CS_WINNER, "Stalemate" );
LogExit( "Timelimit hit." );
G_MapLog_Result( 't' );
}
} }


/* /*
Expand Down

0 comments on commit ef359dd

Please sign in to comment.