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

Method SetEntity

CrySystem/ScriptObjectEntity.cpp:81–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79}
80
81void CScriptObjectEntity::SetEntity(IEntity *pEntity)
82{
83 assert(m_pScriptThis);
84 m_pEntity=pEntity;
85 assert(m_pScriptThis);
86 _SmartScriptObject pObj(m_pScriptSystem,true);
87 assert(m_pScriptThis);
88
89 string sClassname=m_pEntity->GetEntityClassName();
90 assert(m_pScriptThis);
91 if (!m_pScriptSystem->GetGlobalValue(sClassname.c_str(),*pObj))
92 {
93 m_pISystem->GetILog()->LogToFile("[FATAL ERROR] Script table %s not found. Probably script was not loaded because of an error.",sClassname.c_str());
94
95 //return; // vlad: to be able to load level created for xbox
96
97 CryError("[FATAL ERROR] Script table %s not found. Probably script was not loaded because of an error.",sClassname.c_str());
98
99 //m_pISystem->GetIConsole()->Exit("[FATAL ERROR] Script table %s not found. Probably script was not loaded because of an error.",sClassname.c_str());
100
101 //m_pISystem->Quit();
102 }
103 assert(m_pScriptThis);
104 m_pScriptThis->Clone(*pObj);
105 assert(m_pScriptThis);
106 if(m_pEntity!=NULL)
107 {
108 assert(m_pScriptThis);
109 m_pScriptThis->SetValue("id",((int)m_pEntity->GetId()));
110 assert(m_pScriptThis);
111 m_pScriptThis->SetValue("classid",((int)m_pEntity->GetClassId()));
112 assert(m_pScriptThis);
113 m_pScriptThis->SetValue("classname",m_pEntity->GetEntityClassName());
114 assert(m_pScriptThis);
115 }
116 else
117 {
118 assert(m_pScriptThis);
119 m_pScriptThis->SetToNull("id");
120 assert(m_pScriptThis);
121 m_pScriptThis->SetToNull("classid");
122 assert(m_pScriptThis);
123 m_pScriptThis->SetToNull("classname");
124 assert(m_pScriptThis);
125 }
126 assert(m_pScriptThis);
127}
128
129void CScriptObjectEntity::ReleaseTemplate()
130{

Callers 1

Calls 11

CryErrorFunction · 0.85
GetGlobalValueMethod · 0.80
GetILogMethod · 0.80
SetToNullMethod · 0.80
GetEntityClassNameMethod · 0.45
c_strMethod · 0.45
LogToFileMethod · 0.45
CloneMethod · 0.45
SetValueMethod · 0.45
GetIdMethod · 0.45
GetClassIdMethod · 0.45

Tested by

no test coverage detected