[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src World.cc,1.72,1.73
From: |
grumbel |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src World.cc,1.72,1.73 |
Date: |
10 Jun 2002 10:28:53 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src
In directory dark:/tmp/cvs-serv1131
Modified Files:
World.cc
Log Message:
fixed std::list::sort for MSVC6
Index: World.cc
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/World.cc,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -d -r1.72 -r1.73
--- World.cc 9 Jun 2002 14:28:03 -0000 1.72
+++ World.cc 10 Jun 2002 10:28:50 -0000 1.73
@@ -43,14 +43,23 @@
using namespace std;
using boost::shared_ptr;
-// Structure for the sorting algorithm (stable_sort)
-struct WorldObj_less
+static
+bool WorldObj_less (shared_ptr<WorldObj>& a, shared_ptr<WorldObj>& b)
{
- bool operator() (shared_ptr<WorldObj>& a, shared_ptr<WorldObj>& 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 shared_ptr<WorldObj>& CWorldObjPtr;
+template<>
+bool std::greater<CWorldObjPtr>::operator()(shared_ptr<WorldObj>& a,
shared_ptr<WorldObj>& b) const
+{
+ return WorldObj_less (a, b);
+}
+#endif
World::World(PLF* arg_plf)
: particle_holder (new ParticleHolder()),
@@ -202,9 +211,12 @@
// After all objects are in world_obj, sort them to there z_pos
#ifdef WIN32
- // FIXME: Insert something here which will sort a list under 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
- world_obj.sort(WorldObj_less());
+ world_obj.sort(WorldObj_less);
#endif
// FIXME: If the above thing causes throuble under windows we could
// use a vector instead of a list and use stable_sort() instead.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src World.cc,1.72,1.73,
grumbel <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src ButtonPanel.cc,1.29,1.30 ButtonPanel.hh,1.15,1.16 Client.cc,1.82,1.83 Client.hh,1.38,1.39 Controllable.cc,1.5,1.6 Controllable.hh,1.5,1.6 Cursor.cc,1.4,1.5 Cursor.hh,1.6,1.7 MultiplayerClientChild.cc,1.12,1.13 MultiplayerClientChild.hh,1.8,1.9 MultiplayerGame.cc,1.8,1.9 PingusGameSession.cc,1.15,1.16 PingusGameSession.hh,1.9,1.10 PingusLevelDesc.cc,1.27,1.28 PingusLevelDesc.hh,1.12,1.13 PingusLevelResult.cc,1.26,1.27 PingusLevelResult.hh,1.7,1.8 PingusMenu.hh,1.22,1.23 Playfield.cc,1.36,1.37 Playfield.hh,1.26,1.27 View.cc,1.20,1.21 View.hh,1.12,1.13
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src/editor ObjectManager.cc,1.64,1.65
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src ButtonPanel.cc,1.29,1.30 ButtonPanel.hh,1.15,1.16 Client.cc,1.82,1.83 Client.hh,1.38,1.39 Controllable.cc,1.5,1.6 Controllable.hh,1.5,1.6 Cursor.cc,1.4,1.5 Cursor.hh,1.6,1.7 MultiplayerClientChild.cc,1.12,1.13 MultiplayerClientChild.hh,1.8,1.9 MultiplayerGame.cc,1.8,1.9 PingusGameSession.cc,1.15,1.16 PingusGameSession.hh,1.9,1.10 PingusLevelDesc.cc,1.27,1.28 PingusLevelDesc.hh,1.12,1.13 PingusLevelResult.cc,1.26,1.27 PingusLevelResult.hh,1.7,1.8 PingusMenu.hh,1.22,1.23 Playfield.cc,1.36,1.37 Playfield.hh,1.26,1.27 View.cc,1.20,1.21 View.hh,1.12,1.13
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src/editor ObjectManager.cc,1.64,1.65
- Index(es):