2 // ==========================
3 // Turret Config Generator
4 // ==========================
8 void T_Config_Queue_Swap(float root, float child, entity pass)
10 string oldroot = config_queue[root];
11 config_queue[root] = config_queue[child];
12 config_queue[child] = oldroot;
15 float T_Config_Queue_Compare(float root, float child, entity pass)
19 for (i = 1; i <= 100; ++i) {
20 r = str2chr(config_queue[root], i);
21 c = str2chr(config_queue[child], i);
22 if (r == c) { continue; } else if (c > r) {
30 void Dump_Turret_Settings()
32 int totalsettings = 0;
33 FOREACH(Turrets, it != TUR_Null, {
34 // step 1: clear the queue
36 for (int j = 0; j <= MAX_CONFIG_SETTINGS; ++j) {
37 config_queue[j] = string_null;
40 // step 2: build new queue
44 heapsort(TUR_CONFIG_COUNT, T_Config_Queue_Swap, T_Config_Queue_Compare, NULL);
46 // step 4: write queue
47 TUR_CONFIG_WRITETOFILE(sprintf("// {{{ #%d: %s\n", i, it.turret_name))
48 for (int j = 0; j <= TUR_CONFIG_COUNT; ++j) {
49 TUR_CONFIG_WRITETOFILE(config_queue[j])
50 TUR_CONFIG_WRITETOFILE("// }}}\n")
53 LOG_INFOF("#%d: %s: %d settings...", i, it.turret_name, TUR_CONFIG_COUNT);
55 totalsettings += TUR_CONFIG_COUNT;
58 // clear queue now that we're finished
60 for (int j = 0; j <= MAX_CONFIG_SETTINGS; ++j) {
61 config_queue[j] = string_null;
65 LOG_INFOF("Totals: %d turrets, %d settings", (Turrets_COUNT - 1), totalsettings);