www.gusucode.com > VC++游戏雷霆战机源代码-源码程序 > VC++游戏雷霆战机源代码-源码程序\code\ObList.cpp

    // ObList.cpp: implementation of the CObList class.
// Download by http://www.NewXing.com
//////////////////////////////////////////////////////////////////////

#include "ObList.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CObList::CObList()
{
	Head = new CObNode();
	Tail = new CObNode();
	Head->Next = Tail;
	Tail->Last = Head;
	Count=0;
}

CObList::~CObList()
{

}

void CObList::AddTail(CBaseObj *It)
{
	CObNode *p=new CObNode(It);
	p->Next = Tail;
	p->Last = Tail->Last;
	Tail->Last->Next = p;
	Tail->Last = p;
	Count++;
}

void CObList::Delete(CObNode *It)
{
	It->Last->Next = It->Next;
	It->Next->Last = It->Last;
	delete(It);
	Count--;
}