========================================================= don't call this directly, it should only be called from SV_Map_f() or SV_MapTransition_f()
| 46 | // don't call this directly, it should only be called from SV_Map_f() or SV_MapTransition_f() |
| 47 | // |
| 48 | static bool SV_Map_( ForceReload_e eForceReload ) |
| 49 | { |
| 50 | char *map = NULL; |
| 51 | char expanded[MAX_QPATH] = {0}; |
| 52 | |
| 53 | map = Cmd_Argv(1); |
| 54 | if ( !*map ) { |
| 55 | Com_Printf ("no map specified\n"); |
| 56 | return false; |
| 57 | } |
| 58 | |
| 59 | // make sure the level exists before trying to change, so that |
| 60 | // a typo at the server console won't end the game |
| 61 | if (strchr (map, '\\') ) { |
| 62 | Com_Printf ("Can't have mapnames with a \\\n"); |
| 63 | return false; |
| 64 | } |
| 65 | |
| 66 | Com_sprintf (expanded, sizeof(expanded), "maps/%s.bsp", map); |
| 67 | |
| 68 | if ( FS_ReadFile (expanded, NULL) == -1 ) { |
| 69 | Com_Printf ("Can't find map %s\n", expanded); |
| 70 | extern cvar_t *com_buildScript; |
| 71 | if (com_buildScript && com_buildScript->integer) |
| 72 | {//yes, it's happened, someone deleted a map during my build... |
| 73 | Com_Error( ERR_FATAL, "Can't find map %s\n", expanded ); |
| 74 | } |
| 75 | return false; |
| 76 | } |
| 77 | |
| 78 | if (map[0]!='_') |
| 79 | { |
| 80 | SG_WipeSavegame("auto"); |
| 81 | } |
| 82 | |
| 83 | SV_SpawnServer( map, eForceReload, qtrue ); // start up the map |
| 84 | return true; |
| 85 | } |
| 86 | |
| 87 | |
| 88 |
no test coverage detected