📄 monstlist.cpp
字号:
// MonstList.cpp: implementation of the CMonstList class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "MirX.h"
#include "MonstList.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CMonstList::CMonstList()
{
m_MonList.RemoveAll();
}
CMonstList::~CMonstList()
{
while(!m_MonList.IsEmpty())
{
delete m_MonList.RemoveHead();
}
}
void CMonstList::Appear(MonInfo*mon)
{
POSITION pos=m_MonList.GetHeadPosition();
MonInfo*p=NULL;
bool bFind=false;
while(pos!=NULL)
{
p=(MonInfo*)m_MonList.GetAt(pos);
if(p!=NULL)
{
if(p->id==mon->id)
{
if(!mon->name.IsEmpty())
p->name=mon->name;
p->position=mon->position;
bFind=true;
}
}
m_MonList.GetNext(pos);
}
if(!bFind)
{
p=new MonInfo;
p->id=mon->id;
p->name=mon->name;
p->position=mon->position;
m_MonList.AddHead(p);
}
}
void CMonstList::Disappear(DWORD id)
{
POSITION pos=m_MonList.GetHeadPosition();
MonInfo*p=NULL;
while(pos!=NULL)
{
p=(MonInfo*)&m_MonList.GetAt(pos);
if(p!=NULL)
{
if(p->id==id)
{
m_MonList.RemoveAt(pos);
delete p;
}
}
m_MonList.GetNext(pos);
}
}
void CMonstList::HpChange(MonInfo *mon)
{
POSITION pos=m_MonList.GetHeadPosition();
MonInfo*p=NULL;
while(pos!=NULL)
{
p=(MonInfo*)m_MonList.GetAt(pos);
if(p!=NULL)
{
if(p->id==mon->id)
{
p->hpcur=mon->hpcur;
p->hpmax=mon->hpmax;
}
}
m_MonList.GetNext(pos);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -