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

Function ObjectCut

editor/ObjectClipboard.cpp:68–85  ·  view source on GitHub ↗

Makes a copy of the current object to the clipboard object, then deletes this object Returns true on success

Source from the content-addressed store, hash-verified

66// Makes a copy of the current object to the clipboard object, then deletes this object
67// Returns true on success
68bool ObjectCut() {
69 mprintf(0, "ObjectCut()\n");
70 if (Cur_object_index != -1) {
71 int objnum = Cur_object_index;
72 int num_player_objects = GetNumberPlayerObjs();
73 if ((num_player_objects == 1) && Objects[objnum].type == OBJ_PLAYER) {
74 mprintf(0, "Oops, Can't delete the only player...sorry\n");
75 return false;
76 }
77 mprintf(0, "Attempting to cut object #%d into buffer...", objnum);
78 memcpy(&ClipBoardObject, &Objects[objnum], sizeof(object));
79 mprintf(0, "Done!\n");
80 ObjectInBuffer = true;
81 HObjectDelete();
82 return true;
83 }
84 return false;
85}
86
87// Makes a copy of the current object to the clipboard object
88// Returns true on success

Callers 1

OnCommandMethod · 0.85

Calls 2

GetNumberPlayerObjsFunction · 0.85
HObjectDeleteFunction · 0.85

Tested by

no test coverage detected