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

Function DeleteGroup

editor/Group.cpp:366–394  ·  view source on GitHub ↗

Delete the given list of rooms Parameters: nrooms - the number of rooms in list roomnums - pointer to list of room numbers

Source from the content-addressed store, hash-verified

364// Parameters: nrooms - the number of rooms in list
365// roomnums - pointer to list of room numbers
366void DeleteGroup(int nrooms, int *roomnums) {
367 int i;
368 int *troomnums;
369 bool save_disable_flag = Disable_editor_rendering;
370
371 Disable_editor_rendering = 1;
372
373 // Make copy of list of rooms to delete. We must do this because roomnums may be a pointer
374 // to the global Selected_list, the contents of which may be changed by DeleteRoomFromMine()
375 troomnums = (int *)mem_malloc(sizeof(*troomnums) * nrooms);
376 for (i = 0; i < nrooms; i++)
377 troomnums[i] = roomnums[i];
378
379 // Now delete the rooms
380 for (i = 0; i < nrooms; i++)
381 DeleteRoomFromMine(&Rooms[troomnums[i]]);
382
383 // Free up our array
384 mem_free(troomnums);
385
386 // Regenerate external object rooms
387 CreateRoomObjects();
388
389 // Restore old flag
390 Disable_editor_rendering = save_disable_flag;
391
392 // We're done! Update flags and leave
393 World_changed = 1;
394}
395
396// Place the given group at the specified room face
397// The function merely causes the group to be drawn in the editor, allowing the user to line it up

Callers 2

OnEditCutMethod · 0.85
OnEditDeleteMethod · 0.85

Calls 2

DeleteRoomFromMineFunction · 0.85
CreateRoomObjectsFunction · 0.85

Tested by

no test coverage detected