cmdecorator.cpp

来自「Soul的源代码,类似于劲舞团之类的游戏」· C++ 代码 · 共 52 行

CPP
52
字号
#include "CMDecorator.h"

using namespace MatrixCore::Pattern;

CMDecorator::CMDecorator()
	: prev( 0 ), next( 0 )
{
}

CMDecorator::~CMDecorator()
{
	remove();
}

bool CMDecorator::process()
{
	while( next != 0 && next->process() == false )
		delete next;

	return true;
}

void CMDecorator::add( CMDecorator* d )
{
	if( d == 0 )
		return;

	d->prev = this;
	d->next = next;
	if( next != 0 )
		next->prev = d;
	next = d;
}

void CMDecorator::addTail( CMDecorator* d )
{
	if( next == 0 )
	{
		next = d;
		next->prev = this;
	}
	else
		next->addTail( d );
}

void CMDecorator::remove()
{
	if( prev != 0 )
		prev->next = next;
	if( next != 0 )
		next->prev = prev;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?