Exemple #1
0
/*
=============
Undo_AddEntity
=============
*/
void Undo_AddEntity(entity_t *entity)
{
	entity_t* pClone;

	if (!g_lastundo)
	{
		Sys_Status("Undo_AddEntity: no last undo.\n");
		return;
	}
	//if the entity is already in the undo
	if (Undo_EntityInUndo(g_lastundo, entity))
		return;
	//clone the entity
	pClone = Entity_Clone(entity);
	//NOTE: Entity_Clone adds the entity to the entity list
	//		so we remove it from that list here
	Entity_RemoveFromList(pClone);
	//save the old undo ID for previous undos
	pClone->undoId = entity->undoId;
	//save the entity ID (we need a full clone)
	pClone->entityId = entity->entityId;
	//
	Entity_AddToList(pClone, &g_lastundo->entitylist);
	//
	g_undoMemorySize += Entity_MemorySize(pClone);
}
Exemple #2
0
/*
=============
Undo_AddEntity
=============
*/
void Undo_AddEntity(entity_t *entity)
{
	// spog - disable undo if undo levels = 0
	if (g_PrefsDlg.m_nUndoLevels == 0)
	{
#ifdef DBG_UNDO
		Sys_Printf("Undo_AddEntity: undo is disabled.\n");
#endif
		return;
	}


	entity_t* pClone;

	if (!g_lastundo)
	{
		Sys_Printf("Undo_AddEntity: no last undo.\n");
		return;
	}
	//if the entity is already in the undo
	if (Undo_EntityInUndo(g_lastundo, entity))
		return;
	//clone the entity
	pClone = Entity_Clone(entity);
	//save the old undo ID for previous undos
	pClone->undoId = entity->undoId;
	//save the entity ID (we need a full clone)
	pClone->entityId = entity->entityId;
	//
	Entity_AddToList(pClone, &g_lastundo->entitylist);
	//
	g_undoMemorySize += Entity_MemorySize(pClone);
}