本文整理汇总了C++中NET_Packet::w_clientID方法的典型用法代码示例。如果您正苦于以下问题:C++ NET_Packet::w_clientID方法的具体用法?C++ NET_Packet::w_clientID怎么用?C++ NET_Packet::w_clientID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NET_Packet
的用法示例。
在下文中一共展示了NET_Packet::w_clientID方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void game_sv_GameState::net_Export_State (NET_Packet& P, ClientID to)
{
// Generic
P.w_clientID (to);
P.w_s32 (m_type);
P.w_u16 (m_phase);
P.w_s32 (m_round);
P.w_u32 (m_start_time);
P.w_u8 (u8(g_sv_base_iVotingEnabled&0xff));
P.w_u8 (u8(net_sv_control_hit));
P.w_u8 (u8(g_bCollectStatisticData));
// Players
// u32 p_count = get_players_count() - ((g_dedicated_server)? 1 : 0);
xrClientData* tmp_client = static_cast<xrClientData*>(
m_server->GetClientByID(to));
game_PlayerState* tmp_ps = tmp_client->ps;
player_exporter tmp_functor(to, tmp_ps, &P);
fastdelegate::FastDelegate1<IClient*, void> pcounter;
pcounter.bind(&tmp_functor, &player_exporter::count_players);
fastdelegate::FastDelegate1<IClient*, void> exporter;
exporter.bind(&tmp_functor, &player_exporter::export_players);
m_server->ForEachClientDo(pcounter);
P.w_u16(tmp_functor.counter);
m_server->ForEachClientDo(exporter);
net_Export_GameTime(P);
}
示例2: net_Export_Update
void game_sv_GameState::net_Export_Update(NET_Packet& P, ClientID id_to, ClientID id)
{
game_PlayerState* A = get_id(id);
if (A)
{
u16 bk_flags = A->flags__;
if (id==id_to)
{
A->setFlag(GAME_PLAYER_FLAG_LOCAL);
}
P.w_clientID (id);
A->net_Export (P);
A->flags__ = bk_flags;
};
net_Export_GameTime (P);
};
示例3:
void xrServer::OnCL_Disconnected (IClient* CL)
{
//csPlayers.Enter ();
// Game config (all, info includes deleted player now, excludes at the next cl-update)
NET_Packet P;
P.B.count = 0;
P.w_clientID(CL->ID);
xrClientData* xrCData = (xrClientData*)(CL);
VERIFY(xrCData);
if (!xrCData->ps)
return;
P.w_stringZ(xrCData->ps->getName());
P.w_u16(xrCData->ps->GameID);
P.r_pos = 0;
ClientID clientID;
clientID.set(0);
game->AddDelayedEvent(P,GAME_EVENT_PLAYER_DISCONNECTED, 0, clientID);
//
xrS_entities::iterator I=entities.begin(),E=entities.end();
if (GetClientsCount()>1 && !CL->flags.bLocal)
{
// Migrate entities
for (; I!=E; ++I)
{
CSE_Abstract* entity = I->second;
if (entity->owner == CL) PerformMigration (entity,(xrClientData*)CL,SelectBestClientToMigrateTo(entity,TRUE));
}
} else {
// Destroy entities
while (!entities.empty()) {
CSE_Abstract* entity = entities.begin()->second;
entity_Destroy (entity);
}
}
//csPlayers.Leave ();
Server_Client_Check(CL);
}
示例4: export_players
void __stdcall export_players(IClient* client)
{
xrClientData* tmp_client = static_cast<xrClientData*>(client);
if (!tmp_client->net_Ready ||
(tmp_client->ps->IsSkip() && tmp_client->ID != to_client))
{
return;
}
game_PlayerState* curr_ps = tmp_client->ps;
u16 tmp_flags = curr_ps->flags__;
if (to_ps == curr_ps)
curr_ps->setFlag(GAME_PLAYER_FLAG_LOCAL);
p_to_send->w_clientID (client->ID);
curr_ps->net_Export (*p_to_send, TRUE);
curr_ps->flags__ = tmp_flags;
}
示例5:
void xrServer::OnCL_Connected (IClient* _CL)
{
xrClientData* CL = (xrClientData*)_CL;
CL->net_Accepted = TRUE;
/// Server_Client_Check(CL);
csPlayers.Enter ();
Export_game_type(CL);
Perform_game_export();
SendConnectionData(CL);
//
NET_Packet P;
P.B.count = 0;
P.w_clientID(CL->ID);
P.r_pos = 0;
ClientID clientID;clientID.set (0);
game->AddDelayedEvent (P,GAME_EVENT_PLAYER_CONNECTED, 0, clientID);
csPlayers.Leave ();
game->ProcessDelayedEvent ();
}
示例6: ClientID
//.........这里部分代码省略.........
#ifndef MASTER_GOLD
if (game->Type() != eGameIDSingle)
Msg ("* [%2d] is [%s:%s]", id_dest, *e_dest->s_name, e_dest->name_replace());
#endif // #ifndef MASTER_GOLD
CSE_Abstract* e_src = game->get_entity_from_eid (id_src ); // кто убил
if (!e_src) {
xrClientData* C = (xrClientData*) game->get_client(id_src);
if (C) e_src = C->owner;
};
VERIFY (e_src);
if (!e_src)
{
Msg("! ERROR: SV: src killer not exist.");
return;
}
// R_ASSERT2 (e_dest && e_src, "Killer or/and being killed are offline or not exist at all :(");
#ifndef MASTER_GOLD
if (game->Type() != eGameIDSingle)
Msg ("* [%2d] is [%s:%s]", id_src, *e_src->s_name, e_src->name_replace());
#endif // #ifndef MASTER_GOLD
game->on_death (e_dest,e_src);
xrClientData* c_src = e_src->owner; // клиент, чей юнит убил
if (c_src->owner->ID == id_src) {
// Main unit
P.w_begin (M_EVENT);
P.w_u32 (timestamp);
P.w_u16 (type);
P.w_u16 (destination);
P.w_u16 (id_src);
P.w_clientID (c_src->ID);
}
SendBroadcast (BroadcastCID,P,MODE);
//////////////////////////////////////////////////////////////////////////
//
if (game->Type() == eGameIDSingle) {
P.w_begin (M_EVENT);
P.w_u32 (timestamp);
P.w_u16 (GE_KILL_SOMEONE);
P.w_u16 (id_src);
P.w_u16 (destination);
SendTo (c_src->ID, P, net_flags(TRUE, TRUE));
}
//////////////////////////////////////////////////////////////////////////
VERIFY (verify_entities());
}
break;
case GE_ADDON_ATTACH:
case GE_ADDON_DETACH:
case GE_CHANGE_POS:
{
SendTo(SV_Client->ID, P, net_flags(TRUE, TRUE));
}break;
case GE_INSTALL_UPGRADE:
{
shared_str upgrade_id;
P.r_stringZ ( upgrade_id );
CSE_ALifeInventoryItem* iitem = smart_cast<CSE_ALifeInventoryItem*>( receiver );
if ( !iitem )
{