Changeset View
Changeset View
Standalone View
Standalone View
source/gameengine/GameLogic/SCA_NetworkMessageActuator.cpp
- This file was moved from source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp.
| Show All 17 Lines | |||||
| * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. | * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. | ||||
| * All rights reserved. | * All rights reserved. | ||||
| * | * | ||||
| * The Original Code is: all of this file. | * The Original Code is: all of this file. | ||||
| * | * | ||||
| * Contributor(s): none yet. | * Contributor(s): none yet. | ||||
| * | * | ||||
| * ***** END GPL LICENSE BLOCK ***** | * ***** END GPL LICENSE BLOCK ***** | ||||
| * Ketsji Logic Extension: Network Message Actuator generic implementation | * Network Message Actuator generic implementation | ||||
| */ | */ | ||||
| /** \file gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp | /** \file gameengine/GameLogic/SCA_NetworkMessageActuator.cpp | ||||
| * \ingroup ketsjinet | * \ingroup gamelogic | ||||
| */ | */ | ||||
| #include <stddef.h> | #include <stddef.h> | ||||
| #include "NG_NetworkScene.h" | #include "NG_NetworkScene.h" | ||||
| #include "KX_NetworkMessageActuator.h" | #include "SCA_NetworkMessageActuator.h" | ||||
| KX_NetworkMessageActuator::KX_NetworkMessageActuator( | SCA_NetworkMessageActuator::SCA_NetworkMessageActuator( | ||||
| SCA_IObject* gameobj, // the actuator controlling object | SCA_IObject* gameobj, // the actuator controlling object | ||||
| NG_NetworkScene* networkscene, // needed for replication | NG_NetworkScene* networkscene, // needed for replication | ||||
| const STR_String &toPropName, | const STR_String &toPropName, | ||||
| const STR_String &subject, | const STR_String &subject, | ||||
| int bodyType, | int bodyType, | ||||
| const STR_String &body) : | const STR_String &body) : | ||||
| SCA_IActuator(gameobj, KX_ACT_MESSAGE), | SCA_IActuator(gameobj, SCA_ACT_MESSAGE), | ||||
| m_networkscene(networkscene), | m_networkscene(networkscene), | ||||
| m_toPropName(toPropName), | m_toPropName(toPropName), | ||||
| m_subject(subject), | m_subject(subject), | ||||
| m_bPropBody(bodyType), | m_bPropBody(bodyType), | ||||
| m_body(body) | m_body(body) | ||||
| { | { | ||||
| } | } | ||||
| KX_NetworkMessageActuator::~KX_NetworkMessageActuator() | SCA_NetworkMessageActuator::~SCA_NetworkMessageActuator() | ||||
| { | { | ||||
| } | } | ||||
| // returns true if the actuators needs to be running over several frames | // returns true if the actuators needs to be running over several frames | ||||
| bool KX_NetworkMessageActuator::Update() | bool SCA_NetworkMessageActuator::Update() | ||||
| { | { | ||||
| //printf("update messageactuator\n"); | //printf("update messageactuator\n"); | ||||
| bool bNegativeEvent = IsNegativeEvent(); | bool bNegativeEvent = IsNegativeEvent(); | ||||
| RemoveAllEvents(); | RemoveAllEvents(); | ||||
| if (bNegativeEvent) { | if (bNegativeEvent) { | ||||
| return false; // do nothing on negative events | return false; // do nothing on negative events | ||||
| //printf("messageactuator false event\n"); | //printf("messageactuator false event\n"); | ||||
| Show All 13 Lines | m_networkscene->SendMessage( | ||||
| m_toPropName, | m_toPropName, | ||||
| GetParent()->GetName(), | GetParent()->GetName(), | ||||
| m_subject, | m_subject, | ||||
| m_body); | m_body); | ||||
| } | } | ||||
| return false; | return false; | ||||
| } | } | ||||
| CValue* KX_NetworkMessageActuator::GetReplica() | CValue* SCA_NetworkMessageActuator::GetReplica() | ||||
| { | { | ||||
| KX_NetworkMessageActuator* replica = new KX_NetworkMessageActuator(*this); | SCA_NetworkMessageActuator* replica = new SCA_NetworkMessageActuator(*this); | ||||
| replica->ProcessReplica(); | replica->ProcessReplica(); | ||||
| return replica; | return replica; | ||||
| } | } | ||||
| #ifdef WITH_PYTHON | #ifdef WITH_PYTHON | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /* Python interface --------------------------------------------------- */ | /* Python interface --------------------------------------------------- */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /* Integration hooks -------------------------------------------------- */ | /* Integration hooks -------------------------------------------------- */ | ||||
| PyTypeObject KX_NetworkMessageActuator::Type = { | PyTypeObject SCA_NetworkMessageActuator::Type = { | ||||
| PyVarObject_HEAD_INIT(NULL, 0) | PyVarObject_HEAD_INIT(NULL, 0) | ||||
| "KX_NetworkMessageActuator", | "SCA_NetworkMessageActuator", | ||||
| sizeof(PyObjectPlus_Proxy), | sizeof(PyObjectPlus_Proxy), | ||||
| 0, | 0, | ||||
| py_base_dealloc, | py_base_dealloc, | ||||
| 0, | 0, | ||||
| 0, | 0, | ||||
| 0, | 0, | ||||
| 0, | 0, | ||||
| py_base_repr, | py_base_repr, | ||||
| 0,0,0,0,0,0,0,0,0, | 0,0,0,0,0,0,0,0,0, | ||||
| Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, | Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, | ||||
| 0,0,0,0,0,0,0, | 0,0,0,0,0,0,0, | ||||
| Methods, | Methods, | ||||
| 0, | 0, | ||||
| 0, | 0, | ||||
| &SCA_IActuator::Type, | &SCA_IActuator::Type, | ||||
| 0,0,0,0,0,0, | 0,0,0,0,0,0, | ||||
| py_base_new | py_base_new | ||||
| }; | }; | ||||
| PyMethodDef KX_NetworkMessageActuator::Methods[] = { | PyMethodDef SCA_NetworkMessageActuator::Methods[] = { | ||||
| {NULL,NULL} // Sentinel | {NULL,NULL} // Sentinel | ||||
| }; | }; | ||||
| PyAttributeDef KX_NetworkMessageActuator::Attributes[] = { | PyAttributeDef SCA_NetworkMessageActuator::Attributes[] = { | ||||
| KX_PYATTRIBUTE_STRING_RW("propName", 0, MAX_PROP_NAME, false, KX_NetworkMessageActuator, m_toPropName), | KX_PYATTRIBUTE_STRING_RW("propName", 0, MAX_PROP_NAME, false, SCA_NetworkMessageActuator, m_toPropName), | ||||
| KX_PYATTRIBUTE_STRING_RW("subject", 0, 100, false, KX_NetworkMessageActuator, m_subject), | KX_PYATTRIBUTE_STRING_RW("subject", 0, 100, false, SCA_NetworkMessageActuator, m_subject), | ||||
| KX_PYATTRIBUTE_BOOL_RW("usePropBody", KX_NetworkMessageActuator, m_bPropBody), | KX_PYATTRIBUTE_BOOL_RW("usePropBody", SCA_NetworkMessageActuator, m_bPropBody), | ||||
| KX_PYATTRIBUTE_STRING_RW("body", 0, 16384, false, KX_NetworkMessageActuator, m_body), | KX_PYATTRIBUTE_STRING_RW("body", 0, 16384, false, SCA_NetworkMessageActuator, m_body), | ||||
| { NULL } //Sentinel | { NULL } //Sentinel | ||||
| }; | }; | ||||
| #endif // WITH_PYTHON | #endif // WITH_PYTHON | ||||