Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
sv_cmd.qh File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void GameCommand_macro_write_aliases (float fh)
void race_deleteTime (string map, float pos)
void shuffleteams ()

Variables

bool shuffleteams_on_reset_map

Function Documentation

◆ GameCommand_macro_write_aliases()

void GameCommand_macro_write_aliases ( float fh)

Definition at line 1836 of file sv_cmd.qc.

1837{
1838 FOREACH(SERVER_COMMANDS, true, { CMD_Write_Alias("qc_cmd_sv", it.m_name, it.m_description); });
1839}
#define CMD_Write_Alias(execute, command, description)
Definition generic.qh:34
#define FOREACH(list, cond, body)
Definition iter.qh:19

References CMD_Write_Alias, and FOREACH.

Referenced by GENERIC_COMMAND().

◆ race_deleteTime()

void race_deleteTime ( string map,
float pos )

Definition at line 462 of file race.qc.

463{
464 for(int i = pos; i <= RANKINGS_CNT; ++i)
465 {
466 string therank = ftos(i);
467 if (i == RANKINGS_CNT)
468 {
469 db_remove(ServerProgsDB, strcat(map, record_type, "time", therank));
470 db_remove(ServerProgsDB, strcat(map, record_type, "crypto_idfp", therank));
471 }
472 else
473 {
474 db_put(ServerProgsDB, strcat(map, record_type, "time", therank), ftos(race_readTime(GetMapname(), i+1)));
475 db_put(ServerProgsDB, strcat(map, record_type, "crypto_idfp", therank), race_readUID(GetMapname(), i+1));
476 }
477 }
478
479 race_SendRanking(pos, 0, 1, MSG_ALL);
480 if(pos == 1)
482
484}
string rankings_reply
Definition util.qh:161
const int RANKINGS_CNT
Definition constants.qh:31
string getrankings()
Definition getreplies.qc:46
string GetMapname()
#define db_remove(db, key)
Definition map.qh:98
ERASEABLE void db_put(int db, string key, string value)
Definition map.qh:101
string ftos(float f)
float MSG_ALL
Definition menudefs.qc:57
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
void race_SendRanking(float pos, float prevpos, float del, float msg)
Definition race.qc:294
float race_readTime(string map, float pos)
Definition race.qc:69
void race_send_recordtime(float msg)
Definition race.qc:260
string race_readUID(string map, float pos)
Definition race.qc:74
#define strcpy(this, s)
Definition string.qh:52
string record_type
Definition world.qh:55
float ServerProgsDB
Definition world.qh:128

References db_put(), db_remove, ftos(), GetMapname(), getrankings(), MSG_ALL, race_readTime(), race_readUID(), race_send_recordtime(), race_SendRanking(), RANKINGS_CNT, rankings_reply, record_type, ServerProgsDB, strcat(), and strcpy.

Referenced by GameCommand_delrec().

◆ shuffleteams()

void shuffleteams ( )

Definition at line 1339 of file sv_cmd.qc.

1340{
1341 if (!teamplay)
1342 {
1343 LOG_INFO("Can't shuffle teams when currently not playing a team game.");
1344 return;
1345 }
1346
1347 FOREACH_CLIENT(IS_PLAYER(it) || INGAME(it), {
1348 if (Player_HasRealForcedTeam(it)) {
1349 // we could theoretically assign forced players to their teams
1350 // and shuffle the rest to fill the empty spots but in practise
1351 // either all players or none are gonna have forced teams
1352 LOG_INFO("Can't shuffle teams because at least one player has a forced team.");
1353 return;
1354 }
1355 });
1356
1357 int number_of_teams = 0;
1359 for (int i = 1; i <= NUM_TEAMS; ++i)
1360 {
1361 if (TeamBalance_IsTeamAllowed(balance, i))
1362 {
1363 number_of_teams = max(i, number_of_teams);
1364 }
1365 }
1366 TeamBalance_Destroy(balance);
1367
1368 int team_index = 0;
1370 int target_team_index = team_index + 1;
1371 if (Entity_GetTeamIndex(it) != target_team_index)
1372 {
1373 MoveToTeam(it, target_team_index, 6);
1374 }
1375 team_index = (team_index + 1) % number_of_teams;
1376 });
1377
1378 bprint("Successfully shuffled the players around randomly.\n");
1379}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define IS_PLAYER(s)
Definition player.qh:243
#define LOG_INFO(...)
Definition log.qh:65
void bprint(string text,...)
float max(float f,...)
#define NULL
Definition post.qh:14
#define INGAME(it)
Definition sv_rules.qh:24
int Entity_GetTeamIndex(entity this)
Returns the team index of the given entity.
Definition teamplay.qc:181
void TeamBalance_Destroy(entity balance)
Destroy the team balance entity.
Definition teamplay.qc:599
bool Player_HasRealForcedTeam(entity player)
Returns whether player has real forced team.
Definition teamplay.qc:313
entity TeamBalance_CheckAllowedTeams(entity for_whom)
Checks whether the player can join teams according to global configuration and mutator settings.
Definition teamplay.qc:459
bool TeamBalance_IsTeamAllowed(entity balance, int index)
Returns whether the team change to the specified team is allowed.
Definition teamplay.qc:826
bool MoveToTeam(entity client, int team_index, int type)
Moves player to the specified team.
Definition teamplay.qc:299
const int NUM_TEAMS
Number of teams in the game.
Definition teams.qh:3
bool teamplay
Definition teams.qh:59
#define FOREACH_CLIENT_RANDOM(cond, body)
Definition utils.qh:56
#define FOREACH_CLIENT(cond, body)
Definition utils.qh:50

References bprint(), entity(), Entity_GetTeamIndex(), FOREACH_CLIENT, FOREACH_CLIENT_RANDOM, INGAME, IS_PLAYER, LOG_INFO, max(), MoveToTeam(), NULL, NUM_TEAMS, Player_HasRealForcedTeam(), TeamBalance_CheckAllowedTeams(), TeamBalance_Destroy(), TeamBalance_IsTeamAllowed(), and teamplay.

Referenced by GameCommand_shuffleteams(), reset_map(), and SERVER_COMMAND().

Variable Documentation

◆ shuffleteams_on_reset_map

bool shuffleteams_on_reset_map