~ubuntu-branches/ubuntu/gutsy/blender/gutsy-security

« back to all changes in this revision

Viewing changes to source/gameengine/Ketsji/KX_NearSensor.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Lukas Fittl
  • Date: 2006-09-20 01:57:27 UTC
  • mfrom: (1.2.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20060920015727-gmoqlxwstx9wwqs3
Tags: 2.42a-1ubuntu1
* Merge from Debian unstable (Closes: Malone #55903). Remaining changes:
  - debian/genpot: Add python scripts from Lee June <blender@eyou.com> to
    generate a reasonable PO template from the sources. Since gettext is used
    in a highly nonstandard way, xgettext does not work for this job.
  - debian/rules: Call the scripts, generate po/blender.pot, and clean it up
    in the clean target.
  - Add a proper header to the generated PO template.
* debian/control: Build depend on libavformat-dev >= 3:0.cvs20060823-3.1,
  otherwise this package will FTBFS

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**
2
2
 * Sense if other objects are near
3
3
 *
4
 
 * $Id: KX_NearSensor.cpp,v 1.12 2005/08/22 15:47:56 erwin Exp $
 
4
 * $Id: KX_NearSensor.cpp,v 1.13 2006/05/22 21:03:43 erwin Exp $
5
5
 *
6
6
 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
7
7
 *
80
80
 
81
81
void KX_NearSensor::RegisterSumo(KX_TouchEventManager *touchman)
82
82
{
83
 
        touchman->GetPhysicsEnvironment()->addSensor(m_physCtrl);
 
83
        if (m_physCtrl)
 
84
        {
 
85
                touchman->GetPhysicsEnvironment()->addSensor(m_physCtrl);
 
86
        }
84
87
}
85
88
 
86
89
CValue* KX_NearSensor::GetReplica()
96
99
        
97
100
        replica->m_client_info = new KX_ClientObjectInfo(m_client_info->m_gameobject, KX_ClientObjectInfo::NEAR);
98
101
        
99
 
        replica->m_physCtrl = replica->m_physCtrl->GetReplica();
 
102
        if (replica->m_physCtrl)
 
103
        {
 
104
                replica->m_physCtrl = replica->m_physCtrl->GetReplica();
 
105
                if (replica->m_physCtrl)
 
106
                {
 
107
                        //static_cast<KX_TouchEventManager*>(m_eventmgr)->GetPhysicsEnvironment()->addSensor(replica->m_physCtrl);
 
108
                        replica->m_physCtrl->SetMargin(m_Margin);
 
109
                        replica->m_physCtrl->setNewClientInfo(replica->m_client_info);
 
110
                }
 
111
                
 
112
        }
 
113
        //static_cast<KX_TouchEventManager*>(m_eventmgr)->RegisterSensor(this);
100
114
        //todo: make sure replication works fine
101
115
        //>m_sumoObj = new SM_Object(DT_NewSphere(0.0),NULL,NULL,NULL);
102
116
        //replica->m_sumoObj->setMargin(m_Margin);
111
125
 
112
126
void KX_NearSensor::ReParent(SCA_IObject* parent)
113
127
{
 
128
 
114
129
        SCA_ISensor::ReParent(parent);
115
130
        
116
131
        m_client_info->m_gameobject = static_cast<KX_GameObject*>(parent); 
117
132
        m_client_info->m_sensors.push_back(this);
118
133
        
 
134
 
 
135
/*      KX_ClientObjectInfo *client_info = gameobj->getClientInfo();
 
136
        client_info->m_gameobject = gameobj;
 
137
        client_info->m_auxilary_info = NULL;
 
138
        
 
139
        client_info->m_sensors.push_back(this);
 
140
        SCA_ISensor::ReParent(parent);
 
141
*/
 
142
 
119
143
        SynchronizeTransform();
120
144
}
121
145
 
127
151
        // for touchsensor, it's the parent
128
152
        if (m_physCtrl)
129
153
        {
130
 
                static_cast<KX_TouchEventManager*>(m_eventmgr)->GetPhysicsEnvironment()->removeSensor(m_physCtrl);
 
154
                //static_cast<KX_TouchEventManager*>(m_eventmgr)->GetPhysicsEnvironment()->removeSensor(m_physCtrl);
131
155
                delete m_physCtrl;
132
156
                m_physCtrl = NULL;
133
157
        }
 
158
        
134
159
                
135
160
        if (m_client_info)
136
161
                delete m_client_info;