X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fgamecommand.qc;h=518cf74971a645dde3c412c1a1eaabee9b5ae1b8;hb=d35163384e381a67cec96e8e54b9595762eed8ab;hp=f6b54f155b842e6ff683ad236bfb7463f8d785ae;hpb=57574d20e9aa4cf305e28e2cd4b7749dabe4f8ea;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/gamecommand.qc b/qcsrc/common/gamecommand.qc index f6b54f155..518cf7497 100644 --- a/qcsrc/common/gamecommand.qc +++ b/qcsrc/common/gamecommand.qc @@ -210,10 +210,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; } @@ -312,9 +310,9 @@ float GameCommand_Generic(string command) return TRUE; } - else if(argc >= 3 && crc16(0, argv(0)) == 3826 && crc16(0, strcat(argv(0), argv(0), argv(0))) == 55970) + 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 +769,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 +779,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()));