================== Session_Map_f Restart the server on a different map ================== */
| 104 | ================== |
| 105 | */ |
| 106 | static void Session_Map_f( const idCmdArgs &args ) { |
| 107 | idStr map, string; |
| 108 | findFile_t ff; |
| 109 | idCmdArgs rl_args; |
| 110 | |
| 111 | map = args.Argv(1); |
| 112 | if ( !map.Length() ) { |
| 113 | // DG: if the map command is called without any arguments, print the current map |
| 114 | // TODO: could check whether we're currently in a game, otherwise the last loaded |
| 115 | // map is printed.. but OTOH, who cares |
| 116 | const char* curmap = sessLocal.mapSpawnData.serverInfo.GetString( "si_map" ); |
| 117 | if ( curmap[0] != '\0' ) { |
| 118 | common->Printf( "Current Map: %s\n", curmap ); |
| 119 | } |
| 120 | return; |
| 121 | } |
| 122 | map.StripFileExtension(); |
| 123 | |
| 124 | // make sure the level exists before trying to change, so that |
| 125 | // a typo at the server console won't end the game |
| 126 | // handle addon packs through reloadEngine |
| 127 | sprintf( string, "maps/%s.map", map.c_str() ); |
| 128 | ff = fileSystem->FindFile( string, true ); |
| 129 | switch ( ff ) { |
| 130 | case FIND_NO: |
| 131 | common->Printf( "Can't find map %s\n", string.c_str() ); |
| 132 | return; |
| 133 | case FIND_ADDON: |
| 134 | common->Printf( "map %s is in an addon pak - reloading\n", string.c_str() ); |
| 135 | rl_args.AppendArg( "map" ); |
| 136 | rl_args.AppendArg( map ); |
| 137 | cmdSystem->SetupReloadEngine( rl_args ); |
| 138 | return; |
| 139 | default: |
| 140 | break; |
| 141 | } |
| 142 | |
| 143 | cvarSystem->SetCVarBool( "developer", false ); |
| 144 | sessLocal.StartNewGame( map, true ); |
| 145 | } |
| 146 | |
| 147 | /* |
| 148 | ================== |
nothing calls this directly
no test coverage detected