X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fweapons%2Fconfig.qc;h=d2443f1670d360767cbc6721f6a2722d2764997c;hb=95da641845d520e3f59e5d47f418859a60704de7;hp=2537022f6ac55bba9cff6d12570e68ea0f12b3f9;hpb=402c9d84fe00cc341e02db9b6e3db5b617301ed6;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/weapons/config.qc b/qcsrc/common/weapons/config.qc index 2537022f6..d2443f167 100644 --- a/qcsrc/common/weapons/config.qc +++ b/qcsrc/common/weapons/config.qc @@ -1,55 +1,63 @@ +#include "config.qh" +#if defined(CSQC) +#elif defined(MENUQC) +#elif defined(SVQC) + #include + #include "all.qh" +#endif + // ========================== // Balance Config Generator // ========================== -void W_Config_Queue_Swap(float root, float child, entity pass) +void W_Config_Queue_Swap(int root, int child, entity pass) { - string oldroot = wep_config_queue[root]; - wep_config_queue[root] = wep_config_queue[child]; - wep_config_queue[child] = oldroot; + string oldroot = config_queue[root]; + config_queue[root] = config_queue[child]; + config_queue[child] = oldroot; } -float W_Config_Queue_Compare(float root, float child, entity pass) +float W_Config_Queue_Compare(int root, int child, entity pass) { - return strcmp(wep_config_queue[root], wep_config_queue[child]); + return strcmp(config_queue[root], config_queue[child]); } -void Dump_Weapon_Settings(void) +void Dump_Weapon_Settings() { - float i, x, totalsettings = 0; - for(i = WEP_FIRST; i <= WEP_LAST; ++i) - { + int totalweapons = 0, totalsettings = 0; + FOREACH(Weapons, it != WEP_Null, { // step 1: clear the queue WEP_CONFIG_COUNT = 0; - for(x = 0; x <= MAX_WEP_CONFIG; ++x) - { wep_config_queue[x] = string_null; } + for (int x = 0; x <= MAX_CONFIG_SETTINGS; ++x) + config_queue[x] = string_null; // step 2: build new queue - WEP_ACTION(i, WR_CONFIG); + it.wr_config(it); // step 3: sort queue - heapsort(WEP_CONFIG_COUNT, W_Config_Queue_Swap, W_Config_Queue_Compare, world); - + heapsort(WEP_CONFIG_COUNT, W_Config_Queue_Swap, W_Config_Queue_Compare, NULL); + // step 4: write queue WEP_CONFIG_WRITETOFILE(sprintf( "// {{{ #%d: %s%s\n", i, - WEP_NAME(i), - (((get_weaponinfo(i)).spawnflags & WEP_FLAG_MUTATORBLOCKED) ? " (MUTATOR WEAPON)" : "") - )) - for(x = 0; x <= WEP_CONFIG_COUNT; ++x) { WEP_CONFIG_WRITETOFILE(wep_config_queue[x]) } - WEP_CONFIG_WRITETOFILE("// }}}\n") + it.m_name, + ((it.spawnflags & WEP_FLAG_MUTATORBLOCKED) ? " (MUTATOR WEAPON)" : "") + )); + for (int x = 0; x <= WEP_CONFIG_COUNT; ++x) { WEP_CONFIG_WRITETOFILE(config_queue[x]); } + WEP_CONFIG_WRITETOFILE("// }}}\n"); // step 5: debug info - print(sprintf("#%d: %s: %d settings...\n", i, WEP_NAME(i), WEP_CONFIG_COUNT)); + LOG_INFOF("#%d: %s: %d settings...", i, it.m_name, WEP_CONFIG_COUNT); + totalweapons += 1; totalsettings += WEP_CONFIG_COUNT; - } + }); // clear queue now that we're finished WEP_CONFIG_COUNT = 0; - for(x = 0; x <= MAX_WEP_CONFIG; ++x) - { wep_config_queue[x] = string_null; } + for(int x = 0; x <= MAX_CONFIG_SETTINGS; ++x) + config_queue[x] = string_null; // extra information - print(sprintf("Totals: %d weapons, %d settings\n", (i - 1), totalsettings)); + LOG_INFOF("Totals: %d weapons, %d settings", totalweapons, totalsettings); }