MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / AddNameToListFromTreeNode

Method AddNameToListFromTreeNode

editor/DallasMainDlg.cpp:4124–4827  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

4122// and, if it does, adds it to the appropriate name list
4123// It returns 1 if an invalid name is found, 0 otherwise
4124int 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;

Callers

nothing calls this directly

Calls 13

ObjGetFunction · 0.85
osipf_FindObjectNameFunction · 0.85
osipf_FindTriggerNameFunction · 0.85
osipf_FindDoorNameFunction · 0.85
osipf_FindRoomNameFunction · 0.85
osipf_FindSoundNameFunction · 0.85
osipf_FindTextureNameFunction · 0.85
osipf_FindPathNameFunction · 0.85
MatcenValidFunction · 0.85
osipf_FindMatcenNameFunction · 0.85
osipf_FindLevelGoalNameFunction · 0.85
GamefileExistsFunction · 0.85

Tested by

no test coverage detected