1 // ==========================
2 // Balance Config Generator
3 // ==========================
5 void W_Config_Queue_Swap(float root, float child, entity pass)
7 string oldroot = wep_config_queue[root];
8 wep_config_queue[root] = wep_config_queue[child];
9 wep_config_queue[child] = oldroot;
12 float W_Config_Queue_Compare(float root, float child, entity pass)
16 for(i = 1; i <= 100; ++i)
18 r = str2chr(wep_config_queue[root], i);
19 c = str2chr(wep_config_queue[child], i);
20 if(r == c) { continue; }
21 else if(c > r) { return -1; }
28 void Dump_Weapon_Settings(void)
30 float i, x, totalsettings = 0;
31 for(i = WEP_FIRST; i <= WEP_LAST; ++i)
33 // step 1: clear the queue
35 for(x = 0; x <= MAX_WEP_CONFIG; ++x)
36 { wep_config_queue[x] = string_null; }
38 // step 2: build new queue
39 WEP_ACTION(i, WR_CONFIG);
42 heapsort(WEP_CONFIG_COUNT, W_Config_Queue_Swap, W_Config_Queue_Compare, world);
44 // step 4: write queue
45 WEP_CONFIG_WRITETOFILE(sprintf("// {{{ #%d: %s\n", i, W_Name(i)))
46 for(x = 0; x <= WEP_CONFIG_COUNT; ++x)
47 { WEP_CONFIG_WRITETOFILE(wep_config_queue[x]) }
48 WEP_CONFIG_WRITETOFILE("// }}}\n")
51 print(sprintf("#%d: %s: %d settings...\n", i, W_Name(i), WEP_CONFIG_COUNT));
52 totalsettings += WEP_CONFIG_COUNT;
54 print(sprintf("Totals: %d weapons, %d settings\n", (i - 1), totalsettings));