#define WEAPONSTATS_GETINDEX(awep,abot,vwep,vbot) (((vwep) + (awep) * (WEP_LAST - WEP_FIRST + 1) - (WEP_FIRST + WEP_FIRST * (WEP_LAST - WEP_FIRST + 1))) * 4 + (abot) * 2 + (vbot))
-string WeaponStats_prefix;
void WeaponStats_ready(entity fh, entity pass, float status)
{
- float i, j, ibot, jbot, idx;
+ float i, j, n, ibot, jbot, idx;
vector v;
- string prefix;
+ string prefix, s;
switch(status)
{
case URL_READY_CANWRITE:
+ // url_fopen returned, 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("#config ", ftos(crc16(FALSE, cvar_changes)), "\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("#cvar_purechanges ", ftos(cvar_purechanges_count), "\n"));
+ n = tokenizebyseparator(cvar_purechanges, "\n");
+ for(i = 0; i < n; ++i)
+ url_fputs(fh, strcat("#cvar_purechange ", argv(i), "\n"));
for(i = WEP_FIRST; i <= WEP_LAST; ++i) for(ibot = 0; ibot <= 1; ++ibot)
for(j = WEP_FIRST; j <= WEP_LAST; ++j) for(jbot = 0; jbot <= 1; ++jbot)
{
weaponstats_buffer = -1;
break;
case URL_READY_CANREAD:
- print("Got response from weapon stats server\n");
+ // 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");
+ while((s = url_fgets(fh)))
+ print(" ", s, "\n");
+ print("End of response.\n");
url_fclose(fh, WeaponStats_ready, world);
break;
case URL_READY_CLOSED:
+ // url_fclose has finished
print("Weapon stats written\n");
break;
case URL_READY_ERROR: