29 #include "../../idlib/precompiled.h"
114 brush_t *pBrush, *pNextBrush;
117 for (redo = g_redolist; redo; redo = nextredo)
119 nextredo = redo->
next;
122 pNextBrush = pBrush->
next;
127 pNextEntity = pEntity->
next;
147 brush_t *pBrush, *pNextBrush;
151 for (undo = g_undolist; undo; undo = nextundo)
153 nextundo = undo->
next;
156 pNextBrush = pBrush->
next;
162 pNextEntity = pEntity->
next;
228 brush_t *pBrush, *pNextBrush;
233 g_undolist = g_undolist->
next;
238 pNextBrush = pBrush->next;
244 pNextEntity = pEntity->
next;
267 if (!g_lastundo->
done)
269 common->
Printf(
"Undo_Start: WARNING last undo not finished.\n");
275 memset(undo, 0,
sizeof(
undo_t));
280 if (g_lastundo) g_lastundo->
next = undo;
281 else g_undolist = undo;
286 undo->
time = Sys_DoubleTime();
296 if (pBrush->undoId == undo->
id)
303 if (pBrush->undoId == undo->
id)
336 if (b == brush)
return true;
352 if (e == ent)
return true;
377 Sys_Status(
"Undo_AddBrushList: no last undo.\n");
382 Sys_Status(
"Undo_AddBrushList: WARNING adding brushes after entity.\n");
390 pClone->ownerId = pBrush->owner->entityId;
392 if (pBrush->owner && !(pBrush->owner->eclass->nShowFlags & ECLASS_WORLDSPAWN)) {
397 pClone->undoId = pBrush->undoId;
414 Sys_Status(
"Undo_AddBrushList: no last undo.\n");
419 Sys_Status(
"Undo_AddBrushList: WARNING adding brushes after entity.\n");
422 for (pBrush = brushlist->next ; pBrush !=
NULL && pBrush != brushlist; pBrush=pBrush->next)
430 pClone->ownerId = pBrush->owner->entityId;
432 pClone->undoId = pBrush->undoId;
457 if (g_lastundo->
done)
462 pBrush->undoId = g_lastundo->
id;
477 if (g_lastundo->
done)
482 for (brush_t* pBrush = brushlist->next; pBrush !=
NULL && pBrush != brushlist; pBrush=pBrush->next)
484 pBrush->undoId = g_lastundo->
id;
499 Sys_Status(
"Undo_AddEntity: no last undo.\n");
532 if (g_lastundo->
done)
559 if (g_lastundo->
done)
564 g_lastundo->
done =
true;
570 if (g_undolist == g_lastundo)
break;
585 brush_t *pBrush, *pNextBrush;
586 entity_t *pEntity, *pNextEntity, *pUndoEntity;
593 if (!g_lastundo->
done)
595 Sys_Status(
"Undo_Undo: WARNING: last undo not yet finished!\n");
600 else g_undolist =
NULL;
601 g_lastundo = g_lastundo->
prev;
606 memset(redo, 0,
sizeof(
undo_t));
611 if (g_lastredo) g_lastredo->
next = redo;
612 else g_redolist = redo;
616 redo->
time = Sys_DoubleTime();
624 if (pBrush->redoId == redo->
id)
631 if (pBrush->redoId == redo->
id)
650 pNextBrush = pBrush->next;
651 if (pBrush->undoId == undo->
id)
658 pBrush->ownerId = pBrush->owner->entityId;
666 pNextEntity = pEntity->
next;
717 if (pEntity->
entityId == pBrush->ownerId)
730 Select_Brush(pBrush);
731 pBrush->redoId = redo->
id;
767 brush_t *pBrush, *pNextBrush;
768 entity_t *pEntity, *pNextEntity, *pRedoEntity;
777 if (!g_lastundo->
done)
779 Sys_Status(
"WARNING: last undo not finished.\n");
785 else g_redolist =
NULL;
786 g_lastredo = g_lastredo->
prev;
794 pNextBrush = pBrush->next;
795 if (pBrush->redoId == redo->
id)
801 pBrush->ownerId = pBrush->owner->entityId;
808 pNextEntity = pEntity->
next;
857 if (pEntity->
entityId == pBrush->ownerId)
870 Select_Brush(pBrush);
892 if (g_lastredo)
return true;
905 if (g_lastundo->
done)
brush_t * Brush_FullClone(brush_t *b)
void Undo_AddBrushList(brush_t *brushlist)
void WINAPI Sys_UpdateWindows(int nBits)
int Undo_EntityInUndo(undo_t *undo, entity_t *ent)
void Entity_FreeEpairs(entity_t *e)
void Entity_Free(entity_t *e)
void Entity_UnlinkBrush(brush_t *b)
int Undo_RedoAvailable(void)
void Undo_FreeFirstUndo(void)
void Undo_EndBrush(brush_t *pBrush)
void Sys_Status(const char *psz, int part)
void Brush_Free(brush_t *b, bool bRemoveNode)
int Undo_GetMaxMemorySize(void)
void Undo_Start(char *operation)
void Brush_Build(brush_t *b, bool bSnap, bool bMarkMap, bool bConvert, bool updateLights)
void Undo_EndEntity(entity_t *entity)
int Undo_UndoAvailable(void)
void Brush_AddToList(brush_t *b, brush_t *list)
void Undo_ClearRedo(void)
void Brush_RemoveFromList(brush_t *b)
entity_t * Entity_Clone(entity_t *e)
virtual void Printf(const char *fmt,...) id_attribute((format(printf
int Brush_MemorySize(brush_t *b)
int Undo_GetMaxSize(void)
void Undo_AddEntity(entity_t *entity)
void Entity_RemoveFromList(entity_t *e)
void Entity_LinkBrush(entity_t *e, brush_t *b)
void Undo_EndBrushList(brush_t *brushlist)
void Undo_AddBrush(brush_t *pBrush)
int Undo_MemorySize(void)
void * Mem_ClearedAlloc(const int size)
void Undo_SetMaxSize(int size)
void Entity_AddToList(entity_t *e, entity_t *list)
int Undo_BrushInUndo(undo_t *undo, brush_t *brush)
int Entity_MemorySize(entity_t *e)
void Undo_GeneralStart(char *operation)
void Undo_SetMaxMemorySize(int size)