MCPcopy Create free account
hub / github.com/JACoders/OpenJK / SV_Map_

Function SV_Map_

code/server/sv_ccmds.cpp:48–85  ·  view source on GitHub ↗

========================================================= don't call this directly, it should only be called from SV_Map_f() or SV_MapTransition_f()

Source from the content-addressed store, hash-verified

46// don't call this directly, it should only be called from SV_Map_f() or SV_MapTransition_f()
47//
48static 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

Callers 3

SV_MapTransition_fFunction · 0.85
SV_Map_fFunction · 0.85
SV_LoadTransition_fFunction · 0.85

Calls 7

SG_WipeSavegameFunction · 0.85
SV_SpawnServerFunction · 0.70
Cmd_ArgvFunction · 0.50
Com_PrintfFunction · 0.50
Com_sprintfFunction · 0.50
FS_ReadFileFunction · 0.50
Com_ErrorFunction · 0.50

Tested by

no test coverage detected