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

1838{
1839 FOREACH(SERVER_COMMANDS, true, { CMD_Write_Alias("qc_cmd_sv", it.m_name, it.m_description); });
1840}
#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: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: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 1340 of file sv_cmd.qc.

1341{
1342 if (!teamplay)
1343 {
1344 LOG_INFO("Can't shuffle teams when currently not playing a team game.");
1345 return;
1346 }
1347
1348 FOREACH_CLIENT(IS_PLAYER(it) || INGAME(it), {
1349 if (Player_HasRealForcedTeam(it)) {
1350 // we could theoretically assign forced players to their teams
1351 // and shuffle the rest to fill the empty spots but in practise
1352 // either all players or none are gonna have forced teams
1353 LOG_INFO("Can't shuffle teams because at least one player has a forced team.");
1354 return;
1355 }
1356 });
1357
1358 int number_of_teams = 0;
1360 for (int i = 1; i <= AVAILABLE_TEAMS; ++i)
1361 {
1362 if (TeamBalance_IsTeamAllowed(balance, i))
1363 {
1364 number_of_teams = max(i, number_of_teams);
1365 }
1366 }
1367 TeamBalance_Destroy(balance);
1368
1369 int team_index = 0;
1371 int target_team_index = team_index + 1;
1372 if (Entity_GetTeamIndex(it) != target_team_index)
1373 {
1374 MoveToTeam(it, target_team_index, 6);
1375 }
1376 team_index = (team_index + 1) % number_of_teams;
1377 });
1378
1379 bprint("Successfully shuffled the players around randomly.\n");
1380}
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:597
bool Player_HasRealForcedTeam(entity player)
Returns whether player has real forced team.
Definition teamplay.qc:342
entity TeamBalance_CheckAllowedTeams(entity for_whom)
Checks whether the player can join teams according to global configuration and mutator settings.
Definition teamplay.qc:488
bool TeamBalance_IsTeamAllowed(entity balance, int index)
Returns whether the team change to the specified team is allowed.
Definition teamplay.qc:807
bool MoveToTeam(entity client, int team_index, int type)
Moves player to the specified team.
Definition teamplay.qc:328
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