pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] CVS: Games/Pingus/src pingus_menu_manager.cxx,1.3,1.4 pingu


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src pingus_menu_manager.cxx,1.3,1.4 pingus_menu_manager.hxx,1.2,1.3 surface_button.cxx,1.3,1.4
Date: 29 Jul 2002 22:29:24 -0000

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

Modified Files:
        pingus_menu_manager.cxx pingus_menu_manager.hxx 
        surface_button.cxx 
Log Message:
crash bug fix in the menu code

Index: pingus_menu_manager.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingus_menu_manager.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- pingus_menu_manager.cxx     29 Jul 2002 22:17:53 -0000      1.3
+++ pingus_menu_manager.cxx     29 Jul 2002 22:29:22 -0000      1.4
@@ -152,10 +152,14 @@
       if (delta > 1.0)
        delta = 0;
 
-      for (MenuStackIter i = menu_stack.begin (); i != menu_stack.end (); ++i)
+      // We copy the menu_stack so that we don't invalidate our
+      // iterators when menu's are removed/added in update()
+      std::vector<PingusSubMenu *> tmp_menu_stack = menu_stack;
+
+      for (MenuStackIter i = tmp_menu_stack.begin (); i != tmp_menu_stack.end 
(); ++i)
        (*i)->draw ();
 
-      for (MenuStackIter i = menu_stack.begin (); i != menu_stack.end (); ++i)
+      for (MenuStackIter i = tmp_menu_stack.begin (); i != tmp_menu_stack.end 
(); ++i)
        (*i)->update (delta);
       
       Display::flip_display ();

Index: pingus_menu_manager.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingus_menu_manager.hxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- pingus_menu_manager.hxx     24 Jun 2002 22:52:55 -0000      1.2
+++ pingus_menu_manager.hxx     29 Jul 2002 22:29:22 -0000      1.3
@@ -33,15 +33,12 @@
 {
 private:
   /** Menu stack. the menu on top is .end (), the bottom menu .begin () */
-  std::list<PingusSubMenu *> menu_stack;
-  typedef std::list<PingusSubMenu *>::iterator MenuStackIter;
-  typedef std::list<PingusSubMenu *>::reverse_iterator MenuStackRIter;
+  std::vector<PingusSubMenu *> menu_stack;
+  typedef std::vector<PingusSubMenu *>::iterator MenuStackIter;
+  typedef std::vector<PingusSubMenu *>::reverse_iterator MenuStackRIter;
 
   bool loop;
 
-  CL_Slot on_mouse_move_slot;
-  CL_Slot on_button_press_slot;
-  CL_Slot on_button_release_slot;
   int event_register_counter;
   
   /// Register all event-handling stuff

Index: surface_button.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/surface_button.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- surface_button.cxx  29 Jul 2002 22:17:53 -0000      1.3
+++ surface_button.cxx  29 Jul 2002 22:29:22 -0000      1.4
@@ -360,8 +360,9 @@
 StoryButton::on_click()
 {
   PingusSound::play_sound ("sounds/letsgo.wav");
-  
+  std::cout << "Set story" << std::endl;
   menu->get_manager ()->set_menu (&menu->get_manager ()->story);
+  std::cout << "Set done" << std::endl;
 }
 
 ThemeButton::ThemeButton (PingusMenu* menu)




reply via email to

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