pingus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pingus-CVS] CVS: Games/Pingus/src/editor editor.cxx,1.48,1.49


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src/editor editor.cxx,1.48,1.49
Date: 11 Apr 2003 22:01:56 -0000

Update of /var/lib/cvs/Games/Pingus/src/editor
In directory dark:/tmp/cvs-serv20095/editor

Modified Files:
        editor.cxx 
Log Message:
added rotating files for backups in the editor

Index: editor.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/editor/editor.cxx,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- editor.cxx  30 Mar 2003 13:12:35 -0000      1.48
+++ editor.cxx  11 Apr 2003 22:01:54 -0000      1.49
@@ -45,6 +45,7 @@
 #include "editor.hxx"
 #include "../path_manager.hxx"
 #include "../stat_manager.hxx"
+#include "../string_converter.hxx"
 #include "editor_view.hxx"
 
 #include <cstdio>
@@ -339,7 +340,15 @@
   localtime_r (&t, &current_time);
   strftime (buffer, 32, "%s", &current_time);
 */
-  std::string filename = System::get_backupdir () + "pingus-backup" + ".xml";
+  int backup_id = 0;
+  StatManager::instance()->get_int("next-backup-id", backup_id);
+
+  if (backup_id >= 50)
+    backup_id = 0;
+
+  StatManager::instance()->set_int("next-backup-id", backup_id + 1);
+  
+  std::string filename = System::get_backupdir () + "pingus-backup-" + 
to_string(backup_id) + ".xml";
   std::cout << "Editor: saving backup level to: " << filename << std::endl;
   object_manager->save_level_xml(filename.c_str());
   return filename;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]