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 1830 of file sv_cmd.qc.

1831{
1832 FOREACH(SERVER_COMMANDS, true, { CMD_Write_Alias("qc_cmd_sv", it.m_name, it.m_description); });
1833}
#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 461 of file race.qc.

462{
463 for(int i = pos; i <= RANKINGS_CNT; ++i)
464 {
465 string therank = ftos(i);
466 if (i == RANKINGS_CNT)
467 {
468 db_remove(ServerProgsDB, strcat(map, record_type, "time", therank));
469 db_remove(ServerProgsDB, strcat(map, record_type, "crypto_idfp", therank));
470 }
471 else
472 {
473 db_put(ServerProgsDB, strcat(map, record_type, "time", therank), ftos(race_readTime(GetMapname(), i+1)));
474 db_put(ServerProgsDB, strcat(map, record_type, "crypto_idfp", therank), race_readUID(GetMapname(), i+1));
475 }
476 }
477
478 race_SendRanking(pos, 0, 1, MSG_ALL);
479 if(pos == 1)
481
483}
string rankings_reply
Definition util.qh:163
const int RANKINGS_CNT
Definition constants.qh:32
string getrankings()
Definition getreplies.qc:46
string GetMapname()
#define db_remove(db, key)
Definition map.qh:100
ERASEABLE void db_put(int db, string key, string value)
Definition map.qh:103
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:293
float race_readTime(string map, float pos)
Definition race.qc:69
void race_send_recordtime(float msg)
Definition race.qc:259
string race_readUID(string map, float pos)
Definition race.qc:74
#define strcpy(this, s)
Definition string.qh:51
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 1333 of file sv_cmd.qc.

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

References AVAILABLE_TEAMS, bprint(), entity(), Entity_GetTeamIndex(), FOREACH_CLIENT, FOREACH_CLIENT_RANDOM, INGAME, IS_PLAYER, LOG_INFO, max(), MoveToTeam(), NULL, 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