MCPcopy Create free account
hub / github.com/StrongPC123/Far-Cry-1-Source-Full / SelectPipe

Method SelectPipe

CrySystem/ScriptObjectEntity.cpp:3115–3166  ·  view source on GitHub ↗

/////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

3113
3114//////////////////////////////////////////////////////////////////////////
3115int CScriptObjectEntity::SelectPipe(IFunctionHandler *pH)
3116{
3117// CHECK_PARAMETERS(2);
3118
3119 int iIdentifier;
3120 int nID=0;
3121 const char *pName;
3122 const char *pTargetName=0;
3123
3124 pH->GetParam(1,iIdentifier);
3125 pH->GetParam(2,pName);
3126
3127 if (pH->GetParamCount() > 2)
3128 {
3129 if (pH->GetParamType(3) == svtNumber)
3130 pH->GetParam(3,nID);
3131 else
3132 pH->GetParam(3,pTargetName);
3133 }
3134
3135 IAIObject *pTargetAI=0;
3136 if (nID)
3137 {
3138 IEntity *pTarget = m_pEntitySystem->GetEntity(nID);
3139 if (pTarget)
3140 pTargetAI = pTarget->GetAI();
3141 }
3142 else if (pTargetName)
3143 {
3144 pTargetAI = m_pISystem->GetAISystem()->GetAIObjectByName(0,pTargetName);
3145 }
3146
3147 IAIObject *pObject = m_pEntity->GetAI();
3148
3149 IPipeUser *pPipeUser;
3150 bool res = false;
3151 if (pObject)
3152 if (pObject->CanBeConvertedTo(AIOBJECT_PIPEUSER,(void**) &pPipeUser))
3153 {
3154 if (pTargetAI)
3155 res = pPipeUser->SelectPipe(iIdentifier,pName,pTargetAI);
3156 else
3157 res = pPipeUser->SelectPipe(iIdentifier,pName);
3158 }
3159
3160
3161 if (!res)
3162 m_pISystem->Warning( VALIDATOR_MODULE_SYSTEM,VALIDATOR_WARNING,VALIDATOR_FLAG_AI,0,"[AIWARNING] Entity %s failed to select goal pipe %s",m_pEntity->GetName(),pName);
3163
3164
3165 return pH->EndFunction();
3166}
3167
3168
3169int CScriptObjectEntity::InsertSubpipe(IFunctionHandler * pH)

Callers

nothing calls this directly

Calls 10

GetParamTypeMethod · 0.80
CanBeConvertedToMethod · 0.80
EndFunctionMethod · 0.80
GetParamMethod · 0.45
GetParamCountMethod · 0.45
GetEntityMethod · 0.45
GetAIMethod · 0.45
GetAISystemMethod · 0.45
WarningMethod · 0.45
GetNameMethod · 0.45

Tested by

no test coverage detected