squirmcellslot.cpp
来自「本程序模拟细胞的自我繁殖」· C++ 代码 · 共 38 行
CPP
38 行
// 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 + =
减小字号Ctrl + -
显示快捷键?