#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, 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"));
+#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");
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: