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 groundpiece_window.cxx,1.5,1.6


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src/editor groundpiece_window.cxx,1.5,1.6 object_manager.cxx,1.22,1.23 object_manager.hxx,1.14,1.15 selection.cxx,1.8,1.9
Date: 3 Jul 2002 09:53:35 -0000

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

Modified Files:
        groundpiece_window.cxx object_manager.cxx object_manager.hxx 
        selection.cxx 
Log Message:
- fixed sorting bug in editor
- added verify function for editorobj*

Index: groundpiece_window.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/groundpiece_window.cxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- groundpiece_window.cxx      1 Jul 2002 09:09:31 -0000       1.5
+++ groundpiece_window.cxx      3 Jul 2002 09:53:32 -0000       1.6
@@ -92,6 +92,8 @@
 void
 GroundpieceWindow::write_data ()
 {
+  std::cout << "FIXME: GroundpieceWindow::write_data (): this will crash if 
the object gets deleted" << std::endl;
+
   if (ground_radiobutton.is_checked ())
     data->gptype = GroundpieceData::GP_GROUND;
   else if (transparent_radiobutton.is_checked ())

Index: object_manager.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/object_manager.cxx,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- object_manager.cxx  2 Jul 2002 16:06:51 -0000       1.22
+++ object_manager.cxx  3 Jul 2002 09:53:32 -0000       1.23
@@ -145,7 +145,7 @@
     editor_objs.insert(editor_objs.end(), temp.begin(), temp.end() );
   }
 
-  std::sort(editor_objs.begin (), editor_objs.end (), EditorObj_z_pos_sorter);
+  std::stable_sort(editor_objs.begin (), editor_objs.end (), 
EditorObj_z_pos_sorter);
 
   std::cout << "Reading props" << std::endl;
   description = plf->get_description();
@@ -322,6 +322,8 @@
 EditorObj*
 ObjectManager::find_object(const CL_Vector& pos)
 {
+  // We go reverse about the list, since the top-most object is the
+  // last in the list
   for(EditorObjRIter i = editor_objs.rbegin(); i != editor_objs.rend(); ++i) 
     {
       if ((*i)->is_over(pos))
@@ -369,6 +371,12 @@
 ObjectManager::set_height(int arg_height)
 {
   height = arg_height;
+}
+
+bool
+ObjectManager::has_object (EditorObj* obj)
+{
+  return std::find (editor_objs.begin (), editor_objs.end (), obj) != 
editor_objs.end ();
 }
 
 /* EOF */

Index: object_manager.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/object_manager.hxx,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- object_manager.hxx  2 Jul 2002 16:06:51 -0000       1.14
+++ object_manager.hxx  3 Jul 2002 09:53:32 -0000       1.15
@@ -140,6 +140,11 @@
   EditorObj* find_object(const CL_Vector & pos);
 
   std::vector<ActionData>* get_actions ();
+
+  /** Returns false if object is no longer valid. This one is needed
+      to varify that an referenc to and object is still valid and that
+      the object has not yet been deleted */
+  bool has_object (EditorObj* obj);
 };
 
 #endif

Index: selection.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/selection.cxx,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- selection.cxx       2 Jul 2002 09:21:03 -0000       1.8
+++ selection.cxx       3 Jul 2002 09:53:32 -0000       1.9
@@ -150,6 +150,7 @@
 void
 EditorSelection::draw(EditorView * view)
 {
+  
   for (vector<EditorObj*>::iterator i = obj_list.begin(); i != obj_list.end(); 
++i) 
     {
       (*i)->draw_mark(view);




reply via email to

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