Delete all SOLID shapes at the end of the game engine. They were all being leaked!
[blender-staging.git] / source / gameengine / Converter / KX_BlenderSceneConverter.cpp
index d3a67abecfc0e821cb644b8b1e301c827a78872e..8e552d3f3d4c14032e4f37686dc33099ad83c32b 100644 (file)
@@ -34,7 +34,6 @@
 #endif
 
 #ifdef WIN32
-
        #pragma warning (disable:4786) // suppress stl-MSVC debug info warning
 #endif
 
@@ -118,6 +117,8 @@ KX_BlenderSceneConverter::~KX_BlenderSceneConverter()
                delete (*itm);
                itm++;
        }
+       
+       KX_ClearSumoSharedShapes();
 }
 
 
@@ -176,112 +177,82 @@ void KX_BlenderSceneConverter::ConvertScene(const STR_String& scenename,
 
        e_PhysicsEngine physics_engine = UseSumo;
 
+       /* FIXME: Force physics engine = sumo.
+       This isn't really a problem - no other physics engines are available. 
        if (blenderscene)
        {
                int i=0;
-               
+       
                if (blenderscene->world)
                {
-                       
-                       switch (blenderscene->world->pad1)
+                       switch (blenderscene->world->physicsEngine)
                        {
-                               
-                       case 1:
+                                
+                               case WOPHY_ODE:
                                {
-                                       physics_engine = UseNone;
-                                       break;
-                               };
-                       case 2:
-                               {
-                                       physics_engine = UseSumo;
+                                       physics_engine = UseODE;
                                        break;
                                }
-                       case 3:
+                               case WOPHY_DYNAMO:
                                {
-                                       physics_engine = UseODE;
+                                       physics_engine = UseDynamo;
                                        break;
                                }
-                       case 4:
+                               case WOPHY_SUMO:
                                {
-                                       physics_engine = UseDynamo;
+                                       physics_engine = UseSumo;
                                        break;
                                }
-                       default:
+                               case WOPHY_NONE:
                                {
-                                       physics_engine = UseODE;
+                                       physics_engine = UseNone;
                                }
                        }
+                 
                }
        }
-
+       */
        switch (physics_engine)
        {
-
-       case UseSumo:
-               {
+       
 #ifdef USE_SUMO_SOLID
-
-                       PHY_IPhysicsEnvironment* physEnv = 
-                               new SumoPhysicsEnvironment();
-#else
-                       physics_engine = UseNone;
-                       
-                       PHY_IPhysicsEnvironment* physEnv = 
-                               new DummyPhysicsEnvironment();
-
-#endif
-                       destinationscene ->SetPhysicsEnvironment(physEnv);
+               case UseSumo:
+                       destinationscene ->SetPhysicsEnvironment(new SumoPhysicsEnvironment());
                        break;
-               }
-       case UseODE:
-               {
+#endif
 #ifdef USE_ODE
-
-                       PHY_IPhysicsEnvironment* physEnv = 
-                               new ODEPhysicsEnvironment();
-#else
-                       PHY_IPhysicsEnvironment* physEnv = 
-                               new DummyPhysicsEnvironment();
-
-#endif //USE_ODE
-
-                       destinationscene ->SetPhysicsEnvironment(physEnv);
+               case UseODE:
+                       destinationscene ->SetPhysicsEnvironment(new ODEPhysicsEnvironment());
                        break;
-               }
-       case UseDynamo:
+#endif //USE_ODE
+       
+               case UseDynamo:
                {
                }
-
-       case UseNone:
-               {
-               };
-       default:
-               {
+               
+               default:
+               case UseNone:
                        physics_engine = UseNone;
-                       
-                       PHY_IPhysicsEnvironment* physEnv = 
-                               new DummyPhysicsEnvironment();
-                       destinationscene ->SetPhysicsEnvironment(physEnv);
-
-               }
+                       destinationscene ->SetPhysicsEnvironment(new DummyPhysicsEnvironment());
+                       break;
        }
 
        BL_ConvertBlenderObjects(m_maggie,
-                                                        scenename,
-                                                        destinationscene,
-                                                        m_ketsjiEngine,
-                                                        physics_engine,
-                                                        dictobj,
-                                                        keyinputdev,
-                                                        rendertools,
-                                                        canvas,
-                                                        this,
-                                                        m_alwaysUseExpandFraming
-                                                        );
+               scenename,
+               destinationscene,
+               m_ketsjiEngine,
+               physics_engine,
+               dictobj,
+               keyinputdev,
+               rendertools,
+               canvas,
+               this,
+               m_alwaysUseExpandFraming
+               );
 
        m_map_blender_to_gameactuator.clear();
        m_map_blender_to_gamecontroller.clear();
-
+       
        m_map_blender_to_gameobject.clear();
        m_map_mesh_to_gamemesh.clear();
        m_map_gameobject_to_blender.clear();