Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
122 lines
3.1 KiB
C++
122 lines
3.1 KiB
C++
// CommandManager.cpp: implementation of the CCommandManager class.
|
|
//
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
#include "stdafx.h"
|
|
#include "effecteditor.h"
|
|
#include "CommandManager.h"
|
|
|
|
#ifdef _DEBUG
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[]=__FILE__;
|
|
#define new DEBUG_NEW
|
|
#endif
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
// Construction/Destruction
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
CCommandManager::CCommandManager()
|
|
{
|
|
m_lBottom = 0;
|
|
m_lTop = 0;
|
|
m_lMemoryTop = 0;
|
|
m_lPresent = 0;
|
|
}
|
|
|
|
CCommandManager::~CCommandManager()
|
|
{
|
|
|
|
}
|
|
|
|
void CCommandManager::AddCommand(unsigned long dwKind, unsigned long dwUID, unsigned long dwFrame, unsigned long dwCommand, unsigned long dwListKind, float eData)
|
|
{
|
|
if(m_lPresent == m_lMemoryTop)
|
|
{
|
|
CCommand AddCommand;
|
|
AddCommand.SetCommand(dwKind, dwUID, dwFrame, dwCommand, dwListKind, eData);
|
|
m_lstCommand.Add(AddCommand);
|
|
m_lPresent = m_lTop = m_lMemoryTop = m_lstCommand.num;
|
|
} else
|
|
{
|
|
m_lstCommand[m_lPresent].SetCommand(dwKind, dwUID, dwFrame, dwCommand, dwListKind, eData);
|
|
m_lTop = ++m_lPresent;
|
|
}
|
|
}
|
|
|
|
void CCommandManager::AddCommand(unsigned long dwKind, unsigned long dwUID, unsigned long dwFrame, unsigned long dwCommand, unsigned long dwListKind, quaternion eData)
|
|
{
|
|
if(m_lPresent == m_lMemoryTop)
|
|
{
|
|
CCommand AddCommand;
|
|
AddCommand.SetCommand(dwKind, dwUID, dwFrame, dwCommand, dwListKind, eData);
|
|
m_lstCommand.Add(AddCommand);
|
|
m_lPresent = m_lTop = m_lMemoryTop = m_lstCommand.num;
|
|
} else
|
|
{
|
|
m_lstCommand[m_lPresent].SetCommand(dwKind, dwUID, dwFrame, dwCommand, dwListKind, eData);
|
|
m_lTop = ++m_lPresent;
|
|
}
|
|
}
|
|
|
|
void CCommandManager::AddCommand(unsigned long dwKind, unsigned long dwUID, unsigned long dwFrame, unsigned long dwCommand, unsigned long dwListKind, color eData)
|
|
{
|
|
if(m_lPresent == m_lMemoryTop)
|
|
{
|
|
CCommand AddCommand;
|
|
AddCommand.SetCommand(dwKind, dwUID, dwFrame, dwCommand, dwListKind, eData);
|
|
m_lstCommand.Add(AddCommand);
|
|
m_lPresent = m_lTop = m_lMemoryTop = m_lstCommand.num;
|
|
} else
|
|
{
|
|
m_lstCommand[m_lPresent].SetCommand(dwKind, dwUID, dwFrame, dwCommand, dwListKind, eData);
|
|
m_lTop = ++m_lPresent;
|
|
}
|
|
}
|
|
|
|
void CCommandManager::AddCommand(unsigned long dwKind, unsigned long dwUID, unsigned long dwFrame, unsigned long dwCommand, unsigned long dwListKind, vector3 eData)
|
|
{
|
|
if(m_lPresent == m_lMemoryTop)
|
|
{
|
|
CCommand AddCommand;
|
|
AddCommand.SetCommand(dwKind, dwUID, dwFrame, dwCommand, dwListKind, eData);
|
|
m_lstCommand.Add(AddCommand);
|
|
m_lPresent = m_lTop = m_lMemoryTop = m_lstCommand.num;
|
|
} else
|
|
{
|
|
m_lstCommand[m_lPresent].SetCommand(dwKind, dwUID, dwFrame, dwCommand, dwListKind, eData);
|
|
m_lTop = ++m_lPresent;
|
|
}
|
|
}
|
|
|
|
CCommand *CCommandManager::Undo(void)
|
|
{
|
|
if(m_lPresent != m_lBottom)
|
|
{
|
|
m_lPresent--;
|
|
if(m_lstCommand[m_lPresent].GetCommand() == COMMAND_NEWDATA)
|
|
{
|
|
m_lPresent--;
|
|
}
|
|
return &m_lstCommand[m_lPresent];
|
|
} else
|
|
{
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
CCommand *CCommandManager::Redo(void)
|
|
{
|
|
if(m_lPresent != m_lTop)
|
|
{
|
|
if(m_lstCommand[m_lPresent].GetCommand() == COMMAND_NEWDATA)
|
|
{
|
|
m_lPresent++;
|
|
}
|
|
return &m_lstCommand[m_lPresent++];
|
|
} else
|
|
{
|
|
return NULL;
|
|
}
|
|
}
|