Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
config.qc File Reference
#include "config.qh"
#include <common/turrets/all.qh>
#include <common/util.qh>
Include dependency graph for config.qc:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define TUR_CONFIG_WRITETOFILE(str)

Functions

void Dump_Turret_Settings ()
void T_Config_Queue (string setting)
float T_Config_Queue_Compare (float root, float child, entity pass)
void T_Config_Queue_Swap (float root, float child, entity pass)

Macro Definition Documentation

◆ TUR_CONFIG_WRITETOFILE

#define TUR_CONFIG_WRITETOFILE ( str)
Value:
ERASEABLE void write_String_To_File(int fh, string str, bool alsoprint)
Definition util.qc:1473
float tur_config_alsoprint
Definition config.qh:10
float tur_config_file
Definition config.qh:9

Referenced by Dump_Turret_Settings().

Function Documentation

◆ Dump_Turret_Settings()

void Dump_Turret_Settings ( )

Definition at line 43 of file config.qc.

44{
45 #define TUR_CONFIG_WRITETOFILE(str) write_String_To_File(tur_config_file, str, tur_config_alsoprint)
46 int j, totalsettings = 0;
47 FOREACH(Turrets, it != TUR_Null,
48 {
49 // step 1: clear the queue
51 for (j = 0; j < MAX_CONFIG_SETTINGS; ++j)
53
54 // step 2: build new queue
55 it.tr_config(it);
56
58 {
59 LOG_INFOF("\n^1Dumping aborted^7: hit MAX_CONFIG_SETTINGS (%d) limit\n\n", MAX_CONFIG_SETTINGS);
60 break;
61 }
62
63 // step 3: sort queue
65
66 // step 4: write queue
67 TUR_CONFIG_WRITETOFILE(sprintf("// {{{ #%d: %s\n", i, it.m_name));
68 for (j = 0; j < TUR_CONFIG_COUNT; ++j)
70 TUR_CONFIG_WRITETOFILE("// }}}\n");
71
72 // step 5: debug info
73 LOG_INFOF("#%d: %s: %d settings...", i, it.m_name, TUR_CONFIG_COUNT);
74 totalsettings += TUR_CONFIG_COUNT;
75 });
76 #undef TUR_CONFIG_WRITETOFILE
77
78 // extra information
80 LOG_INFOF("Totals: %d turrets, %d settings", TUR_LAST, totalsettings);
81
82 // clear queue now that we're finished
84 for (j = 0; j < MAX_CONFIG_SETTINGS; ++j)
86}
string config_queue[MAX_CONFIG_SETTINGS]
Definition util.qh:27
const int MAX_CONFIG_SETTINGS
Definition util.qh:26
#define FOREACH(list, cond, body)
Definition iter.qh:19
#define LOG_INFOF(...)
Definition log.qh:66
string string_null
Definition nil.qh:9
#define NULL
Definition post.qh:14
ERASEABLE void heapsort(int n, swapfunc_t swap, comparefunc_t cmp, entity pass)
Definition sort.qh:9
#define TUR_LAST
Definition all.qh:117
#define TUR_CONFIG_WRITETOFILE(str)
float T_Config_Queue_Compare(float root, float child, entity pass)
Definition config.qc:25
void T_Config_Queue_Swap(float root, float child, entity pass)
Definition config.qc:18
float TUR_CONFIG_COUNT
Definition config.qh:12

References config_queue, FOREACH, heapsort(), LOG_INFOF, MAX_CONFIG_SETTINGS, NULL, string_null, T_Config_Queue_Compare(), T_Config_Queue_Swap(), TUR_CONFIG_COUNT, TUR_CONFIG_WRITETOFILE, and TUR_LAST.

Referenced by GENERIC_COMMAND().

◆ T_Config_Queue()

void T_Config_Queue ( string setting)

Definition at line 12 of file config.qc.

13{
15 config_queue[TUR_CONFIG_COUNT++] = setting;
16}

References config_queue, MAX_CONFIG_SETTINGS, and TUR_CONFIG_COUNT.

◆ T_Config_Queue_Compare()

float T_Config_Queue_Compare ( float root,
float child,
entity pass )

Definition at line 25 of file config.qc.

26{
27 float r, c;
28
29 for (int i = 1; i <= 100; ++i)
30 {
31 r = str2chr(config_queue[root], i);
32 c = str2chr(config_queue[child], i);
33 if (r == c)
34 continue;
35 else if (c > r)
36 return -1;
37 else
38 return 1;
39 }
40 return 0;
41}
#define str2chr

References config_queue, entity(), pass, and str2chr.

Referenced by Dump_Turret_Settings().

◆ T_Config_Queue_Swap()

void T_Config_Queue_Swap ( float root,
float child,
entity pass )

Definition at line 18 of file config.qc.

19{
20 string oldroot = config_queue[root];
21 config_queue[root] = config_queue[child];
22 config_queue[child] = oldroot;
23}

References config_queue, entity(), and pass.

Referenced by Dump_Turret_Settings().