]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/turrets/config.qh
Fix #2199 "sv_cmd dumpturrets doesn't work". The new implementation is similar to...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / turrets / config.qh
index bb2a81b847eb740251b5ba126335dfd8295e5e49..2c47be09116de219715ec4c3bc9714d07972ed44 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef TURRETS_CONFIG_H
-#define TURRETS_CONFIG_H
+#pragma once
 
 #ifdef SVQC
 
@@ -7,15 +6,21 @@ void Dump_Turret_Settings();
 float tur_config_file;
 float tur_config_alsoprint;
 
-const int MAX_TUR_CONFIG = 256;
 float TUR_CONFIG_COUNT;
-string tur_config_queue[MAX_TUR_CONFIG];
+#define TUR_CONFIG_QUEUE(a) { \
+       config_queue[TUR_CONFIG_COUNT] = a; \
+       ++TUR_CONFIG_COUNT; }
 
-#define TUR_CONFIG_WRITETOFILE(a) { \
-       fputs(tur_config_file, a); \
-       if(tur_config_alsoprint) { LOG_INFO(a); } }
+#define TUR_CONFIG_WRITE_CVARS(turname, name, T) TUR_CONFIG_WRITE_PROPS_##T(turname, name)
 
+#define TUR_CONFIG_WRITE_PROPS_string(turname, name) \
+       { TUR_CONFIG_QUEUE( \
+               sprintf("set g_turrets_unit_%s_%s \"%s\"\n", #turname, #name, \
+               cvar_string(sprintf("g_turrets_unit_%s_%s", #turname, #name)))) }
 
-#endif
+#define TUR_CONFIG_WRITE_PROPS_float(turname, name) \
+       { TUR_CONFIG_QUEUE( \
+               sprintf("set g_turrets_unit_%s_%s %g\n", #turname, #name, \
+               cvar(sprintf("g_turrets_unit_%s_%s", #turname, #name)))) }
 
 #endif