From: Mario Date: Tue, 20 Feb 2018 07:02:37 +0000 (+1000) Subject: Clean up MapHasRightSize a tiny bit X-Git-Tag: xonotic-v0.8.5~2293 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=203540c5c95db969257b62229120cb9cf36846d1;p=xonotic%2Fxonotic-data.pk3dir.git Clean up MapHasRightSize a tiny bit --- diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 8dffcaf09..a3bb6eb21 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -990,45 +990,43 @@ float GetMaplistPosition() return idx; } -float MapHasRightSize(string map) +bool MapHasRightSize(string map) { - float fh; if(currentbots || autocvar_bot_number || player_count < autocvar_minplayers) if(autocvar_g_maplist_check_waypoints) { - LOG_TRACE("checkwp "); LOG_TRACE(map); + string checkwp_msg = strcat("checkwp ", map); if(!fexists(strcat("maps/", map, ".waypoints"))) { - LOG_TRACE(": no waypoints"); + LOG_TRACE(checkwp_msg, ": no waypoints"); return false; } - LOG_TRACE(": has waypoints"); + LOG_TRACE(checkwp_msg, ": has waypoints"); } // open map size restriction file - LOG_TRACE("opensize "); LOG_TRACE(map); - fh = fopen(strcat("maps/", map, ".sizes"), FILE_READ); + string opensize_msg = strcat("opensize ", map); + float fh = fopen(strcat("maps/", map, ".sizes"), FILE_READ); if(fh >= 0) { - float mapmin, mapmax; - LOG_TRACE(": ok, "); - mapmin = stof(fgets(fh)); - mapmax = stof(fgets(fh)); + opensize_msg = strcat(opensize_msg, ": ok, "); + int mapmin = stoi(fgets(fh)); + int mapmax = stoi(fgets(fh)); fclose(fh); if(player_count < mapmin) { - LOG_TRACE("not enough"); + LOG_TRACE(opensize_msg, "not enough"); return false; } if(mapmax && player_count > mapmax) { - LOG_TRACE("too many"); + LOG_TRACE(opensize_msg, "too many"); return false; } - LOG_TRACE("right size"); + LOG_TRACE(opensize_msg, "right size"); return true; } - LOG_TRACE(": not found"); + LOG_TRACE(opensize_msg, ": not found"); return true; }