pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] CVS: Games/Pingus/src/worldmap PingusWorldMapNode.cc,1.3,1.


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src/worldmap PingusWorldMapNode.cc,1.3,1.4 PingusWorldMapNode.hh,1.2,1.3
Date: 8 Jun 2002 16:36:22 -0000

Update of /usr/local/cvsroot/Games/Pingus/src/worldmap
In directory dark:/tmp/cvs-serv13753/worldmap

Modified Files:
        PingusWorldMapNode.cc PingusWorldMapNode.hh 
Log Message:
Removed the last occurancies of boost::shared_ptr<Pingu> and  
boost::shared_ptr<PLF>

Index: PingusWorldMapNode.cc
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/PingusWorldMapNode.cc,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- PingusWorldMapNode.cc       6 Jun 2002 14:05:44 -0000       1.3
+++ PingusWorldMapNode.cc       8 Jun 2002 16:36:20 -0000       1.4
@@ -65,6 +65,7 @@
     invalid_dot ("worldmap/dot_invalid", "core"),
     dot_border ("Game/dot_border", "game"),
     green_flag ("worldmap/flaggreen", "core"),
+    plf (0),
     invalid (false)
 {
   //accessible = false;
@@ -75,6 +76,22 @@
   invalid_dot.set_align_center ();
   red_dot.set_align_center ();
   dot_border.set_align_center ();
+
+  try 
+    {
+      plf = new XMLPLF (path_manager.complete (levelname));
+    } 
+  catch (PingusError& e) 
+    {
+      std::cout << "PingusWorldMapGraph: Caught PingusError (" << 
e.get_message () << ")" << std::endl;
+      std::cout << "PingusWorldMapGraph: Failed to load '" << levelname << "', 
fallback to level1.xml" << std::endl;
+      invalid = true;
+    }
+}
+
+LevelNode::~LevelNode ()
+{
+  delete plf;
 }
 
 void 
@@ -86,6 +103,7 @@
        std::cout << "Start a level...: " << levelname << std::endl;
                  
       PingusSound::play_sound(path_manager.complete("sounds/letsgo.wav"));
+      /** We could reuse the plf here */
       PingusGameSession game (path_manager.complete(levelname));
       
       // Launch the game and wait until it is finished
@@ -141,38 +159,15 @@
 std::string
 LevelNode::get_string ()
 {
-  boost::shared_ptr<PLF> plf = get_plf ();
-  
   if (!invalid)
     return System::translate(plf->get_levelname ());
   else
     return _("invalid level");
 }
 
-boost::shared_ptr<PLF>
+PLF*
 LevelNode::get_plf ()
 {
-  if (plf.get () == 0)
-    {
-      if (!invalid) 
-       {
-         //console << "Loading " << levelname << std::endl;
-         try {
-           plf = boost::shared_ptr<PLF> (new XMLPLF (path_manager.complete 
(levelname)));
-         } catch (PingusError& e) {
-           std::cout << "PingusWorldMapGraph: Caught PingusError (" << 
e.get_message () << ")" << std::endl;
-           std::cout << "PingusWorldMapGraph: Failed to load '" << levelname 
<< "', fallback to level1.xml" << std::endl;
-           //plf = boost::shared_ptr<PLF> (new XMLPLF (path_manager.complete 
("levels/level1.xml")));
-           invalid = true;
-           return boost::shared_ptr<PLF>();
-         }
-       }
-      else
-       {
-         return boost::shared_ptr<PLF>();
-       }
-    }
-  
   return plf;
 }
 

Index: PingusWorldMapNode.hh
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/PingusWorldMapNode.hh,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- PingusWorldMapNode.hh       6 Jun 2002 09:34:28 -0000       1.2
+++ PingusWorldMapNode.hh       8 Jun 2002 16:36:20 -0000       1.3
@@ -86,7 +86,7 @@
       Sprite dot_border;
       Sprite green_flag;
 
-      boost::shared_ptr<PLF> plf;
+      PLF* plf;
   
       /** true if the level is invalid, which means that the levelfile
          could not be loaded or had errors. false is the default */
@@ -94,9 +94,10 @@
 
     public:
       bool finished;
-      boost::shared_ptr<PLF> get_plf ();
+      PLF* get_plf ();
 
       LevelNode (const LevelNodeData&);
+      virtual ~LevelNode ();
       void on_click ();
       void mark (bool value);
       void draw (CL_Vector offset);




reply via email to

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