Xonotic
config.qc File Reference
#include "config.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 WEP_CONFIG_WRITETOFILE(str)   write_String_To_File(wep_config_file, str, wep_config_alsoprint)
 

Functions

void Dump_Weapon_Settings ()
 
void W_Config_Queue (string setting)
 
float W_Config_Queue_Compare (int root, int child, entity pass)
 
void W_Config_Queue_Swap (int root, int child, entity pass)
 

Macro Definition Documentation

◆ WEP_CONFIG_WRITETOFILE

#define WEP_CONFIG_WRITETOFILE (   str)    write_String_To_File(wep_config_file, str, wep_config_alsoprint)

Referenced by Dump_Weapon_Settings().

Function Documentation

◆ Dump_Weapon_Settings()

void Dump_Weapon_Settings ( )

Definition at line 32 of file config.qc.

References for(), FOREACH, heapsort(), LOG_INFOF, NULL, string_null, W_Config_Queue_Compare(), W_Config_Queue_Swap(), WEP_CONFIG_WRITETOFILE, WEP_FLAG_MUTATORBLOCKED, and WEP_FLAG_SPECIALATTACK.

Referenced by GENERIC_COMMAND().

33 {
34  int totalweapons = 0, totalsettings = 0;
35  int wepcount = 1;
36  #define WEP_CONFIG_WRITETOFILE(str) write_String_To_File(wep_config_file, str, wep_config_alsoprint)
37  FOREACH(Weapons, it != WEP_Null, {
38  if(it.spawnflags & WEP_FLAG_SPECIALATTACK)
39  continue; // never include the attacks
40  // step 1: clear the queue
41  WEP_CONFIG_COUNT = 0;
42  for (int x = 0; x < MAX_CONFIG_SETTINGS; ++x)
43  config_queue[x] = string_null;
44 
45  // step 2: build new queue
46  it.wr_config(it);
47 
48  if (WEP_CONFIG_COUNT > MAX_CONFIG_SETTINGS - 1)
49  {
50  LOG_INFOF("\n^1Dumping aborted^7: hit MAX_CONFIG_SETTINGS (%d) limit\n\n", MAX_CONFIG_SETTINGS);
51  break;
52  }
53 
54  // step 3: sort queue
56 
57  // step 4: write queue
58  WEP_CONFIG_WRITETOFILE(sprintf(
59  "// {{{ #%d: %s%s\n",
60  wepcount,
61  it.m_name,
62  ((it.spawnflags & WEP_FLAG_MUTATORBLOCKED) ? " (MUTATOR WEAPON)" : "")
63  ));
64  for (int x = 0; x < WEP_CONFIG_COUNT; ++x)
65  WEP_CONFIG_WRITETOFILE(config_queue[x]);
66  WEP_CONFIG_WRITETOFILE("// }}}\n");
67 
68  // step 5: debug info
69  LOG_INFOF("#%d: %s: %d settings...", i, it.m_name, WEP_CONFIG_COUNT);
70  totalweapons += 1;
71  totalsettings += WEP_CONFIG_COUNT;
72  wepcount += 1;
73  });
74  #undef WEP_CONFIG_WRITETOFILE
75 
76  // extra information
77  if (WEP_CONFIG_COUNT <= MAX_CONFIG_SETTINGS - 1)
78  LOG_INFOF("Totals: %d weapons, %d settings", totalweapons, totalsettings);
79 
80  // clear queue now that we're finished
81  WEP_CONFIG_COUNT = 0;
82  for (int x = 0; x < MAX_CONFIG_SETTINGS; ++x)
83  config_queue[x] = string_null;
84 }
string string_null
Definition: nil.qh:9
float W_Config_Queue_Compare(int root, int child, entity pass)
Definition: config.qc:27
#define WEP_CONFIG_WRITETOFILE(str)
ERASEABLE void heapsort(int n, swapfunc_t swap, comparefunc_t cmp, entity pass)
Definition: sort.qh:9
#define LOG_INFOF(...)
Definition: log.qh:71
void W_Config_Queue_Swap(int root, int child, entity pass)
Definition: config.qc:20
for(int slot=0;slot< MAX_WEAPONSLOTS;++slot)
Definition: impulse.qc:97
#define NULL
Definition: post.qh:17
const int WEP_FLAG_SPECIALATTACK
Definition: weapon.qh:211
const int WEP_FLAG_MUTATORBLOCKED
Definition: weapon.qh:203
#define FOREACH(list, cond, body)
Definition: iter.qh:19
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ W_Config_Queue()

void W_Config_Queue ( string  setting)

Definition at line 14 of file config.qc.

15 {
16  if (WEP_CONFIG_COUNT <= MAX_CONFIG_SETTINGS - 1)
17  config_queue[WEP_CONFIG_COUNT++] = setting;
18 }

◆ W_Config_Queue_Compare()

float W_Config_Queue_Compare ( int  root,
int  child,
entity  pass 
)

Definition at line 27 of file config.qc.

References strcmp.

Referenced by Dump_Weapon_Settings().

28 {
29  return strcmp(config_queue[root], config_queue[child]);
30 }
#define strcmp
Definition: dpextensions.qh:51
+ Here is the caller graph for this function:

◆ W_Config_Queue_Swap()

void W_Config_Queue_Swap ( int  root,
int  child,
entity  pass 
)

Definition at line 20 of file config.qc.

Referenced by Dump_Weapon_Settings().

21 {
22  string oldroot = config_queue[root];
23  config_queue[root] = config_queue[child];
24  config_queue[child] = oldroot;
25 }
+ Here is the caller graph for this function: