almost all event managers stored a pointer back to the logic manager, easier if this...
authorCampbell Barton <ideasman42@gmail.com>
Fri, 25 Sep 2009 16:30:15 +0000 (16:30 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 25 Sep 2009 16:30:15 +0000 (16:30 +0000)
23 files changed:
source/gameengine/GameLogic/SCA_ActuatorEventManager.cpp
source/gameengine/GameLogic/SCA_ActuatorEventManager.h
source/gameengine/GameLogic/SCA_AlwaysEventManager.cpp
source/gameengine/GameLogic/SCA_AlwaysEventManager.h
source/gameengine/GameLogic/SCA_BasicEventManager.cpp
source/gameengine/GameLogic/SCA_EventManager.cpp
source/gameengine/GameLogic/SCA_EventManager.h
source/gameengine/GameLogic/SCA_JoystickManager.cpp
source/gameengine/GameLogic/SCA_JoystickManager.h
source/gameengine/GameLogic/SCA_KeyboardManager.cpp
source/gameengine/GameLogic/SCA_KeyboardManager.h
source/gameengine/GameLogic/SCA_MouseManager.cpp
source/gameengine/GameLogic/SCA_MouseManager.h
source/gameengine/GameLogic/SCA_PropertyEventManager.cpp
source/gameengine/GameLogic/SCA_PropertyEventManager.h
source/gameengine/GameLogic/SCA_RandomEventManager.cpp
source/gameengine/GameLogic/SCA_RandomEventManager.h
source/gameengine/GameLogic/SCA_TimeEventManager.cpp
source/gameengine/Ketsji/KXNetwork/KX_NetworkEventManager.cpp
source/gameengine/Ketsji/KXNetwork/KX_NetworkEventManager.h
source/gameengine/Ketsji/KX_RayEventManager.h
source/gameengine/Ketsji/KX_TouchEventManager.cpp
source/gameengine/Ketsji/KX_TouchEventManager.h

index a80b2af55c8229c398f3373513cc76aac16726d6..e4dfe4e0bffab97a8f80a09c9f8cb8afaeaa3d85 100644 (file)
@@ -36,8 +36,7 @@
 
 
 SCA_ActuatorEventManager::SCA_ActuatorEventManager(class SCA_LogicManager* logicmgr)
-       : SCA_EventManager(ACTUATOR_EVENTMGR),
-       m_logicmgr(logicmgr)
+       : SCA_EventManager(logicmgr, ACTUATOR_EVENTMGR)
 {
 }
 
index f3884c87a752e4ebcb899d8e747e34a7fcf0ade4..8c86d0dd42248c78a5b8bf2b95b57c6ea2f10ca5 100644 (file)
@@ -37,8 +37,6 @@ using namespace std;
 
 class SCA_ActuatorEventManager : public SCA_EventManager
 {
-       class SCA_LogicManager* m_logicmgr;
-
 public:
        SCA_ActuatorEventManager(class SCA_LogicManager* logicmgr);
        virtual ~SCA_ActuatorEventManager();
index dd3b55abcc9dc9a4462aba0bb034bad277e492fa..aee016069742d3b602658615862129449a5ed680 100644 (file)
@@ -42,8 +42,7 @@
 using namespace std;
 
 SCA_AlwaysEventManager::SCA_AlwaysEventManager(class SCA_LogicManager* logicmgr)
-       : SCA_EventManager(ALWAYS_EVENTMGR),
-       m_logicmgr(logicmgr)
+       : SCA_EventManager(logicmgr, ALWAYS_EVENTMGR)
 {
 }
 
index 9540e3b71f680955231ffdf839958894208caff0..f7fb3b9714e5f7d86959e83b2011f2b88a22ecf5 100644 (file)
@@ -34,8 +34,6 @@
 using namespace std;
 class SCA_AlwaysEventManager : public SCA_EventManager
 {
-       
-       class SCA_LogicManager* m_logicmgr;
 public:
        SCA_AlwaysEventManager(class SCA_LogicManager* logicmgr);
        virtual void NextFrame();
index 24cae439fb70f9b2b481a9ee794c3feaf89b1934..a2a7e535b5c298b43e7c021e1179003de68ce40e 100644 (file)
@@ -42,8 +42,7 @@
 using namespace std;
 
 SCA_BasicEventManager::SCA_BasicEventManager(class SCA_LogicManager* logicmgr)
-       : SCA_EventManager(BASIC_EVENTMGR),
-       m_logicmgr(logicmgr)
+       : SCA_EventManager(logicmgr, BASIC_EVENTMGR)
 {
 }
 
index d1301541a0ab54157886496f5a5e243cac8e8c3e..5b6f3c46022332aad68b7a0313cc899d7c373675 100644 (file)
@@ -35,8 +35,9 @@
 #endif
 
 
-SCA_EventManager::SCA_EventManager(EVENT_MANAGER_TYPE mgrtype)
-       :m_mgrtype(mgrtype)
+SCA_EventManager::SCA_EventManager(SCA_LogicManager* logicmgr, EVENT_MANAGER_TYPE mgrtype)
+       :m_logicmgr(logicmgr),
+       m_mgrtype(mgrtype)
 {
 }
 
index f77b115ee034d4d103a2e728f3ea58bafe9c4389..debefcc45b0ea9da388961c53dcd05471a6ea531 100644 (file)
@@ -38,6 +38,8 @@
 class SCA_EventManager
 {
 protected:
+       class SCA_LogicManager* m_logicmgr; /* all event manager subclasses use this (other then TimeEventManager) */
+
        // use a set to speed-up insertion/removal
        //std::set <class SCA_ISensor*>                         m_sensors;
        SG_DList                m_sensors;
@@ -58,7 +60,7 @@ public:
                BASIC_EVENTMGR
        };
 
-       SCA_EventManager(EVENT_MANAGER_TYPE mgrtype);
+       SCA_EventManager(SCA_LogicManager* logicmgr, EVENT_MANAGER_TYPE mgrtype);
        virtual ~SCA_EventManager();
        
        virtual void    RemoveSensor(class SCA_ISensor* sensor);
index ff8f3b1c81fbbec7aedf9cbecff6b909f17f804e..480292774daa9ec482c6fadaa951e3ce970a3684 100644 (file)
@@ -37,8 +37,7 @@
 
 
 SCA_JoystickManager::SCA_JoystickManager(class SCA_LogicManager* logicmgr)
-       : SCA_EventManager(JOY_EVENTMGR),
-       m_logicmgr(logicmgr)
+       : SCA_EventManager(logicmgr, JOY_EVENTMGR)
 {
        int i;
        for (i=0; i<JOYINDEX_MAX; i++) {
index be55e95b0334ab7decb13415935d08804ad60786..cd0e22cc36704451799d515e691e51a50cbbc0c2 100644 (file)
@@ -35,8 +35,6 @@
 using namespace std;
 class SCA_JoystickManager : public SCA_EventManager
 {
-       
-       class SCA_LogicManager* m_logicmgr;
        /**
         * SDL Joystick Class Instance
         */
index 279adab94d87901bf1f05da3dbf925fb6719d3ac..3d010f570556aa4d1de27fd11f7b6bb458922404 100644 (file)
@@ -37,9 +37,8 @@
 
 SCA_KeyboardManager::SCA_KeyboardManager(SCA_LogicManager* logicmgr,
                                                                                 SCA_IInputDevice* inputdev)
-       :       SCA_EventManager(KEYBOARD_EVENTMGR),
-               m_inputDevice(inputdev),
-               m_logicmanager(logicmgr)
+       :       SCA_EventManager(logicmgr, KEYBOARD_EVENTMGR),
+               m_inputDevice(inputdev)
 {
 }
 
@@ -65,7 +64,7 @@ void SCA_KeyboardManager::NextFrame()
        SG_DList::iterator<SCA_ISensor> it(m_sensors);
        for (it.begin();!it.end();++it)
        {
-               (*it)->Activate(m_logicmanager);
+               (*it)->Activate(m_logicmgr);
        }
 }
 
index c5553a74aef09799f995c17099f129c80ef13143..8155283a2746734dd3c257307249fd0bf0b4af4d 100644 (file)
@@ -45,8 +45,6 @@ using namespace std;
 class SCA_KeyboardManager : public SCA_EventManager
 {
        class   SCA_IInputDevice*                               m_inputDevice;
-       class   SCA_LogicManager*                               m_logicmanager;
-
        
 public:
        SCA_KeyboardManager(class SCA_LogicManager* logicmgr,class SCA_IInputDevice* inputdev);
index d407647cec32844b798bef22e1a1b785d5f65c27..c752701e7854ee7efbc11138f96c543062d33a01 100644 (file)
@@ -48,9 +48,8 @@
 
 SCA_MouseManager::SCA_MouseManager(SCA_LogicManager* logicmgr,
                                                                   SCA_IInputDevice* mousedev)
-       :       SCA_EventManager(MOUSE_EVENTMGR),
-               m_mousedevice (mousedev),
-               m_logicmanager(logicmgr)
+       :       SCA_EventManager(logicmgr, MOUSE_EVENTMGR),
+               m_mousedevice (mousedev)
 {
        m_xpos = 0;
        m_ypos = 0;
@@ -93,7 +92,7 @@ void SCA_MouseManager::NextFrame()
                                mousesensor->setX(mx);
                                mousesensor->setY(my);
                                
-                               mousesensor->Activate(m_logicmanager);
+                               mousesensor->Activate(m_logicmgr);
                        }
                }
        }
index ef1533c636bd2be7f2dfd3668f06d8d13bba101a..00bbab66aa66afabeeab6724ba6052f6212394db 100644 (file)
@@ -47,7 +47,6 @@ class SCA_MouseManager : public SCA_EventManager
 {
 
        class   SCA_IInputDevice*                               m_mousedevice;
-       class   SCA_LogicManager*                               m_logicmanager;
        
        unsigned short m_xpos; // Cached location of the mouse pointer
        unsigned short m_ypos;
index 764465309df93c5234c0dd0e622cdf1705e937c1..e01ce74e0a9597b002cbc09d6936f88aa8e6456e 100644 (file)
@@ -35,8 +35,7 @@
 
 
 SCA_PropertyEventManager::SCA_PropertyEventManager(class SCA_LogicManager* logicmgr)
-       : SCA_EventManager(PROPERTY_EVENTMGR),
-       m_logicmgr(logicmgr)
+       : SCA_EventManager(logicmgr, PROPERTY_EVENTMGR)
 {
 }
 
index a9692377df80a89fad2fb4b9e63d1a6c7d89a3a4..5a036abb8b7b8a064950f9ace27a90aad94bfbbe 100644 (file)
@@ -37,8 +37,6 @@ using namespace std;
 
 class SCA_PropertyEventManager : public SCA_EventManager
 {
-       class SCA_LogicManager* m_logicmgr;
-
 public:
        SCA_PropertyEventManager(class SCA_LogicManager* logicmgr);
        virtual ~SCA_PropertyEventManager();
index 976597aa8122afbc4b7dc0183f3afbe23babc8a8..780f8d1085753f1bdb4f70a2db4dbe678086c1e3 100644 (file)
@@ -42,8 +42,7 @@ using namespace std;
 #endif
 
 SCA_RandomEventManager::SCA_RandomEventManager(class SCA_LogicManager* logicmgr)
-               : SCA_EventManager(RANDOM_EVENTMGR),
-               m_logicmgr(logicmgr)
+               : SCA_EventManager(logicmgr, RANDOM_EVENTMGR)
 {
 }
 
index c8b511b87b7482da7270336ab7d7478ae8f3ab2e..81896709551d260f9de0785305cc6540599e268c 100644 (file)
@@ -39,8 +39,6 @@ using namespace std;
 
 class SCA_RandomEventManager : public SCA_EventManager
 {
-       class SCA_LogicManager* m_logicmgr;
-
 public:
        SCA_RandomEventManager(class SCA_LogicManager* logicmgr);
 
index 911ea772bef88c147edf6a1b1b673f06d1d35075..1b49906b8dea5244d87d0c605004a07d17fcbb2e 100644 (file)
@@ -43,7 +43,7 @@
 #include "FloatValue.h"
 
 SCA_TimeEventManager::SCA_TimeEventManager(SCA_LogicManager* logicmgr)
-: SCA_EventManager(TIME_EVENTMGR)
+: SCA_EventManager(NULL, TIME_EVENTMGR)
 {
 }
 
index 738f64713b0e8a5c7ff98371cf17f0f654dbfca2..65f7d98253c1b9226ba2f46efc0433791f70e26d 100644 (file)
@@ -45,7 +45,7 @@
 
 KX_NetworkEventManager::KX_NetworkEventManager(class SCA_LogicManager*
 logicmgr, class NG_NetworkDeviceInterface *ndi) :
-SCA_EventManager(NETWORK_EVENTMGR), m_logicmgr(logicmgr), m_ndi(ndi)
+SCA_EventManager(logicmgr, NETWORK_EVENTMGR), m_ndi(ndi)
 {
        //printf("KX_NetworkEventManager constructor\n");
 }
index ae88f1d4987fb5e0f1e804052d8f80b58ff3e9c4..fd776640bcf4d4d3e46cbdc4dbb03a862ac9cb6a 100644 (file)
@@ -34,7 +34,6 @@
 
 class KX_NetworkEventManager : public SCA_EventManager
 {
-       class SCA_LogicManager* m_logicmgr;
        class NG_NetworkDeviceInterface* m_ndi;
 
 public:
index 27c9be14d1f7a2986d05204ad04bf757b9170980..030dae525e1cf08407e4505954af6ae333244089 100644 (file)
@@ -41,8 +41,7 @@ class KX_RayEventManager : public SCA_EventManager
        class SCA_LogicManager* m_logicmgr;
 public:
        KX_RayEventManager(class SCA_LogicManager* logicmgr)
-               : SCA_EventManager(RAY_EVENTMGR),
-                 m_logicmgr(logicmgr)
+               : SCA_EventManager(logicmgr, RAY_EVENTMGR)
        {}
        virtual void NextFrame();
 
index 712a512995eee1579f244142ad5c40de1ae4a0ef..6b454f6a33808aff02ec6cef26ca1c1ce6aae0d2 100644 (file)
@@ -40,8 +40,7 @@
 
 KX_TouchEventManager::KX_TouchEventManager(class SCA_LogicManager* logicmgr,
        PHY_IPhysicsEnvironment* physEnv)
-       : SCA_EventManager(TOUCH_EVENTMGR),
-         m_logicmgr(logicmgr),
+       : SCA_EventManager(logicmgr, TOUCH_EVENTMGR),
          m_physEnv(physEnv)
 {
        //notm_scene->addTouchCallback(STATIC_RESPONSE, KX_TouchEventManager::collisionResponse, this);
index 6da37d615a419fee12cab92a32d2dce867ff8c9f..e6414a2e285797a24fe122201159238a30b17c29 100644 (file)
@@ -43,7 +43,6 @@ class PHY_IPhysicsEnvironment;
 class KX_TouchEventManager : public SCA_EventManager
 {
        typedef std::pair<PHY_IPhysicsController*, PHY_IPhysicsController*> NewCollision;
-       class SCA_LogicManager* m_logicmgr;
        PHY_IPhysicsEnvironment*        m_physEnv;
        
        std::set<NewCollision> m_newCollisions;