mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-17 18:40:02 +00:00
engine: server: simplify game saving code, hide GL_FreeImage under XASH_DEDICATED macro
This commit is contained in:
parent
934dffd273
commit
428e8ef427
@ -498,8 +498,10 @@ static void AgeSaveList( const char *pName, int count )
|
|||||||
FS_Delete( newName );
|
FS_Delete( newName );
|
||||||
FS_Delete( newShot );
|
FS_Delete( newShot );
|
||||||
|
|
||||||
|
#ifndef XASH_DEDICATED
|
||||||
// unloading the shot footprint
|
// unloading the shot footprint
|
||||||
GL_FreeImage( newShot );
|
GL_FreeImage( newShot );
|
||||||
|
#endif // XASH_DEDICATED
|
||||||
|
|
||||||
while( count > 0 )
|
while( count > 0 )
|
||||||
{
|
{
|
||||||
@ -519,8 +521,10 @@ static void AgeSaveList( const char *pName, int count )
|
|||||||
Q_snprintf( newName, sizeof( newName ), "%s%s%02d.sav", DEFAULT_SAVE_DIRECTORY, pName, count );
|
Q_snprintf( newName, sizeof( newName ), "%s%s%02d.sav", DEFAULT_SAVE_DIRECTORY, pName, count );
|
||||||
Q_snprintf( newShot, sizeof( newShot ), "%s%s%02d.bmp", DEFAULT_SAVE_DIRECTORY, pName, count );
|
Q_snprintf( newShot, sizeof( newShot ), "%s%s%02d.bmp", DEFAULT_SAVE_DIRECTORY, pName, count );
|
||||||
|
|
||||||
|
#ifndef XASH_DEDICATED
|
||||||
// unloading the oldshot footprint too
|
// unloading the oldshot footprint too
|
||||||
GL_FreeImage( oldShot );
|
GL_FreeImage( oldShot );
|
||||||
|
#endif // XASH_DEDICATED
|
||||||
|
|
||||||
// scroll the name list down (e.g. rename quick04.sav to quick05.sav)
|
// scroll the name list down (e.g. rename quick04.sav to quick05.sav)
|
||||||
FS_Rename( oldName, newName );
|
FS_Rename( oldName, newName );
|
||||||
@ -529,29 +533,6 @@ static void AgeSaveList( const char *pName, int count )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
==================
|
|
||||||
SaveGetName
|
|
||||||
|
|
||||||
build the savename
|
|
||||||
==================
|
|
||||||
*/
|
|
||||||
static qboolean SaveGetName( int lastnum, char *filename )
|
|
||||||
{
|
|
||||||
int a, b, c;
|
|
||||||
|
|
||||||
if( lastnum < 0 || lastnum > 999 )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
a = lastnum / 100;
|
|
||||||
lastnum -= a * 100;
|
|
||||||
b = lastnum / 10;
|
|
||||||
c = lastnum % 10;
|
|
||||||
|
|
||||||
Q_sprintf( filename, "save%i%i%i", a, b, c );
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
DirectoryCopy
|
DirectoryCopy
|
||||||
@ -2093,7 +2074,7 @@ SV_SaveGame
|
|||||||
void SV_SaveGame( const char *pName )
|
void SV_SaveGame( const char *pName )
|
||||||
{
|
{
|
||||||
char comment[80];
|
char comment[80];
|
||||||
int n, result;
|
int result;
|
||||||
string savename;
|
string savename;
|
||||||
|
|
||||||
if( !COM_CheckString( pName ))
|
if( !COM_CheckString( pName ))
|
||||||
@ -2104,11 +2085,12 @@ void SV_SaveGame( const char *pName )
|
|||||||
|
|
||||||
if( !Q_stricmp( pName, "new" ))
|
if( !Q_stricmp( pName, "new" ))
|
||||||
{
|
{
|
||||||
|
int n;
|
||||||
|
|
||||||
// scan for a free filename
|
// scan for a free filename
|
||||||
for( n = 0; n < 1000; n++ )
|
for( n = 0; n < 1000; n++ )
|
||||||
{
|
{
|
||||||
if( !SaveGetName( n, savename ))
|
Q_snprintf( savename, sizeof( savename ), "save%003d", n );
|
||||||
return;
|
|
||||||
|
|
||||||
if( !FS_FileExists( va( "%s%s.sav", DEFAULT_SAVE_DIRECTORY, savename ), true ))
|
if( !FS_FileExists( va( "%s%s.sav", DEFAULT_SAVE_DIRECTORY, savename ), true ))
|
||||||
break;
|
break;
|
||||||
@ -2122,8 +2104,10 @@ void SV_SaveGame( const char *pName )
|
|||||||
}
|
}
|
||||||
else Q_strncpy( savename, pName, sizeof( savename ));
|
else Q_strncpy( savename, pName, sizeof( savename ));
|
||||||
|
|
||||||
|
#ifndef XASH_DEDICATED
|
||||||
// unload previous image from memory (it's will be overwritten)
|
// unload previous image from memory (it's will be overwritten)
|
||||||
GL_FreeImage( va( "%s%s.bmp", DEFAULT_SAVE_DIRECTORY, savename ));
|
GL_FreeImage( va( "%s%s.bmp", DEFAULT_SAVE_DIRECTORY, savename ));
|
||||||
|
#endif // XASH_DEDICATED
|
||||||
|
|
||||||
SaveBuildComment( comment, sizeof( comment ));
|
SaveBuildComment( comment, sizeof( comment ));
|
||||||
result = SaveGameSlot( savename, comment );
|
result = SaveGameSlot( savename, comment );
|
||||||
@ -2131,7 +2115,7 @@ void SV_SaveGame( const char *pName )
|
|||||||
#ifndef XASH_DEDICATED
|
#ifndef XASH_DEDICATED
|
||||||
if( result && !FBitSet( host.features, ENGINE_QUAKE_COMPATIBLE ))
|
if( result && !FBitSet( host.features, ENGINE_QUAKE_COMPATIBLE ))
|
||||||
CL_HudMessage( "GAMESAVED" ); // defined in titles.txt
|
CL_HudMessage( "GAMESAVED" ); // defined in titles.txt
|
||||||
#endif
|
#endif // XASH_DEDICATED
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user