Changeset View
Changeset View
Standalone View
Standalone View
source/gameengine/GameLogic/SCA_PropertyActuator.cpp
| Show All 38 Lines | |||||
| #include "InputParser.h" | #include "InputParser.h" | ||||
| #include "Operator2Expr.h" | #include "Operator2Expr.h" | ||||
| #include "ConstExpr.h" | #include "ConstExpr.h" | ||||
| /* ------------------------------------------------------------------------- */ | /* ------------------------------------------------------------------------- */ | ||||
| /* Native functions */ | /* Native functions */ | ||||
| /* ------------------------------------------------------------------------- */ | /* ------------------------------------------------------------------------- */ | ||||
| SCA_PropertyActuator::SCA_PropertyActuator(SCA_IObject* gameobj,SCA_IObject* sourceObj,const STR_String& propname,const STR_String& expr,int acttype) | SCA_PropertyActuator::SCA_PropertyActuator(SCA_IObject* gameobj, SCA_IObject* sourceObj, const STR_String& propname, const STR_String& expr, int acttype) | ||||
| : SCA_IActuator(gameobj, KX_ACT_PROPERTY), | : SCA_IActuator(gameobj, SCA_ACT_PROPERTY), | ||||
| m_type(acttype), | m_type(acttype), | ||||
| m_propname(propname), | m_propname(propname), | ||||
| m_exprtxt(expr), | m_exprtxt(expr), | ||||
| m_sourceObj(sourceObj) | m_sourceObj(sourceObj) | ||||
| { | { | ||||
| // protect ourselves against someone else deleting the source object | // protect ourselves against someone else deleting the source object | ||||
| // don't protect against ourselves: it would create a dead lock | // don't protect against ourselves: it would create a dead lock | ||||
| if (m_sourceObj) | if (m_sourceObj) | ||||
| ▲ Show 20 Lines • Show All 104 Lines • ▼ Show 20 Lines | else if ((userexpr = parser.ProcessText(m_exprtxt))) { | ||||
| userexpr->Release(); | userexpr->Release(); | ||||
| } | } | ||||
| return result; | return result; | ||||
| } | } | ||||
| bool | bool | ||||
| SCA_PropertyActuator:: | SCA_PropertyActuator::isValid(int mode) | ||||
| { | |||||
| isValid( | |||||
| SCA_PropertyActuator::KX_ACT_PROP_MODE mode | |||||
| ) { | |||||
| bool res = false; | bool res = false; | ||||
| res = ((mode > KX_ACT_PROP_NODEF) && (mode < KX_ACT_PROP_MAX)); | res = ((mode > KX_ACT_PROP_NODEF) && (mode < KX_ACT_PROP_MAX)); | ||||
| return res; | return res; | ||||
| } | } | ||||
| CValue* | CValue* | ||||
| SCA_PropertyActuator:: | SCA_PropertyActuator::GetReplica() | ||||
| GetReplica() | |||||
| { | { | ||||
| SCA_PropertyActuator* replica = new SCA_PropertyActuator(*this); | SCA_PropertyActuator* replica = new SCA_PropertyActuator(*this); | ||||
| replica->ProcessReplica(); | replica->ProcessReplica(); | ||||
| return replica; | return replica; | ||||
| }; | } | ||||
| void SCA_PropertyActuator::ProcessReplica() | void SCA_PropertyActuator::ProcessReplica() | ||||
| { | { | ||||
| // no need to check for self reference like in the constructor: | // no need to check for self reference like in the constructor: | ||||
| // the replica will always have a different parent | // the replica will always have a different parent | ||||
| if (m_sourceObj) | if (m_sourceObj) | ||||
| m_sourceObj->RegisterActuator(this); | m_sourceObj->RegisterActuator(this); | ||||
| SCA_IActuator::ProcessReplica(); | SCA_IActuator::ProcessReplica(); | ||||
| ▲ Show 20 Lines • Show All 67 Lines • Show Last 20 Lines | |||||