本文整理汇总了C++中LPENTITY类的典型用法代码示例。如果您正苦于以下问题:C++ LPENTITY类的具体用法?C++ LPENTITY怎么用?C++ LPENTITY使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LPENTITY类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
void SECTREE::DecreasePC()
{
LPSECTREE_LIST::iterator it_tree = m_neighbor_list.begin();
while (it_tree != m_neighbor_list.end())
{
LPSECTREE tree = *it_tree++;
if (--tree->m_iPCCount <= 0)
{
if (tree->m_iPCCount < 0)
{
sys_err("tree pc count lower than zero (value %d coord %d %d)", tree->m_iPCCount, tree->m_id.coord.x, tree->m_id.coord.y);
tree->m_iPCCount = 0;
}
ENTITY_SET::iterator it_entity = tree->m_set_entity.begin();
while (it_entity != tree->m_set_entity.end())
{
LPENTITY pkEnt = *(it_entity++);
if (pkEnt->IsType(ENTITY_CHARACTER))
{
LPCHARACTER ch = (LPCHARACTER) pkEnt;
ch->StopStateMachine();
}
}
}
}
}
示例2: operator
void operator () (LPENTITY ent)
{
if (ent == m_except)
return;
if (ent->GetDesc())
ent->GetDesc()->Packet(m_data, m_bytes);
}
示例3: while
void CEntity::ViewCleanup()
{
ENTITY_MAP::iterator it = m_map_view.begin();
while (it != m_map_view.end())
{
LPENTITY entity = it->first;
++it;
entity->ViewRemove(this, false);
}
m_map_view.clear();
}
示例4: ViewRemove
void CEntity::ViewRemove(LPENTITY entity, bool recursive)
{
ENTITY_MAP::iterator it = m_map_view.find(entity);
if (it == m_map_view.end())
return;
m_map_view.erase(it);
if (!entity->m_bIsObserver)
entity->EncodeRemovePacket(this);
if (recursive)
entity->ViewRemove(this, false);
}
示例5: EncodeInsertPacket
void CObject::EncodeInsertPacket(LPENTITY entity)
{
LPDESC d;
if (!(d = entity->GetDesc()))
return;
sys_log(0, "ObjectInsertPacket vid %u vnum %u rot %f %f %f",
m_dwVID, m_data.dwVnum, m_data.xRot, m_data.yRot, m_data.zRot);
TPacketGCCharacterAdd pack;
memset(&pack, 0, sizeof(TPacketGCCharacterAdd));
pack.header = HEADER_GC_CHARACTER_ADD;
pack.dwVID = m_dwVID;
pack.bType = CHAR_TYPE_BUILDING;
pack.angle = m_data.zRot;
pack.x = GetX();
pack.y = GetY();
pack.z = GetZ();
pack.wRaceNum = m_data.dwVnum;
// 빌딩 회전 정보(벽일때는 문 위치)를 변환
pack.dwAffectFlag[0] = unsigned(m_data.xRot);
pack.dwAffectFlag[1] = unsigned(m_data.yRot);
if (GetLand())
{
// pack.dwGuild = GetLand()->GetOwner();
}
d->Packet(&pack, sizeof(pack));
}
示例6: RemoveEntity
void SECTREE::RemoveEntity(LPENTITY pkEnt)
{
ENTITY_SET::iterator it = m_set_entity.find(pkEnt);
if (it == m_set_entity.end()) {
return;
}
m_set_entity.erase(it);
pkEnt->SetSectree(NULL);
if (pkEnt->IsType(ENTITY_CHARACTER))
{
if (((LPCHARACTER) pkEnt)->IsPC())
DecreasePC();
}
}
示例7: sys_err
void SECTREE::Destroy()
{
if (!m_set_entity.empty())
{
sys_err("Sectree: entity set not empty!!");
ENTITY_SET::iterator it = m_set_entity.begin();
for ( ; it != m_set_entity.end(); ++it)
{
LPENTITY ent = *it;
if (ent->IsType(ENTITY_CHARACTER))
{
LPCHARACTER ch = (LPCHARACTER) ent;
sys_err("Sectree: destroying character: %s is_pc %d", ch->GetName(), ch->IsPC() ? 1 : 0);
if (ch->GetDesc())
DESC_MANAGER::instance().DestroyDesc(ch->GetDesc());
else
M2_DESTROY_CHARACTER(ch);
}
else if (ent->IsType(ENTITY_ITEM))
{
LPITEM item = (LPITEM) ent;
sys_err("Sectree: destroying Item: %s", item->GetName());
M2_DESTROY_ITEM(item);
}
else
sys_err("Sectree: unknown type: %d", ent->GetType());
}
}
m_set_entity.clear();
if (!isClone && m_pkAttribute)
{
M2_DELETE(m_pkAttribute);
m_pkAttribute = NULL;
}
}
示例8: operator
void operator() (LPENTITY ent)
{
if (true == ent->IsType(ENTITY_CHARACTER))
{
LPCHARACTER ch = static_cast<LPCHARACTER>(ent);
if (false == ch->IsPC())
{
ch->Dead();
}
}
}
示例9: ViewInsert
void CEntity::ViewInsert(LPENTITY entity, bool recursive)
{
if (this == entity)
return;
ENTITY_MAP::iterator it = m_map_view.find(entity);
if (m_map_view.end() != it)
{
it->second = m_iViewAge;
return;
}
m_map_view.insert(ENTITY_MAP::value_type(entity, m_iViewAge));
if (!entity->m_bIsObserver)
entity->EncodeInsertPacket(this);
if (recursive)
entity->ViewInsert(this, false);
}
示例10: InsertEntity
bool SECTREE::InsertEntity(LPENTITY pkEnt)
{
LPSECTREE pkCurTree;
if ((pkCurTree = pkEnt->GetSectree()) == this)
return false;
if (m_set_entity.find(pkEnt) != m_set_entity.end()) {
sys_err("entity %p already exist in this sectree!", get_pointer(pkEnt));
return false;
}
if (pkCurTree)
pkCurTree->m_set_entity.erase(pkEnt);
pkEnt->SetSectree(this);
//pkEnt->UpdateSectree();
m_set_entity.insert(pkEnt);
if (pkEnt->IsType(ENTITY_CHARACTER))
{
LPCHARACTER pkChr = (LPCHARACTER) pkEnt;
if (pkChr->IsPC())
{
IncreasePC();
if (pkCurTree)
pkCurTree->DecreasePC();
}
else if (m_iPCCount > 0 && !pkChr->IsWarp() && !pkChr->IsGoto()) // PC가 아니고 이 곳에 PC가 있다면 Idle event를 시작 시킨다.
{
pkChr->StartStateMachine();
}
}
return true;
}
示例11: EncodeRemovePacket
void CEntity::ViewReencode()
{
if (m_bIsObserver)
return;
EncodeRemovePacket(this);
EncodeInsertPacket(this);
ENTITY_MAP::iterator it = m_map_view.begin();
while (it != m_map_view.end())
{
LPENTITY entity = (it++)->first;
EncodeRemovePacket(entity);
if (!m_bIsObserver)
EncodeInsertPacket(entity);
if (!entity->m_bIsObserver)
entity->EncodeInsertPacket(this);
}
}
示例12: EncodeRemovePacket
void CItem::EncodeRemovePacket(LPENTITY ent)
{
LPDESC d;
if (!(d = ent->GetDesc()))
return;
struct packet_item_ground_del pack;
pack.bHeader = HEADER_GC_ITEM_GROUND_DEL;
pack.dwVID = m_dwVID;
d->Packet(&pack, sizeof(pack));
sys_log(2, "Item::EncodeRemovePacket %s to %s", GetName(), ((LPCHARACTER) ent)->GetName());
}
示例13: EncodeRemovePacket
void CObject::EncodeRemovePacket(LPENTITY entity)
{
LPDESC d;
if (!(d = entity->GetDesc()))
return;
sys_log(0, "ObjectRemovePacket vid %u", m_dwVID);
TPacketGCCharacterDelete pack;
pack.header = HEADER_GC_CHARACTER_DEL;
pack.id = m_dwVID;
d->Packet(&pack, sizeof(TPacketGCCharacterDelete));
}
示例14: operator
void operator () (LPENTITY ent)
{
if (ent->IsType(ENTITY_CHARACTER))
{
LPCHARACTER ch = (LPCHARACTER) ent;
if (ch->IsMonster())
{
return;
}
if (sx <= ch->GetX() && ch->GetX() <= ex
&& sy <= ch->GetY() && ch->GetY() <= ey)
{
bIn = true;
}
}
}
示例15: operator
void operator()(LPENTITY ent)
{
if (NULL != ent && true == ent->IsType(ENTITY_CHARACTER))
{
LPCHARACTER pChar = static_cast<LPCHARACTER>(ent);
if (true == pChar->IsPC())
{
if (NULL != pChar->GetGuild())
{
if (dwGuildID == pChar->GetGuild()->GetID())
{
pChar->WarpSet(x, y, mapIndex);
}
}
}
}
}