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

Method ShutDownScript

CryEntitySystem/Entity.cpp:392–451  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

390
391//////////////////////////////////////////////////////////////////////////
392void CEntity::ShutDownScript()
393{
394 if (m_pClientState)
395 {
396 // Call Client.OnShutDown
397 _SmartScriptObject pClient(m_pScriptSystem, true);
398 if (m_pScriptObject->GetValue(SCRIPT_CLIENT_STATE,pClient))
399 {
400 HSCRIPTFUNCTION pOnInitFunc = 0;
401 if (pClient->GetValue( SCRIPT_SHUTDOWN,pOnInitFunc ))
402 {
403 m_pScriptSystem->BeginCall(pOnInitFunc);
404 m_pScriptSystem->PushFuncParam(m_pScriptObject);
405 m_pScriptSystem->EndCall();
406 m_pScriptSystem->ReleaseFunc(pOnInitFunc);
407 }
408 }
409 }
410 if (m_pServerState)
411 {
412 // Call Server.OnShutDown
413 _SmartScriptObject pServer(m_pScriptSystem, true);
414 if (m_pScriptObject->GetValue(SCRIPT_SERVER_STATE,pServer))
415 {
416 HSCRIPTFUNCTION pOnInitFunc = 0;
417 if (pServer->GetValue( SCRIPT_SHUTDOWN,pOnInitFunc ))
418 {
419 m_pScriptSystem->BeginCall(pOnInitFunc);
420 m_pScriptSystem->PushFuncParam(m_pScriptObject);
421 m_pScriptSystem->EndCall();
422 m_pScriptSystem->ReleaseFunc(pOnInitFunc);
423 }
424 }
425 else
426 {
427 // Call OnShutDown
428 HSCRIPTFUNCTION pOnInitFunc = 0;
429 // Default fallback if Server table not exist.
430 if (m_pScriptObject->GetValue(SCRIPT_SHUTDOWN,pOnInitFunc))
431 {
432 m_pScriptSystem->BeginCall(pOnInitFunc);
433 m_pScriptSystem->PushFuncParam(m_pScriptObject);
434 m_pScriptSystem->EndCall();
435 m_pScriptSystem->ReleaseFunc(pOnInitFunc);
436 }
437 }
438 }
439
440 if (m_pClientState)
441 {
442 ReleaseStateTable(*m_pClientState);
443 }
444 if (m_pServerState)
445 {
446 ReleaseStateTable(*m_pServerState);
447 }
448
449 SAFE_DELETE( m_pServerState );

Callers

nothing calls this directly

Calls 5

BeginCallMethod · 0.80
PushFuncParamMethod · 0.80
ReleaseFuncMethod · 0.80
GetValueMethod · 0.45
EndCallMethod · 0.45

Tested by

no test coverage detected