本文整理汇总了C++中LPDESC::BufferedPacket方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDESC::BufferedPacket方法的具体用法?C++ LPDESC::BufferedPacket怎么用?C++ LPDESC::BufferedPacket使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPDESC
的用法示例。
在下文中一共展示了LPDESC::BufferedPacket方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SendLandList
void CManager::SendLandList(LPDESC d, long lMapIndex)
{
TLandPacketElement e;
TEMP_BUFFER buf;
WORD wCount = 0;
itertype(m_map_pkLand) it = m_map_pkLand.begin();
while (it != m_map_pkLand.end())
{
CLand * pkLand = (it++)->second;
const TLand & r = pkLand->GetData();
if (r.lMapIndex != lMapIndex)
continue;
//
LPCHARACTER ch = d->GetCharacter();
if (ch)
{
CGuild *guild = CGuildManager::instance().FindGuild(r.dwGuildID);
ch->SendGuildName(guild);
}
//
e.dwID = r.dwID;
e.x = r.x;
e.y = r.y;
e.width = r.width;
e.height = r.height;
e.dwGuildID = r.dwGuildID;
buf.write(&e, sizeof(TLandPacketElement));
++wCount;
}
sys_log(0, "SendLandList map %d count %u elem_size: %d", lMapIndex, wCount, buf.size());
if (wCount != 0)
{
TPacketGCLandList p;
p.header = HEADER_GC_LAND_LIST;
p.size = sizeof(TPacketGCLandList) + buf.size();
d->BufferedPacket(&p, sizeof(TPacketGCLandList));
d->Packet(buf.read_peek(), buf.size());
}
}
示例2: UpdateLand
void CManager::UpdateLand(TLand * pTable)
{
CLand * pkLand = FindLand(pTable->dwID);
if (!pkLand)
{
sys_err("cannot find land by id %u", pTable->dwID);
return;
}
pkLand->PutData(pTable);
const DESC_MANAGER::DESC_SET & cont = DESC_MANAGER::instance().GetClientSet();
itertype(cont) it = cont.begin();
TPacketGCLandList p;
p.header = HEADER_GC_LAND_LIST;
p.size = sizeof(TPacketGCLandList) + sizeof(TLandPacketElement);
TLandPacketElement e;
e.dwID = pTable->dwID;
e.x = pTable->x;
e.y = pTable->y;
e.width = pTable->width;
e.height = pTable->height;
e.dwGuildID = pTable->dwGuildID;
sys_log(0, "BUILDING: UpdateLand %u pos %dx%d guild %u", e.dwID, e.x, e.y, e.dwGuildID);
CGuild *guild = CGuildManager::instance().FindGuild(pTable->dwGuildID);
while (it != cont.end())
{
LPDESC d = *(it++);
if (d->GetCharacter() && d->GetCharacter()->GetMapIndex() == pTable->lMapIndex)
{
// we must send the guild name first
d->GetCharacter()->SendGuildName(guild);
d->BufferedPacket(&p, sizeof(TPacketGCLandList));
d->Packet(&e, sizeof(TLandPacketElement));
}
}
}
示例3: SendWarPacket
void CWarMap::SendWarPacket(LPDESC d)
{
TPacketGCGuild pack;
TPacketGCGuildWar pack2;
pack.header = HEADER_GC_GUILD;
pack.subheader = GUILD_SUBHEADER_GC_WAR;
pack.size = sizeof(pack) + sizeof(pack2);
pack2.dwGuildSelf = m_TeamData[0].dwID;
pack2.dwGuildOpp = m_TeamData[1].dwID;
pack2.bType = CGuildManager::instance().TouchGuild(m_TeamData[0].dwID)->GetGuildWarType(m_TeamData[1].dwID);
pack2.bWarState = CGuildManager::instance().TouchGuild(m_TeamData[0].dwID)->GetGuildWarState(m_TeamData[1].dwID);
d->BufferedPacket(&pack, sizeof(pack));
d->Packet(&pack2, sizeof(pack2));
}