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

Method CreateObjectFromTable

CryGame/ScriptObjectUI.cpp:1700–1750  ·  view source on GitHub ↗

------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1698//-------------------------------------------------------------------------------------------------
1699//-------------------------------------------------------------------------------------------------
1700int CScriptObjectUI::CreateObjectFromTable(IFunctionHandler *pH)
1701{
1702 CHECK_SCRIPT_FUNCTION_PARAMCOUNT2(m_pScriptSystem, "UI", CreateStatic, 2, 3);
1703 CHECK_SCRIPT_FUNCTION_PARAMTYPE(m_pScriptSystem, "UI", CreateStatic, 1, svtString);
1704 CHECK_SCRIPT_FUNCTION_PARAMTYPE(m_pScriptSystem, "UI", CreateStatic, 2, svtObject);
1705
1706 CUIScreen *pScreen = 0;
1707
1708 if (pH->GetParamCount() == 3)
1709 {
1710 CHECK_SCRIPT_FUNCTION_PARAMTYPE2(m_pScriptSystem, "UI", CreateStatic, 2, svtObject, svtString);
1711
1712 if (pH->GetParamType(3) == svtObject)
1713 {
1714 IScriptObject *pObject = m_pScriptSystem->CreateEmptyObject();
1715
1716 pH->GetParam(3, pObject);
1717
1718 pScreen = (CUIScreen *)pObject->GetNativeData();
1719
1720 pObject->Release();
1721 }
1722 else
1723 {
1724 char *szScreenName = 0;
1725
1726 pH->GetParam(3, szScreenName);
1727
1728 if (szScreenName)
1729 {
1730 pScreen = m_pUISystem->GetScreen(szScreenName);
1731 }
1732 }
1733 }
1734
1735 char *szName = 0;
1736 IScriptObject *pScriptObject = m_pScriptSystem->CreateEmptyObject();
1737
1738 pH->GetParam(1, szName);
1739 pH->GetParam(2, pScriptObject);
1740
1741 CUIWidget *pWidget;
1742
1743 // create the widget
1744 if (!m_pUISystem->CreateObjectFromTable(&pWidget, 0, pScreen, pScriptObject, szName))
1745 {
1746 return pH->EndFunctionNull();
1747 }
1748
1749 return pH->EndFunction(m_pUISystem->GetWidgetScriptObject(pWidget));
1750}
1751
1752//-------------------------------------------------------------------------------------------------
1753int CScriptObjectUI::CreateScreenFromTable(IFunctionHandler *pH)

Callers

nothing calls this directly

Calls 10

GetParamTypeMethod · 0.80
CreateEmptyObjectMethod · 0.80
GetNativeDataMethod · 0.80
EndFunctionNullMethod · 0.80
EndFunctionMethod · 0.80
GetWidgetScriptObjectMethod · 0.80
GetParamCountMethod · 0.45
GetParamMethod · 0.45
ReleaseMethod · 0.45
GetScreenMethod · 0.45

Tested by

no test coverage detected