| 10 | #include "../ai_space.h" |
| 11 | |
| 12 | void 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 | |
| 47 | bool CUISequenceItem::AllowKey(int dik) |
| 48 | { |
no test coverage detected