MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / Load

Method Load

ogsr_engine/xrGame/ui/UIGameTutorial.cpp:12–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10#include "../ai_space.h"
11
12void CUISequenceItem::Load(CUIXml* xml, int idx)
13{
14 XML_NODE* _stored_root = xml->GetLocalRoot();
15 xml->SetLocalRoot(xml->NavigateToNode("item", idx));
16 int disabled_cnt = xml->GetNodesNum(xml->GetLocalRoot(), "disabled_key");
17 for (int i = 0; i < disabled_cnt; ++i)
18 {
19 LPCSTR str = xml->Read("disabled_key", i, NULL);
20 m_disabled_actions.push_back(action_name_to_id(str));
21 };
22
23 LPCSTR str;
24 bool functor_exists;
25 int j;
26 int f_num = xml->GetNodesNum(xml->GetLocalRoot(), "function_on_start");
27 m_start_lua_functions.resize(f_num);
28 for (j = 0; j < f_num; ++j)
29 {
30 str = xml->Read(xml->GetLocalRoot(), "function_on_start", j, NULL);
31 functor_exists = ai().script_engine().functor(str, m_start_lua_functions[j]);
32 THROW3(functor_exists, "Cannot find script function described in tutorial item ", str);
33 }
34
35 f_num = xml->GetNodesNum(xml->GetLocalRoot(), "function_on_stop");
36 m_stop_lua_functions.resize(f_num);
37 for (j = 0; j < f_num; ++j)
38 {
39 str = xml->Read(xml->GetLocalRoot(), "function_on_stop", j, NULL);
40 functor_exists = ai().script_engine().functor(str, m_stop_lua_functions[j]);
41 THROW3(functor_exists, "Cannot find script function described in tutorial item ", str);
42 }
43
44 xml->SetLocalRoot(_stored_root);
45}
46
47bool CUISequenceItem::AllowKey(int dik)
48{

Callers 1

StartMethod · 0.45

Calls 7

action_name_to_idFunction · 0.85
NavigateToNodeMethod · 0.80
GetNodesNumMethod · 0.80
functorMethod · 0.80
ReadMethod · 0.45
push_backMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected