コード例 #1
0
ファイル: sv_ccmds.cpp プロジェクト: CairnTrenor/OpenJK
//=========================================================
// don't call this directly, it should only be called from SV_Map_f() or SV_MapTransition_f()
//
static void SV_Map_( ForceReload_e eForceReload ) 
{
	char	*map;
	char	expanded[MAX_QPATH];

	map = Cmd_Argv(1);
	if ( !*map ) {
		return;
	}

	// make sure the level exists before trying to change, so that
	// a typo at the server console won't end the game
	if (strchr (map, '\\') ) {
		Com_Printf ("Can't have mapnames with a \\\n");
		return;
	}
	
	Com_sprintf (expanded, sizeof(expanded), "maps/%s.bsp", map);
	if ( FS_ReadFile (expanded, NULL) == -1 ) {
		Com_Printf ("Can't find map %s\n", expanded);
		return;
	}
	
	if (map[0]!='_')
	{
		SG_WipeSavegame("auto");
	}

	SP_Unload(SP_REGISTER_CLIENT);	//clear the previous map srings

	SV_SpawnServer( map, eForceReload, qtrue );	// start up the map
}
コード例 #2
0
ファイル: common.cpp プロジェクト: CairnTrenor/OpenJK
void QDECL Com_Error( int code, const char *fmt, ... ) {
	va_list		argptr;

	// when we are running automated scripts, make sure we
	// know if anything failed
	if ( com_buildScript && com_buildScript->integer ) {
		code = ERR_FATAL;
	}

	if ( com_errorEntered ) {
		Sys_Error( "recursive error after: %s", com_errorMessage );
	}
	
	com_errorEntered = qtrue;

	//reset some game stuff here
//	SCR_UnprecacheScreenshot();

	va_start (argptr,fmt);
	Q_vsnprintf (com_errorMessage, sizeof(com_errorMessage), fmt, argptr);
	va_end (argptr);	

	if ( code != ERR_DISCONNECT ) {
		Cvar_Get("com_errorMessage", "", CVAR_ROM);	//give com_errorMessage a default so it won't come back to life after a resetDefaults
		Cvar_Set("com_errorMessage", com_errorMessage);
	}

	SG_Shutdown();				// close any file pointers
	if ( code == ERR_DISCONNECT ) {
		SV_Shutdown("Disconnect", qtrue);
		CL_Disconnect();
		CL_FlushMemory();
		CL_StartHunkUsers();
		com_errorEntered = qfalse;
		throw ("DISCONNECTED\n");
	} else if ( code == ERR_DROP ) {
		// If loading/saving caused the crash/error - delete the temp file
		SG_WipeSavegame("current");	// delete file

		SV_Shutdown (va("Server crashed: %s\n",  com_errorMessage), qtrue);
		CL_Disconnect();
		CL_FlushMemory();
		CL_StartHunkUsers();
		Com_Printf (S_COLOR_RED"********************\n"S_COLOR_MAGENTA"ERROR: %s\n"S_COLOR_RED"********************\n", com_errorMessage);
		com_errorEntered = qfalse;
		throw ("DROPPED\n");
	} else {
		CL_Shutdown ();
		SV_Shutdown (va(S_COLOR_RED"Server fatal crashed: %s\n", com_errorMessage), qtrue);
	}

	Com_Shutdown ();

	Sys_Error ("%s", com_errorMessage);
}
コード例 #3
0
ファイル: sv_savegame.cpp プロジェクト: Fighter19/OpenJK
void SV_WipeGame_f(void)
{
	if (Cmd_Argc() != 2)
	{
		Com_Printf (S_COLOR_RED "USAGE: wipe <name>\n");
		return;
	}
	if (!Q_stricmp (Cmd_Argv(1), "auto") )
	{
		Com_Printf (S_COLOR_RED "Can't wipe 'auto'\n");
		return;
	}
	SG_WipeSavegame(Cmd_Argv(1));
//	Com_Printf("%s has been wiped\n", Cmd_Argv(1));	// wurde gelöscht in german, but we've only got one string
//	Com_Printf("Ok\n"); // no localization of this
}
コード例 #4
0
ファイル: sv_ccmds.cpp プロジェクト: Ichimoto/OpenJK
//=========================================================
// don't call this directly, it should only be called from SV_Map_f() or SV_MapTransition_f()
//
static bool SV_Map_( ForceReload_e eForceReload ) 
{
	char	*map;
	char	expanded[MAX_QPATH];

	map = Cmd_Argv(1);
	if ( !*map ) {
		Com_Printf ("no map specified\n");
		return false;
	}

	// make sure the level exists before trying to change, so that
	// a typo at the server console won't end the game
	if (strchr (map, '\\') ) {
		Com_Printf ("Can't have mapnames with a \\\n");
		return false;
	}

#ifndef _XBOX	// Could check for maps/%s/brushes.mle or something...
	Com_sprintf (expanded, sizeof(expanded), "maps/%s.bsp", map);

#ifndef _DEBUG
	Com_Printf("SV_Map_ CHECK HERE: %s\n", expanded);
#endif
	if ( FS_ReadFile (expanded, NULL) == -1 ) {
		Com_Printf ("Can't find map %s\n", expanded);
		extern	cvar_t	*com_buildScript;
		if (com_buildScript && com_buildScript->integer)
		{//yes, it's happened, someone deleted a map during my build...
			Com_Error( ERR_FATAL, "Can't find map %s\n", expanded );
		}
		return false;
	}
#endif

	if (map[0]!='_')
	{
		SG_WipeSavegame("auto");
	}

#ifndef _DEBUG
	Com_Printf("SV_SpawnServer call: %s\n", map);
#endif

	SV_SpawnServer( map, eForceReload, qtrue );	// start up the map
	return true;
}
コード例 #5
0
ファイル: sv_savegame.cpp プロジェクト: Fighter19/OpenJK
static qboolean SG_Create( const char *psPathlessBaseName )
{
	gbSGWriteFailed = qfalse;

	SG_WipeSavegame( psPathlessBaseName );
	const char *psLocalFilename = SG_AddSavePath( psPathlessBaseName );
	fhSaveGame = FS_FOpenFileWrite( psLocalFilename );

	if(!fhSaveGame)
	{
		Com_Printf(GetString_FailedToOpenSaveGame(psLocalFilename,qfalse));//S_COLOR_RED "Failed to create new savegame file \"%s\"\n", psLocalFilename );
		return qfalse;
	}

	giSaveGameVersion = iSAVEGAME_VERSION;
	SG_Append(INT_ID('_','V','E','R'), &giSaveGameVersion, sizeof(giSaveGameVersion));

	return qtrue;
}
コード例 #6
0
ファイル: common.cpp プロジェクト: Aura15/OpenJK
static void Com_CatchError ( int code )
{
	if ( code == ERR_DISCONNECT ) {
		SV_Shutdown( "Server disconnected" );
		CL_Disconnect( );
		CL_FlushMemory(  );
		com_errorEntered = qfalse;
	} else if ( code == ERR_DROP ) {
		// If loading/saving caused the crash/error - delete the temp file
		SG_WipeSavegame("current");	// delete file

		Com_Printf ("********************\n"
					"ERROR: %s\n"
					"********************\n", com_errorMessage);
		SV_Shutdown (va("Server crashed: %s\n",  com_errorMessage));
		CL_Disconnect( );
		CL_FlushMemory( );
		com_errorEntered = qfalse;
	}
}