-void Map_Snapshot()
-{
- // we need to do the following
- // 1. make sure the snapshot directory exists (create it if it doesn't)
- // 2. find out what the lastest save is based on number
- // 3. inc that and save the map
- const char* path = Map_Name(g_map);
- const char* name = path_get_filename_start(path);
-
- StringOutputStream snapshotsDir(256);
- snapshotsDir << StringRange(path, name) << "snapshots";
-
- if(file_exists(snapshotsDir.c_str()) || Q_mkdir(snapshotsDir.c_str()))
- {
- std::size_t lSize = 0;
- StringOutputStream strNewPath(256);
- strNewPath << snapshotsDir.c_str() << '/' << name;
-
- StringOutputStream snapshotFilename(256);
-
- for(int nCount = 0; ; ++nCount)
- {
- // The original map's filename is "<path>/<name>.<ext>"
- // The snapshot's filename will be "<path>/snapshots/<name>.<count>.<ext>"
- const char* end = path_get_filename_base_end(strNewPath.c_str());
- snapshotFilename << StringRange(strNewPath.c_str(), end) << '.' << nCount << end;
-
- if(!DoesFileExist(snapshotFilename.c_str(), lSize))
- {
- break;
- }
-
- snapshotFilename.clear();
- }
-
- // save in the next available slot
- Map_SaveFile(snapshotFilename.c_str());
-
- if (lSize > 50 * 1024 * 1024) // total size of saves > 50 mb
- {
- globalOutputStream() << "The snapshot files in " << snapshotsDir.c_str() << " total more than 50 megabytes. You might consider cleaning up.";
- }
- }
- else
- {
- StringOutputStream strMsg(256);
- strMsg << "Snapshot save failed.. unabled to create directory\n" << snapshotsDir.c_str();
- gtk_MessageBox(GTK_WIDGET(MainFrame_getWindow()), strMsg.c_str());
- }
+void Map_Snapshot(){
+ // we need to do the following
+ // 1. make sure the snapshot directory exists (create it if it doesn't)
+ // 2. find out what the lastest save is based on number
+ // 3. inc that and save the map
+ const char* path = Map_Name( g_map );
+ const char* name = path_get_filename_start( path );
+
+ StringOutputStream snapshotsDir( 256 );
+ snapshotsDir << StringRange( path, name ) << "snapshots";
+
+ if ( file_exists( snapshotsDir.c_str() ) || Q_mkdir( snapshotsDir.c_str() ) ) {
+ std::size_t lSize = 0;
+ StringOutputStream strNewPath( 256 );
+ strNewPath << snapshotsDir.c_str() << '/' << name;
+
+ StringOutputStream snapshotFilename( 256 );
+
+ for ( int nCount = 0; ; ++nCount )
+ {
+ // The original map's filename is "<path>/<name>.<ext>"
+ // The snapshot's filename will be "<path>/snapshots/<name>.<count>.<ext>"
+ const char* end = path_get_filename_base_end( strNewPath.c_str() );
+ snapshotFilename << StringRange( strNewPath.c_str(), end ) << '.' << nCount << end;
+
+ if ( !DoesFileExist( snapshotFilename.c_str(), lSize ) ) {
+ break;
+ }
+
+ snapshotFilename.clear();
+ }
+
+ // save in the next available slot
+ Map_SaveFile( snapshotFilename.c_str() );
+
+ if ( lSize > 50 * 1024 * 1024 ) { // total size of saves > 50 mb
+ globalOutputStream() << "The snapshot files in " << snapshotsDir.c_str() << " total more than 50 megabytes. You might consider cleaning up.";
+ }
+ }
+ else
+ {
+ StringOutputStream strMsg( 256 );
+ strMsg << "Snapshot save failed.. unabled to create directory\n" << snapshotsDir.c_str();
+ gtk_MessageBox( GTK_WIDGET( MainFrame_getWindow() ), strMsg.c_str() );
+ }