| 79 | } |
| 80 | |
| 81 | void 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 | |
| 129 | void CScriptObjectEntity::ReleaseTemplate() |
| 130 | { |
no test coverage detected