16 void T_Config_Queue(
string setting)
18 if (TUR_CONFIG_COUNT <= MAX_CONFIG_SETTINGS - 1)
19 config_queue[TUR_CONFIG_COUNT++] = setting;
22 void T_Config_Queue_Swap(
float root,
float child,
entity pass)
24 string oldroot = config_queue[root];
25 config_queue[root] = config_queue[child];
26 config_queue[child] = oldroot;
29 float T_Config_Queue_Compare(
float root,
float child,
entity pass)
33 for(i = 1; i <= 100; ++i)
35 r =
str2chr(config_queue[root], i);
36 c =
str2chr(config_queue[child], i);
37 if(r == c) {
continue; }
38 else if(c > r) {
return -1; }
45 void Dump_Turret_Settings()
47 #define TUR_CONFIG_WRITETOFILE(str) write_String_To_File(tur_config_file, str, tur_config_alsoprint) 48 int totalsettings = 0;
49 FOREACH(Turrets, it != TUR_Null, {
52 for (
int j = 0; j < MAX_CONFIG_SETTINGS; ++j)
58 if (TUR_CONFIG_COUNT > MAX_CONFIG_SETTINGS - 1)
60 LOG_INFOF(
"\n^1Dumping aborted^7: hit MAX_CONFIG_SETTINGS (%d) limit\n\n", MAX_CONFIG_SETTINGS);
65 heapsort(TUR_CONFIG_COUNT, T_Config_Queue_Swap, T_Config_Queue_Compare,
NULL);
68 TUR_CONFIG_WRITETOFILE(sprintf(
"// {{{ #%d: %s\n", i, it.turret_name));
69 for (
int j = 0; j < TUR_CONFIG_COUNT; ++j)
70 TUR_CONFIG_WRITETOFILE(config_queue[j]);
71 TUR_CONFIG_WRITETOFILE(
"// }}}\n");
74 LOG_INFOF(
"#%d: %s: %d settings...", i, it.turret_name, TUR_CONFIG_COUNT);
75 totalsettings += TUR_CONFIG_COUNT;
77 #undef TUR_CONFIG_WRITETOFILE 80 if (TUR_CONFIG_COUNT <= MAX_CONFIG_SETTINGS - 1)
85 for (
int j = 0; j < MAX_CONFIG_SETTINGS; ++j)
ERASEABLE void heapsort(int n, swapfunc_t swap, comparefunc_t cmp, entity pass)
#define REGISTRY_COUNT(id)
#define pass(name, colormin, colormax)
#define FOREACH(list, cond, body)