VERSION 1: Parses a script node line, and if it's valid, adds it to the given parent
| 8676 | |
| 8677 | // VERSION 1: Parses a script node line, and if it's valid, adds it to the given parent |
| 8678 | HTREEITEM CDallasMainDlg::ParseScriptNodeLine_v1U(char *line, int linenum, HTREEITEM parent, bool &skip_all_children, |
| 8679 | int version, HTREEITEM insert_before /*=TVI_LAST*/) { |
| 8680 | tTreeNodeData node_data; |
| 8681 | bool add_node; |
| 8682 | int index; |
| 8683 | int scriptID; |
| 8684 | |
| 8685 | // Make sure given data is ok |
| 8686 | if (line == NULL || parent == NULL || skip_all_children) |
| 8687 | return NULL; |
| 8688 | |
| 8689 | // Determine what script we're in |
| 8690 | scriptID = -1; |
| 8691 | if (parent != TVI_ROOT) |
| 8692 | scriptID = GetScriptID(parent); |
| 8693 | |
| 8694 | // Read in the node type |
| 8695 | line = strtok(line, ":"); |
| 8696 | if (line == NULL) |
| 8697 | return NULL; |
| 8698 | node_data.type = atoi(line); |
| 8699 | |
| 8700 | // Read in the rest of this node's data |
| 8701 | add_node = FALSE; |
| 8702 | switch (node_data.type) { |
| 8703 | case SCRIPT_HEADER_NODE: |
| 8704 | if ((line = strtok(NULL, ":")) == NULL) |
| 8705 | return NULL; |
| 8706 | node_data.ID = atoi(line); |
| 8707 | if ((line = strtok(NULL, "")) == NULL) |
| 8708 | return NULL; |
| 8709 | strcpy(node_data.name, line); |
| 8710 | add_node = TRUE; |
| 8711 | break; |
| 8712 | case SCRIPT_OWNER_NODE: |
| 8713 | if ((line = strtok(NULL, ":")) == NULL) |
| 8714 | return NULL; |
| 8715 | node_data.ID = atoi(line); |
| 8716 | if ((line = strtok(NULL, "")) == NULL) |
| 8717 | return NULL; |
| 8718 | index = atoi(line); |
| 8719 | |
| 8720 | if (node_data.ID == OBJECT_TYPE) { |
| 8721 | if (index >= 0 && index < m_ObjectListSize) { |
| 8722 | node_data.int_val = osipf_FindObjectName(m_ObjectList[index]); |
| 8723 | if (node_data.int_val != OBJECT_HANDLE_NONE) { |
| 8724 | strcpy(node_data.str_val, m_ObjectList[index]); |
| 8725 | } else { |
| 8726 | strcpy(node_data.str_val, ""); |
| 8727 | SpecialScriptFileParseError(linenum, scriptID, "Object Script Owner", m_ObjectList[index]); |
| 8728 | } |
| 8729 | } else { |
| 8730 | node_data.int_val = OBJECT_HANDLE_NONE; |
| 8731 | strcpy(node_data.str_val, ""); |
| 8732 | } |
| 8733 | } else if (node_data.ID == TRIGGER_TYPE) { |
| 8734 | if (index >= 0 && index < m_TriggerListSize) { |
| 8735 | node_data.int_val = osipf_FindTriggerName(m_TriggerList[index]); |
nothing calls this directly
no test coverage detected