X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Fweapons%2Fconfig.qc;h=26a05d10ac739f4b609a5ce39384be48e9ef86d8;hp=3ee4a684a26bff97bd44c17482e62ca6b5137a8c;hb=b9671f63469586007314131f3f53728795c035cd;hpb=43eba8ca70f00458db385630f86009f6d7fa849a diff --git a/qcsrc/common/weapons/config.qc b/qcsrc/common/weapons/config.qc index 3ee4a684a..26a05d10a 100644 --- a/qcsrc/common/weapons/config.qc +++ b/qcsrc/common/weapons/config.qc @@ -24,41 +24,40 @@ float W_Config_Queue_Compare(int root, int child, entity pass) void Dump_Weapon_Settings() { - int 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) + for (int x = 0; x <= MAX_WEP_CONFIG; ++x) { wep_config_queue[x] = string_null; } // step 2: build new queue - Weapon w = get_weaponinfo(i); - w.wr_config(w); + 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)" : "") + it.m_name, + ((it.spawnflags & WEP_FLAG_MUTATORBLOCKED) ? " (MUTATOR WEAPON)" : "") )); - for(x = 0; x <= WEP_CONFIG_COUNT; ++x) { WEP_CONFIG_WRITETOFILE(wep_config_queue[x]); } + for (int x = 0; x <= WEP_CONFIG_COUNT; ++x) { WEP_CONFIG_WRITETOFILE(wep_config_queue[x]); } WEP_CONFIG_WRITETOFILE("// }}}\n"); // step 5: debug info - LOG_INFO(sprintf("#%d: %s: %d settings...\n", i, WEP_NAME(i), WEP_CONFIG_COUNT)); + LOG_INFO(sprintf("#%d: %s: %d settings...\n", 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) + for(int x = 0; x <= MAX_WEP_CONFIG; ++x) { wep_config_queue[x] = string_null; } // extra information - LOG_INFO(sprintf("Totals: %d weapons, %d settings\n", (i - 1), totalsettings)); + LOG_INFO(sprintf("Totals: %d weapons, %d settings\n", totalweapons, totalsettings)); }