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 ObjectManager.cc,1.64,1.65


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src/editor ObjectManager.cc,1.64,1.65
Date: 10 Jun 2002 10:32:05 -0000

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

Modified Files:
        ObjectManager.cc 
Log Message:
fixed std::list::sort for MSVC6

Index: ObjectManager.cc
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/ObjectManager.cc,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -d -r1.64 -r1.65
--- ObjectManager.cc    9 Jun 2002 13:03:11 -0000       1.64
+++ ObjectManager.cc    10 Jun 2002 10:32:03 -0000      1.65
@@ -38,15 +38,23 @@
 using namespace std;
 
 /** */
-class EditorObj_z_pos_sorter
+static bool EditorObj_z_pos_sorter (const boost::shared_ptr<EditorObj>& a, 
+                                   const boost::shared_ptr<EditorObj>& b)
 {
-public:
-  bool operator() (const boost::shared_ptr<EditorObj>& a, 
-                  const boost::shared_ptr<EditorObj>& b) const 
-  {
-    return a->get_z_pos () < b->get_z_pos ();
-  }
-};
+  return a->get_z_pos () < b->get_z_pos ();
+}
+
+#ifdef WIN32
+//FIXME: ingo: This is a workaround around the std::list::sort()
+//FIXME: problem under MSVC6. This is copy&paste from an usenet
+//FIXME: article, so it might work or not, never tested it.
+typedef boost::shared_ptr<EditorObj>& CEditorObjPtr;
+template<>
+bool std::greater<CEditorObjPtr>::operator()(shared_ptr<EditorObj>& a, 
shared_ptr<EditorObj>& b) const
+{
+  return EditorObj_z_pos_sorter (a, b);
+} 
+#endif
 
 ObjectManager::ObjectManager()
 {
@@ -172,8 +180,13 @@
     editor_objs.insert(editor_objs.end(), temp.begin(), temp.end() );
   }
 
-#ifndef WIN32 // FIXME: Compiler error in Windows
-  editor_objs.sort(EditorObj_z_pos_sorter());
+#ifdef WIN32
+//FIXME: ingo: This is a workaround around the std::list::sort()
+//FIXME: problem under MSVC6. This is copy&paste from an usenet
+//FIXME: article, so it might work or not, never tested it.
+  world_obj.sort(std::greater<CWorldObjPtr>());
+#else
+  editor_objs.sort(EditorObj_z_pos_sorter);
 #endif
 
   std::cout << "Reading props" << std::endl;




reply via email to

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