X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fgamecommand.qc;h=c2b986bb889a9ebd3afb64a87cd2bd325f9f92ba;hb=cf8ffbe3d9d3bb3f533873350a63cb72ee802022;hp=60c7199a65c0e4a00a4711190f5d3a1243a73c37;hpb=3dc45de9e7ca647cdf10ec7aa422805b2e38d74d;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/gamecommand.qc b/qcsrc/common/gamecommand.qc index 60c7199a6..c2b986bb8 100644 --- a/qcsrc/common/gamecommand.qc +++ b/qcsrc/common/gamecommand.qc @@ -191,6 +191,8 @@ float GameCommand_Generic(string command) print(" s localtime -----------------------> s : formats the current local time\n"); print(" s gmtime --------------------------> s : formats the current UTC time\n"); print(" time ------------------------------> f : seconds since VM start\n"); + print(" s /MD4 digest ---------------------> s : MD4 digest\n"); + print(" s /SHA256 digest ------------------> s : SHA256 digest\n"); print(" Set operations operate on 'such''strings'.\n"); print(" Unknown tokens insert their cvar value.\n"); print(" maplist add map\n"); @@ -210,10 +212,8 @@ float GameCommand_Generic(string command) { if(argv(1) == "add" && argc == 3) { - f = fopen(strcat("maps/", argv(2), ".bsp"), FILE_READ); - if(f != -1) - fclose(f); - else { + if (!fexists(strcat("maps/", argv(2), ".bsp"))) + { print("maplist: ERROR: ", argv(2), " does not exist!\n"); return TRUE; } @@ -314,7 +314,7 @@ float GameCommand_Generic(string command) } else if(argc >= 3 && crc16(0, argv(0)) == 3826 && crc16(0, strcat(argv(0), argv(0), argv(0))) == 55790) { - // test case for terrencehill's color codes + // test case for terencehill's color codes s = strdecolorize(substring(command, argv_start_index(2), argv_end_index(-1) - argv_start_index(2))); s2 = ""; @@ -771,10 +771,8 @@ float GameCommand_Generic(string command) s = rpn_pop(); if(!rpn_error) { - f = fopen(s, FILE_READ); - if(f != -1) - fclose(f); - else { + if (!fexists(s)) + { print("rpn: ERROR: ", s, " does not exist!\n"); rpn_error = TRUE; } @@ -783,13 +781,10 @@ float GameCommand_Generic(string command) s = rpn_get(); if(!rpn_error) { - f = fopen(s, FILE_READ); - if(f != -1) { - fclose(f); + if (fexists(s)) rpn_setf(1); - } else { + else rpn_setf(0); - } } } else if(rpncmd == "localtime") { rpn_set(strftime(TRUE, rpn_get())); @@ -797,6 +792,9 @@ float GameCommand_Generic(string command) rpn_set(strftime(FALSE, rpn_get())); } else if(rpncmd == "time") { rpn_pushf(time); + } else if(rpncmd == "digest") { + s = rpn_pop(); + rpn_set(digest_hex(s, rpn_get())); } else { rpn_push(cvar_string(rpncmd)); }