/* ============= Undo_Clear Clears the undo buffer. ============= */ void Undo_Clear(void) { undo_t *undo, *nextundo; brush_t *pBrush, *pNextBrush; entity_t *pEntity, *pNextEntity; Undo_ClearRedo(); for (undo = g_undolist; undo; undo = nextundo) { nextundo = undo->next; for (pBrush = undo->brushlist.next ; pBrush != NULL && pBrush != &undo->brushlist ; pBrush = pNextBrush) { pNextBrush = pBrush->next; g_undoMemorySize -= Brush_MemorySize(pBrush); Brush_Free(pBrush); } for (pEntity = undo->entitylist.next; pEntity != NULL && pEntity != &undo->entitylist; pEntity = pNextEntity) { pNextEntity = pEntity->next; g_undoMemorySize -= Entity_MemorySize(pEntity); Entity_Free(pEntity); } g_undoMemorySize -= sizeof(undo_t); Mem_Free(undo); } g_undolist = NULL; g_lastundo = NULL; g_undoSize = 0; g_undoMemorySize = 0; g_undoId = 1; }
/* ============= Undo_Start ============= */ void Undo_Start( const char *operation ){ // spog - disable undo if undo levels = 0 if ( g_PrefsDlg.m_nUndoLevels == 0 ) { #ifdef DBG_UNDO Sys_Printf( "Undo_Start: undo is disabled.\n" ); #endif return; } Undo_ClearRedo(); Undo_GeneralStart( operation ); }
/* ============= Undo_Start ============= */ void Undo_Start(char *operation) { Undo_ClearRedo(); Undo_GeneralStart(operation); }