X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Fgamecommand.qc;h=518cf74971a645dde3c412c1a1eaabee9b5ae1b8;hp=60c7199a65c0e4a00a4711190f5d3a1243a73c37;hb=80811920732c5756699249adb24ed8d241699d73;hpb=0a5f730751cf4a7f6ce555ef920fe9fdcd8e59ac diff --git a/qcsrc/common/gamecommand.qc b/qcsrc/common/gamecommand.qc index 60c7199a65..518cf74971 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; } @@ -314,7 +312,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 +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()));