本文整理汇总了C++中NET_Packet::write_start方法的典型用法代码示例。如果您正苦于以下问题:C++ NET_Packet::write_start方法的具体用法?C++ NET_Packet::write_start怎么用?C++ NET_Packet::write_start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NET_Packet
的用法示例。
在下文中一共展示了NET_Packet::write_start方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void CLevel::g_sv_Spawn (CSE_Abstract* E)
{
#ifdef DEBUG_MEMORY_MANAGER
u32 E_mem = 0;
if (g_bMEMO) {
lua_gc (ai().script_engine().lua(),LUA_GCCOLLECT,0);
lua_gc (ai().script_engine().lua(),LUA_GCCOLLECT,0);
E_mem = Memory.mem_usage();
Memory.stat_calls = 0;
}
#endif // DEBUG_MEMORY_MANAGER
//-----------------------------------------------------------------
// CTimer T(false);
#ifdef DEBUG
// Msg ("* CLIENT: Spawn: %s, ID=%d", *E->s_name, E->ID);
#endif
// Optimization for single-player only - minimize traffic between client and server
if (GameID() == eGameIDSingle) psNET_Flags.set (NETFLAG_MINIMIZEUPDATES,TRUE);
else psNET_Flags.set (NETFLAG_MINIMIZEUPDATES,FALSE);
// Client spawn
// T.Start ();
CObject* O = Objects.Create (*E->s_name);
// Msg ("--spawn--CREATE: %f ms",1000.f*T.GetAsync());
// T.Start ();
#ifdef DEBUG_MEMORY_MANAGER
mem_alloc_gather_stats (false);
#endif // DEBUG_MEMORY_MANAGER
if (0==O || (!O->net_Spawn (E)))
{
O->net_Destroy ( );
if(!g_dedicated_server)
client_spawn_manager().clear(O->ID());
Objects.Destroy (O);
Msg ("! Failed to spawn entity '%s'",*E->s_name);
#ifdef DEBUG_MEMORY_MANAGER
mem_alloc_gather_stats (!!psAI_Flags.test(aiDebugOnFrameAllocs));
#endif // DEBUG_MEMORY_MANAGER
} else {
#ifdef DEBUG_MEMORY_MANAGER
mem_alloc_gather_stats (!!psAI_Flags.test(aiDebugOnFrameAllocs));
#endif // DEBUG_MEMORY_MANAGER
if(!g_dedicated_server)
client_spawn_manager().callback(O);
//Msg ("--spawn--SPAWN: %f ms",1000.f*T.GetAsync());
if ((E->s_flags.is(M_SPAWN_OBJECT_LOCAL)) &&
(E->s_flags.is(M_SPAWN_OBJECT_ASPLAYER)) )
{
if (IsDemoPlayStarted())
{
if (E->s_flags.is(M_SPAWN_OBJECT_PHANTOM))
{
SetControlEntity (O);
SetEntity (O); //do not switch !!!
SetDemoSpectator (O);
}
} else
{
if (CurrentEntity() != NULL)
{
CGameObject* pGO = smart_cast<CGameObject*>(CurrentEntity());
if (pGO) pGO->On_B_NotCurrentEntity();
}
SetControlEntity (O);
SetEntity (O); //do not switch !!!
}
}
if (0xffff != E->ID_Parent)
{
/*
// Generate ownership-event
NET_Packet GEN;
GEN.w_begin (M_EVENT);
GEN.w_u32 (E->m_dwSpawnTime);//-NET_Latency);
GEN.w_u16 (GE_OWNERSHIP_TAKE);
GEN.w_u16 (E->ID_Parent);
GEN.w_u16 (u16(O->ID()));
game_events->insert (GEN);
/*/
NET_Packet GEN;
GEN.write_start();
GEN.read_start();
GEN.w_u16 (u16(O->ID()));
cl_Process_Event(E->ID_Parent, GE_OWNERSHIP_TAKE, GEN);
//*/
}
}
/*if (E->s_flags.is(M_SPAWN_UPDATE)) {
NET_Packet temp;
temp.B.count = 0;
E->UPDATE_Write (temp);
if (temp.B.count > 0)
{
temp.r_seek (0);
//.........这里部分代码省略.........