]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/weapons/weaponstats.qc
Merge branch 'master' into martin-t/mg-solidpen
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / weapons / weaponstats.qc
index d83db8b8228df092b2cced72964a41d54279d9d9..296d10fa6bd0bef9b26f857c6e86ed4db684b9f7 100644 (file)
@@ -1,3 +1,11 @@
+#include "weaponstats.qh"
+
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+#include "../g_world.qh"
+
+#include <common/weapons/_all.qh>
+
 void WeaponStats_Init()
 {
        weaponstats_buffer = ((autocvar_sv_weaponstats_file != "") ? buf_create() : -1);
@@ -14,11 +22,11 @@ void WeaponStats_ready(entity fh, entity pass, float status)
                        // we can write
                        prefix = strcat(autocvar_hostname, "\t", GetGametype(), "_", GetMapname(), "\t");
                        url_fputs(fh, "#begin statsfile\n");
-                       url_fputs(fh, strcat("#date ", strftime(TRUE, "%a %b %e %H:%M:%S %Z %Y"), "\n"));
+                       url_fputs(fh, strcat("#date ", strftime(true, "%a %b %e %H:%M:%S %Z %Y"), "\n"));
 #ifdef WATERMARK
                        url_fputs(fh, strcat("#version ", WATERMARK, "\n"));
 #endif
-                       url_fputs(fh, strcat("#config ", ftos(crc16(FALSE, cvar_purechanges)), "\n"));
+                       url_fputs(fh, strcat("#config ", ftos(crc16(false, cvar_purechanges)), "\n"));
                        url_fputs(fh, strcat("#cvar_purechanges ", ftos(cvar_purechanges_count), "\n"));
                        n = tokenizebyseparator(cvar_purechanges, "\n");
                        for(i = 0; i < n; ++i)
@@ -32,7 +40,7 @@ void WeaponStats_ready(entity fh, entity pass, float status)
                                        {
                                                //vector is: kills hits damage
                                                url_fputs(fh, sprintf("%s%d %d\t%d %d\t", prefix, i, ibot, j, jbot));
-                                               url_fputs(fh, sprintf("%d %d %g\n", v_x, v_y, v_z));
+                                               url_fputs(fh, sprintf("%d %d %g\n", v.x, v.y, v.z));
                                        }
                                }
                        url_fputs(fh, "#end\n\n");
@@ -41,21 +49,21 @@ void WeaponStats_ready(entity fh, entity pass, float status)
                case URL_READY_CANREAD:
                        // url_fclose is processing, we got a response for writing the data
                        // this must come from HTTP
-                       print("Got response from weapon stats server:\n");
+                       LOG_INFO("Got response from weapon stats server:");
                        while((s = url_fgets(fh)))
-                               print("  ", s, "\n");
-                       print("End of response.\n");
+                               LOG_INFO("  ", s);
+                       LOG_INFO("End of response.");
                        url_fclose(fh);
                        break;
                case URL_READY_CLOSED:
                        // url_fclose has finished
-                       print("Weapon stats written\n");
+                       LOG_INFO("Weapon stats written");
                        buf_del(weaponstats_buffer);
                        weaponstats_buffer = -1;
                        break;
                case URL_READY_ERROR:
                default:
-                       print("Weapon stats writing failed: ", ftos(status), "\n");
+                       LOG_INFO("Weapon stats writing failed: ", ftos(status));
                        buf_del(weaponstats_buffer);
                        weaponstats_buffer = -1;
                        break;
@@ -68,7 +76,7 @@ void WeaponStats_Shutdown()
                return;
        if(autocvar_sv_weaponstats_file != "")
        {
-               url_multi_fopen(autocvar_sv_weaponstats_file, FILE_APPEND, WeaponStats_ready, world);
+               url_multi_fopen(autocvar_sv_weaponstats_file, FILE_APPEND, WeaponStats_ready, NULL);
        }
        else
        {