⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 squirmcellslot.cpp

📁 本程序模拟细胞的自我繁殖
💻 CPP
字号:
// SquirmCellSlot.cpp

#include "stdafx.h"
#include "SquirmCellSlot.h"

#include "SquirmError.h"

void SquirmCellSlot::addOccupant(SquirmCell *occ)
{
	// mustn't already be in this slot (slow check)
#ifdef _DEBUG
	if(this->occupants.Find(occ)!=NULL)
    {
		SquirmError("SquirmCellSlot::addOccupant : already present!");
        return;
    }
#endif

	this->occupants.AddTail(occ);
}

void SquirmCellSlot::removeOccupant(SquirmCell* occ)
{
	// must already be in this slot
	POSITION where = this->occupants.Find(occ);

    // this check isn't at all slow but should never be needed
#ifdef _DEBUG
	if(where==NULL)
    {
		SquirmError("SquirmCellSlot::removeOccupant : not present!");
        return;
    }
#endif

	this->occupants.RemoveAt(where);
}

⌨️ 快捷键说明

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