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

Function DeleteViewer

editor/HView.cpp:377–405  ·  view source on GitHub ↗

Deletes the current viewer object

Source from the content-addressed store, hash-verified

375
376// Deletes the current viewer object
377void DeleteViewer() {
378 int objnum, old_num;
379
380 if (Viewer_object->id == ROOM_VIEWER_ID) {
381 OutrageMessageBox("You cannot delete the Room viewer.");
382 return;
383 }
384
385 objnum = FindNextViewerObject(Viewer_object->id + 1, -1);
386
387 ASSERT(objnum != -1);
388
389 if (objnum == OBJNUM(Viewer_object)) { // couldn't find another viewer
390 OutrageMessageBox("You cannot delete your only viewer.");
391 return;
392 }
393
394 old_num = GetViewerNum();
395
396 // Kill the old viewer
397 ObjDelete(OBJNUM(Viewer_object));
398
399 // Set the new viewer
400 SetViewer(objnum);
401
402 EditorStatus("Viewer %d deleted. Viewer %d selected.", old_num, GetViewerNum());
403
404 World_changed = 1;
405}
406
407// Sets the viewer object for the editor, creating if not already in mine
408// Keeps seperate viewer objects for mine & terrain views

Callers 1

OnViewDeleteviewerMethod · 0.85

Calls 6

OutrageMessageBoxFunction · 0.85
FindNextViewerObjectFunction · 0.85
GetViewerNumFunction · 0.85
ObjDeleteFunction · 0.85
SetViewerFunction · 0.85
EditorStatusFunction · 0.85

Tested by

no test coverage detected