Name attributes added since 2.48a more consistently.
[blender.git] / source / gameengine / GameLogic / SCA_KeyboardSensor.cpp
index 96969dc6dc7e7ad1c850318b51563864be07ba10..f8ee8ed8b414c23382108cedde31c8967a3d8ac1 100644 (file)
@@ -85,7 +85,7 @@ CValue* SCA_KeyboardSensor::GetReplica()
 {
        SCA_KeyboardSensor* replica = new SCA_KeyboardSensor(*this);
        // this will copy properties and so on...
-       CValue::AddDataToReplica(replica);
+       replica->ProcessReplica();
        replica->Init();
        return replica;
 }
@@ -118,7 +118,7 @@ bool SCA_KeyboardSensor::TriggerOnAllKeys()
 
 
 
-bool SCA_KeyboardSensor::Evaluate(CValue* eventval)
+bool SCA_KeyboardSensor::Evaluate()
 {
        bool result    = false;
        bool reset     = m_reset && m_level;
@@ -195,6 +195,9 @@ bool SCA_KeyboardSensor::Evaluate(CValue* eventval)
                                        }
                                }
                        }
+                       if (m_tap)
+                               // special case for tap mode: only generate event for new activation
+                               result = false;
                }
 
 
@@ -612,8 +615,13 @@ KX_PYMETHODDEF_DOC_O(SCA_KeyboardSensor, getKeyStatus,
 /* ------------------------------------------------------------------------- */
 
 PyTypeObject SCA_KeyboardSensor::Type = {
-       PyObject_HEAD_INIT(NULL)
-       0,
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
        "SCA_KeyboardSensor",
        sizeof(PyObjectPlus_Proxy),
        0,
@@ -694,7 +702,7 @@ PyObject* SCA_KeyboardSensor::pyattr_get_events(void *self_v, const KX_PYATTRIBU
                {
                        PyObject* keypair = PyList_New(2);
                        PyList_SET_ITEM(keypair,0,PyInt_FromLong(i));
-                       PyList_SetItem(keypair,1,PyInt_FromLong(inevent.m_status));
+                       PyList_SET_ITEM(keypair,1,PyInt_FromLong(inevent.m_status));
                        PyList_Append(resultlist,keypair);
                }
        }