pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] r3235 - in trunk/pingus: . src/editor


From: jsalmon3
Subject: [Pingus-CVS] r3235 - in trunk/pingus: . src/editor
Date: Sat, 22 Sep 2007 19:21:32 +0200

Author: jsalmon3
Date: 2007-09-22 19:21:25 +0200 (Sat, 22 Sep 2007)
New Revision: 3235

Modified:
   trunk/pingus/TODO
   trunk/pingus/src/editor/editor_level.cpp
   trunk/pingus/src/editor/editor_screen.cpp
Log:
Need to prompt user if save fails

Modified: trunk/pingus/TODO
===================================================================
--- trunk/pingus/TODO   2007-09-22 16:44:23 UTC (rev 3234)
+++ trunk/pingus/TODO   2007-09-22 17:21:25 UTC (rev 3235)
@@ -225,6 +225,8 @@
 
 - Dialogs: Editor Properties: user name and email
 
+- show an error message if save fails
+
 Less Important:
 ===============
 

Modified: trunk/pingus/src/editor/editor_level.cpp
===================================================================
--- trunk/pingus/src/editor/editor_level.cpp    2007-09-22 16:44:23 UTC (rev 
3234)
+++ trunk/pingus/src/editor/editor_level.cpp    2007-09-22 17:21:25 UTC (rev 
3235)
@@ -119,6 +119,9 @@
 
   // Create new file (overwrite existing file)
   std::ofstream out_file(filename.c_str());
+  if (!out_file)
+    return false;
+
   SExprFileWriter fw(out_file);
        
   out_file << ";; -*- scheme -*-" << std::endl;

Modified: trunk/pingus/src/editor/editor_screen.cpp
===================================================================
--- trunk/pingus/src/editor/editor_screen.cpp   2007-09-22 16:44:23 UTC (rev 
3234)
+++ trunk/pingus/src/editor/editor_screen.cpp   2007-09-22 17:21:25 UTC (rev 
3235)
@@ -130,7 +130,10 @@
 {
   level_pathname = file;
   std::cout << "Save to: " << file.str() << std::endl;
-  plf->save_level(level_pathname.get_sys_path());
+  if (!plf->save_level(level_pathname.get_sys_path()))
+    {
+      // FIXME: save failed, prompt user
+    }
 }
 
 // Load a new level
@@ -274,7 +277,11 @@
 EditorScreen::level_play()
 {
   Pathname tmp(System::get_statdir() + "backup/editortmpfile.pingus", 
Pathname::SYSTEM_PATH);
-  plf->save_level(tmp.get_sys_path());
+  if (!plf->save_level(tmp.get_sys_path()))
+    {
+      // FIXME: save failed, prompt user
+      return;
+    }
   PingusLevel level(tmp);
   ScreenManager::instance()->push_screen(new PingusGameSession(level, false), 
true);
 }





reply via email to

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