X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fturrets%2Fconfig.qc;h=effabeac275ded29fed4b17d370f6e56e7cd5fb2;hb=62d736d8c3a51baf5fa3a4265e39a2b773704a91;hp=f35448e9c2212dd98506391dbced0b0133658e6d;hpb=5f591ed9737ba08832475c1c324f91721e76bdf7;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/turrets/config.qc b/qcsrc/common/turrets/config.qc index f35448e9c..effabeac2 100644 --- a/qcsrc/common/turrets/config.qc +++ b/qcsrc/common/turrets/config.qc @@ -1,12 +1,15 @@ +#include "config.qh" // ========================== // Turret Config Generator // ========================== +#ifdef SVQC + void T_Config_Queue_Swap(float root, float child, entity pass) { - string oldroot = tur_config_queue[root]; - tur_config_queue[root] = tur_config_queue[child]; - tur_config_queue[child] = oldroot; + string oldroot = config_queue[root]; + config_queue[root] = config_queue[child]; + config_queue[child] = oldroot; } float T_Config_Queue_Compare(float root, float child, entity pass) @@ -15,8 +18,8 @@ float T_Config_Queue_Compare(float root, float child, entity pass) for(i = 1; i <= 100; ++i) { - r = str2chr(tur_config_queue[root], i); - c = str2chr(tur_config_queue[child], i); + r = str2chr(config_queue[root], i); + c = str2chr(config_queue[child], i); if(r == c) { continue; } else if(c > r) { return -1; } else { return 1; } @@ -25,38 +28,39 @@ float T_Config_Queue_Compare(float root, float child, entity pass) return 0; } -void Dump_Turret_Settings(void) +void Dump_Turret_Settings() { - float i, x, totalsettings = 0; - for(i = TUR_FIRST; i <= TUR_LAST; ++i) - { + int totalsettings = 0; + FOREACH(Turrets, it != TUR_Null, { // step 1: clear the queue TUR_CONFIG_COUNT = 0; - for(x = 0; x <= MAX_TUR_CONFIG; ++x) - { tur_config_queue[x] = string_null; } + for(int j = 0; j <= MAX_CONFIG_SETTINGS; ++j) + config_queue[j] = string_null; // step 2: build new queue - TUR_ACTION(i, TR_CONFIG); + it.tr_config(it); // step 3: sort queue - heapsort(TUR_CONFIG_COUNT, T_Config_Queue_Swap, T_Config_Queue_Compare, world); + heapsort(TUR_CONFIG_COUNT, T_Config_Queue_Swap, T_Config_Queue_Compare, NULL); // step 4: write queue - TUR_CONFIG_WRITETOFILE(sprintf("// {{{ #%d: %s\n", i, TUR_NAME(i))) - for(x = 0; x <= TUR_CONFIG_COUNT; ++x) - { TUR_CONFIG_WRITETOFILE(tur_config_queue[x]) } + TUR_CONFIG_WRITETOFILE(sprintf("// {{{ #%d: %s\n", i, it.turret_name)) + for(int j = 0; j <= TUR_CONFIG_COUNT; ++j) + TUR_CONFIG_WRITETOFILE(config_queue[j]) TUR_CONFIG_WRITETOFILE("// }}}\n") // step 5: debug info - LOG_INFO(sprintf("#%d: %s: %d settings...\n", i, TUR_NAME(i), TUR_CONFIG_COUNT)); + LOG_INFOF("#%d: %s: %d settings...", i, it.turret_name, TUR_CONFIG_COUNT); totalsettings += TUR_CONFIG_COUNT; - } + }); // clear queue now that we're finished TUR_CONFIG_COUNT = 0; - for(x = 0; x <= MAX_TUR_CONFIG; ++x) - { tur_config_queue[x] = string_null; } + for(int j = 0; j <= MAX_CONFIG_SETTINGS; ++j) + config_queue[j] = string_null; // extra information - LOG_INFO(sprintf("Totals: %d turrets, %d settings\n", (i - 1), totalsettings)); + LOG_INFOF("Totals: %d turrets, %d settings", (Turrets_COUNT - 1), totalsettings); } + +#endif