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 #define WEP_CONFIG_WRITETOFILE(str) write_String_To_File(wep_config_file, str, wep_config_alsoprint)
30 FOREACH(Weapons, it != WEP_Null, {
31 if((it.spawnflags & WEP_FLAG_HIDDEN) && (it.spawnflags & WEP_FLAG_MUTATORBLOCKED) && !(it.spawnflags & WEP_FLAG_NORMAL))
32 continue; // never include the attacks
33 // step 1: clear the queue
35 for (int x = 0; x <= MAX_CONFIG_SETTINGS; ++x)
36 config_queue[x] = string_null;
38 // step 2: build new queue
42 heapsort(WEP_CONFIG_COUNT, W_Config_Queue_Swap, W_Config_Queue_Compare, NULL);
44 // step 4: write queue
45 WEP_CONFIG_WRITETOFILE(sprintf(
49 ((it.spawnflags & WEP_FLAG_MUTATORBLOCKED) ? " (MUTATOR WEAPON)" : "")
51 for (int x = 0; x <= WEP_CONFIG_COUNT; ++x) { WEP_CONFIG_WRITETOFILE(config_queue[x]); }
52 WEP_CONFIG_WRITETOFILE("// }}}\n");
55 LOG_INFOF("#%d: %s: %d settings...", i, it.m_name, WEP_CONFIG_COUNT);
57 totalsettings += WEP_CONFIG_COUNT;
60 #undef WEP_CONFIG_WRITETOFILE
62 // clear queue now that we're finished
64 for(int x = 0; x <= MAX_CONFIG_SETTINGS; ++x)
65 config_queue[x] = string_null;
68 LOG_INFOF("Totals: %d weapons, %d settings", totalweapons, totalsettings);