Пример #1
0
/**
 * @brief If password has changed, update sv_needpass cvar as needed
 */
static void CheckNeedPass (void)
{
	if (password->modified) {
		password->modified = false;

		const int need = Q_strvalid(password->string) && Q_strcasecmp(password->string, "none") ? 1 : 0;
		gi.Cvar_Set("sv_needpass", "%i", need);
	}
}
Пример #2
0
/**
 * @brief If password has changed, update sv_needpass cvar as needed
 */
static void CheckNeedPass (void)
{
	if (password->modified) {
		const char *need = "0";
		password->modified = false;

		if (password->string[0] != '\0' && Q_strcasecmp(password->string, "none"))
			need = "1";

		gi.Cvar_Set("sv_needpass", need);
	}
}
Пример #3
0
/**
 * @sa SV_RunGameFrame
 * @sa G_MatchEndTrigger
 * @sa AI_Run
 * @return true if game reaches its end - false otherwise
 */
static bool G_RunFrame (void)
{
	level.framenum++;
	/* server is running at 10 fps */
	level.time = level.framenum * SERVER_FRAME_SECONDS;

	/* this doesn't belong here, but it works */
	if (!level.routed) {
		level.routed = true;
		G_CompleteRecalcRouting();
	}

	/* still waiting for other players */
	if (!G_MatchIsRunning()) {
		if (sv_maxteams->modified) {
			/* inform the client */
			gi.ConfigString(CS_MAXTEAMS, "%i", sv_maxteams->integer);
			sv_maxteams->modified = false;
		}
	}

	if (G_IsMultiPlayer()) {
		if (sv_roundtimelimit->modified) {
			/* some played around here - restart the count down */
			level.roundstartTime = level.time;
			/* don't allow smaller values here */
			if (sv_roundtimelimit->integer < 30 && sv_roundtimelimit->integer > 0) {
				gi.DPrintf("The minimum value for sv_roundtimelimit is 30\n");
				gi.Cvar_Set("sv_roundtimelimit", "30");
			}
			sv_roundtimelimit->modified = false;
		}
		G_CheckForceEndRound();
	}

	/* end this game? */
	if (G_MatchDoEnd())
		return true;

	CheckNeedPass();

	/* run ai */
	AI_Run();

	/* not all teams are spawned or game has already ended */
	if (G_MatchIsRunning())
		G_EdictsThink();

	G_SendBoundingBoxes();

	return false;
}