📄 scenerylist.cpp
字号:
// SceneryList.cpp: implementation of the CSceneryList class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "MapEdit.h"
#include "SceneryList.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CSceneryList::CSceneryList()
{
m_pFirst = NULL;
m_pLast = NULL;
}
CSceneryList::~CSceneryList()
{
DestoryList();
}
// Init List //////////////////////////////////////////////////////////
void CSceneryList::InitList()
{
DestoryList();
}
// Destroy List ////////////////////////////////////////////////////////
void CSceneryList::DestoryList()
{
SceneryNode *current = NULL;
while (NULL != m_pFirst)
{
current = m_pFirst;
m_pFirst = m_pFirst->pNext;
delete current->pObjScenery;
delete current;
}
m_pLast = NULL;
}
// Is list empty? ///////////////////////////////////////////////////////
BOOL CSceneryList::IsListEmpty()
{
if (NULL == m_pFirst)
{
return TRUE;
}
return FALSE;
}
// Add and delete object ////////////////////////////////////////////////
void CSceneryList::AddObject(CGameObject *&inObject)
{
SceneryNode *newNode = new SceneryNode;
// Setup data
newNode->pObjScenery = inObject;
newNode->nIndex = inObject->m_nIndex;
if (NULL == m_pFirst)
{
// If the list is empty, create a header
m_pFirst = newNode;
m_pLast = newNode;
m_pLast->pNext = NULL;
}
else
{
m_pLast->pNext = newNode;
m_pLast = newNode;
m_pLast->pNext = NULL;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -