5 #include <common/util.qh>
9 // ==========================
10 // Balance Config Generator
11 // ==========================
13 void W_Config_Queue_Swap(int root, int child, entity pass)
15 string oldroot = config_queue[root];
16 config_queue[root] = config_queue[child];
17 config_queue[child] = oldroot;
20 float W_Config_Queue_Compare(int root, int child, entity pass)
22 return strcmp(config_queue[root], config_queue[child]);
25 void Dump_Weapon_Settings()
27 int totalweapons = 0, totalsettings = 0;
29 FOREACH(Weapons, it != WEP_Null, {
30 if((it.spawnflags & WEP_FLAG_HIDDEN) && (it.spawnflags & WEP_FLAG_MUTATORBLOCKED) && !(it.spawnflags & WEP_FLAG_NORMAL))
31 continue; // never include the attacks
32 // step 1: clear the queue
34 for (int x = 0; x <= MAX_CONFIG_SETTINGS; ++x)
35 config_queue[x] = string_null;
37 // step 2: build new queue
41 heapsort(WEP_CONFIG_COUNT, W_Config_Queue_Swap, W_Config_Queue_Compare, NULL);
43 // step 4: write queue
44 WEP_CONFIG_WRITETOFILE(sprintf(
48 ((it.spawnflags & WEP_FLAG_MUTATORBLOCKED) ? " (MUTATOR WEAPON)" : "")
50 for (int x = 0; x <= WEP_CONFIG_COUNT; ++x) { WEP_CONFIG_WRITETOFILE(config_queue[x]); }
51 WEP_CONFIG_WRITETOFILE("// }}}\n");
54 LOG_INFOF("#%d: %s: %d settings...", i, it.m_name, WEP_CONFIG_COUNT);
56 totalsettings += WEP_CONFIG_COUNT;
60 // clear queue now that we're finished
62 for(int x = 0; x <= MAX_CONFIG_SETTINGS; ++x)
63 config_queue[x] = string_null;
66 LOG_INFOF("Totals: %d weapons, %d settings", totalweapons, totalsettings);