MCPcopy Create free account
hub / github.com/Meridian59/Meridian59 / DeleteObjects

Function DeleteObjects

roomedit/source/objects.cpp:563–777  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

561*/
562
563void DeleteObjects (int objtype, SelPtr *list)
564{
565 SHORT n, objnum, i;
566 SelPtr cur;
567
568 MadeChanges = TRUE;
569 switch (objtype)
570 {
571 case OBJ_THINGS:
572 while (*list)
573 {
574 objnum = (*list)->objnum;
575 if (kodEntrance == Things[objnum].type)
576 {
577// DeleteEntrance(Things[objnum].when,Things[objnum].id);
578 }
579 /* delete the Thing */
580 NumThings--;
581 if (NumThings > 0)
582 {
583 for (n = objnum; n < NumThings; n++)
584 Things[ n] = Things[ n + 1];
585 Things = (TPtr)ResizeMemory (Things, NumThings * sizeof(Thing));
586 }
587 else
588 {
589 FreeMemory (Things);
590 Things = NULL;
591 }
592
593 // Update objnum of selection list
594 for (cur = (*list)->next; cur; cur = cur->next)
595 if (cur->objnum > objnum)
596 cur->objnum--;
597 UnSelectObject( list, objnum);
598 }
599 break;
600
601 case OBJ_VERTEXES:
602 while (*list)
603 {
604 objnum = (*list)->objnum;
605 // delete the LineDefs bound to this Vertex and
606 // change the references
607 for (n = 0; n < NumLineDefs; n++)
608 {
609 if (LineDefs[ n].start == objnum || LineDefs[ n].end == objnum)
610 DeleteObject( OBJ_LINEDEFS, n--);
611 else
612 {
613 if (LineDefs[ n].start >= objnum)
614 LineDefs[ n].start--;
615 if (LineDefs[ n].end >= objnum)
616 LineDefs[ n].end--;
617
618 }
619 }
620

Callers 6

DeleteObjectFunction · 0.85
MergeVerticesFunction · 0.85
MergeSectorsFunction · 0.85
CheckCrossReferencesFunction · 0.85
CmEditDeleteMethod · 0.85

Calls 4

ResizeMemoryFunction · 0.85
UnSelectObjectFunction · 0.85
DeleteObjectFunction · 0.85
BeepFunction · 0.85

Tested by

no test coverage detected