Checks to see if the node contains a named thing, and, if it does, adds it to the appropriate name list It returns 1 if an invalid name is found, 0 otherwise
| 4122 | // and, if it does, adds it to the appropriate name list |
| 4123 | // It returns 1 if an invalid name is found, 0 otherwise |
| 4124 | int CDallasMainDlg::AddNameToListFromTreeNode(HTREEITEM node, bool show_notspec_warnings) { |
| 4125 | tTreeNodeData *data; |
| 4126 | int scriptID; |
| 4127 | |
| 4128 | if (node == NULL) |
| 4129 | return 0; |
| 4130 | |
| 4131 | data = (tTreeNodeData *)m_ScriptTree.GetItemData(node); |
| 4132 | if (data == NULL) |
| 4133 | return 0; |
| 4134 | |
| 4135 | // Make sure this node isn't in the clipboard |
| 4136 | HTREEITEM script_header_node; |
| 4137 | script_header_node = GetParentNodeOfType(node, SCRIPT_HEADER_NODE); |
| 4138 | if (script_header_node == NULL) |
| 4139 | return 0; |
| 4140 | if (m_ScriptTree.GetParentItem(script_header_node) != NULL) |
| 4141 | return 0; |
| 4142 | |
| 4143 | // Get the script ID |
| 4144 | scriptID = GetScriptID(node); |
| 4145 | if (scriptID == -1) |
| 4146 | return 0; |
| 4147 | |
| 4148 | // See if it's an Owner Node |
| 4149 | if (data->type == SCRIPT_OWNER_NODE) { |
| 4150 | if (data->ID == NOT_SPECIFIED_TYPE) { |
| 4151 | if (show_notspec_warnings) |
| 4152 | IndValNotSpecMsg(scriptID, "Script Owner"); |
| 4153 | return 1; |
| 4154 | } |
| 4155 | if (data->ID == LEVEL_TYPE) |
| 4156 | return 0; |
| 4157 | if (data->ID == OBJECT_TYPE) { |
| 4158 | // Check for object None |
| 4159 | if (data->int_val == OBJECT_HANDLE_NONE) { |
| 4160 | if (show_notspec_warnings) |
| 4161 | IndValNotSpecMsg(scriptID, "Script Owner (Object)"); |
| 4162 | return 1; |
| 4163 | } |
| 4164 | |
| 4165 | // Check for invalid objects |
| 4166 | object *objp = ObjGet(data->int_val); |
| 4167 | if (objp == NULL || objp->type == OBJ_NONE || objp->name == NULL) { |
| 4168 | int handle = osipf_FindObjectName(data->str_val); |
| 4169 | if (handle != OBJECT_HANDLE_NONE) { |
| 4170 | if (InvObjPrompt(scriptID, data->int_val, data->str_val, handle) == IDYES) { |
| 4171 | data->int_val = handle; |
| 4172 | UpdateAllParentNodesText(node); |
| 4173 | AddObjectToList(data->str_val); |
| 4174 | return 0; |
| 4175 | } |
| 4176 | } |
| 4177 | InvObjMsg(scriptID, data->int_val, data->str_val); |
| 4178 | data->int_val = OBJECT_HANDLE_NONE; |
| 4179 | strcpy(data->str_val, ""); |
| 4180 | UpdateAllParentNodesText(node); |
| 4181 | return 1; |
nothing calls this directly
no test coverage detected