本文整理汇总了C++中NET_Packet::r_stringZ方法的典型用法代码示例。如果您正苦于以下问题:C++ NET_Packet::r_stringZ方法的具体用法?C++ NET_Packet::r_stringZ怎么用?C++ NET_Packet::r_stringZ使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NET_Packet
的用法示例。
在下文中一共展示了NET_Packet::r_stringZ方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CLevel__cl_Process_CustomEventServer
void CLevel__cl_Process_CustomEventServer(NET_Packet& pack)
{
if (HookHandle->IsServer()) {
unsigned char type = 0;
pack.r_u8(type);
if (type == e_so_engine_packet) {
unsigned char e;
pack.r_u8(e);
switch (e) {
case e_add_money: {
LogHandle->Write("CLevel__cl_Process_CustomEventServer add money event");
ClientID cl_id;
pack.r_clientID(cl_id);
HookHandle->Add_money_mp(cl_id);
}break;
default:
LogHandle->Write("CLevel__cl_Process_CustomEventServer unknown event %d",e);
break;
}
} else if (type == e_so_script_packet) {
char data[2048];
pack.r_stringZ(data);
LogHandle->Write("Recieved data at server side '%s'",data);
HookHandle->messanges_sv.push_back(data);
} else {
LogHandle->Write("ERROR: CLevel__cl_Process_CustomEventServer unknown type");
}
}
}
示例2:
void game_cl_Deathmatch::net_import_state (NET_Packet& P)
{
inherited::net_import_state (P);
m_s32FragLimit = P.r_s32();
m_s32TimeLimit = P.r_s32() * 60000;
m_u32ForceRespawn = P.r_u32() * 1000;
m_cl_dwWarmUp_Time = P.r_u32();
m_bDamageBlockIndicators = !!P.r_u8();
// Teams
u16 t_count;
P.r_u16 (t_count);
teams.clear ();
for (u16 t_it=0; t_it<t_count; ++t_it)
{
game_TeamState ts;
P.r (&ts,sizeof(game_TeamState));
teams.push_back (ts);
};
switch (Phase())
{
case GAME_PHASE_PLAYER_SCORES:
{
P.r_stringZ(WinnerName);
bool NeedSndMessage = (xr_strlen(WinnerName) != 0);
if (NeedSndMessage && local_player && !xr_strcmp(WinnerName, local_player->getName()))
{
PlaySndMessage(ID_YOU_WON);
}
}break;
}
}
示例3:
void game_PlayerState::net_Import(NET_Packet& P)
{
BOOL bFullUpdate = !!P.r_u8();
if (bFullUpdate)
P.r_stringZ (name);
P.r_u8 ( team );
P.r_s16 ( m_iRivalKills );
P.r_s16 ( m_iSelfKills );
P.r_s16 ( m_iTeamKills );
P.r_s16 ( m_iDeaths );
P.r_s32 ( money_for_round );
P.r_float_q8 ( experience_D, -1.0f, 2.0f);
P.r_u8 ( rank );
P.r_u8 ( af_count );
P.r_u16 ( flags__ );
P.r_u16 ( ping );
P.r_u16 ( GameID );
P.r_s8 ( skin );
P.r_u8 ( m_bCurrentVoteAgreed );
DeathTime = P.r_u32();
};
示例4: OnEvent
void CInventoryItem::OnEvent (NET_Packet& P, u16 type)
{
switch (type)
{
case GE_ADDON_ATTACH:
{
u16 ItemID;
P.r_u16 (ItemID);
CInventoryItem* ItemToAttach = smart_cast<CInventoryItem*>(Level().Objects.net_Find(ItemID));
if (!ItemToAttach) break;
Attach(ItemToAttach,true);
}break;
case GE_ADDON_DETACH:
{
string64 i_name;
P.r_stringZ (i_name);
Detach(i_name, true);
}break;
case GE_CHANGE_POS:
{
Fvector p;
P.r_vec3(p);
CPHSynchronize* pSyncObj = NULL;
pSyncObj = object().PHGetSyncItem(0);
if (!pSyncObj) return;
SPHNetState state;
pSyncObj->get_State(state);
state.position = p;
state.previous_position = p;
pSyncObj->set_State(state);
}break;
}
}
示例5:
void CALifeStorageManager::save (NET_Packet &net_packet)
{
prepare_objects_for_save ();
shared_str game_name;
net_packet.r_stringZ (game_name);
save (*game_name,!!net_packet.r_u8());
}
示例6: GetPlayerByGameID
void game_cl_TeamDeathmatch::TranslateGameMessage (u32 msg, NET_Packet& P)
{
CStringTable st;
string512 Text;
// LPSTR Color_Teams[3] = {"%c[255,255,255,255]", "%c[255,64,255,64]", "%c[255,64,64,255]"};
char Color_Main[] = "%c[255,192,192,192]";
// LPSTR TeamsNames[3] = {"Zero Team", "Team Green", "Team Blue"};
switch(msg) {
case GAME_EVENT_PLAYER_JOIN_TEAM: //tdm
{
string64 PlayerName;
P.r_stringZ (PlayerName);
u16 Team;
P.r_u16 (Team);
sprintf_s(Text, "%s%s %s%s %s%s",
"",//no color
PlayerName,
Color_Main,
*st.translate("mp_joined"),
CTeamInfo::GetTeam_color_tag(int(Team)),
CTeamInfo::GetTeam_name(int(Team)));
CommonMessageOut(Text);
//---------------------------------------
Msg("%s %s %s", PlayerName, *st.translate("mp_joined"),
CTeamInfo::GetTeam_name(int(Team)));
}break;
case PLAYER_CHANGE_TEAM://tdm
{
u16 PlayerID, OldTeam, NewTeam;
P.r_u16 (PlayerID);
P.r_u16 (OldTeam);
P.r_u16 (NewTeam);
game_PlayerState* pPlayer = GetPlayerByGameID(PlayerID);
if (!pPlayer) break;
sprintf_s(Text, "%s%s %s%s %s%s",
CTeamInfo::GetTeam_color_tag(int(OldTeam)),
pPlayer->name,
Color_Main,
*st.translate("mp_switched_to"),
CTeamInfo::GetTeam_color_tag(int(NewTeam)),
CTeamInfo::GetTeam_name(int(NewTeam)));
CommonMessageOut(Text);
//---------------------------------------
Msg("%s *s %s", pPlayer->name, *st.translate("mp_switched_to"), CTeamInfo::GetTeam_name(int(NewTeam)));
}break;
default:
inherited::TranslateGameMessage(msg,P);
};
}
示例7:
void CSE_ALifeItemDocument::STATE_Read (NET_Packet &tNetPacket, u16 size)
{
inherited::STATE_Read (tNetPacket,size);
if ( m_wVersion < 98 ){
u16 tmp;
tNetPacket.r_u16 (tmp);
m_wDoc = NULL;
}else
tNetPacket.r_stringZ (m_wDoc);
}
示例8:
u16 GetSpawnInfo(NET_Packet &P, u16 &parent_id)
{
u16 dummy16, id;
P.r_begin(dummy16);
shared_str s_name;
P.r_stringZ(s_name);
CSE_Abstract* E = F_entity_Create(*s_name);
E->Spawn_Read(P);
if (E->s_flags.is(M_SPAWN_UPDATE))
E->UPDATE_Read(P);
id = E->ID;
parent_id = E->ID_Parent;
F_entity_Destroy(E);
P.r_pos = 0;
return id;
}
示例9: OnEvent
void CInventoryItem::OnEvent (NET_Packet& P, u16 type)
{
switch (type)
{
case GE_ADDON_ATTACH:
{
u32 ItemID;
P.r_u32 (ItemID);
CInventoryItem* ItemToAttach = smart_cast<CInventoryItem*>(Level().Objects.net_Find(ItemID));
if (!ItemToAttach) break;
Attach(ItemToAttach,true);
CActor* pActor = smart_cast<CActor*>(object().H_Parent());
if (pActor && pActor->inventory().ActiveItem() == this)
{
pActor->inventory().SetPrevActiveSlot(pActor->inventory().GetActiveSlot());
pActor->inventory().Activate(NO_ACTIVE_SLOT);
}
}break;
case GE_ADDON_DETACH:
{
string64 i_name;
P.r_stringZ (i_name);
Detach(i_name, true);
CActor* pActor = smart_cast<CActor*>(object().H_Parent());
if (pActor && pActor->inventory().ActiveItem() == this)
{
pActor->inventory().SetPrevActiveSlot(pActor->inventory().GetActiveSlot());
pActor->inventory().Activate(NO_ACTIVE_SLOT);
};
}break;
case GE_CHANGE_POS:
{
Fvector p;
P.r_vec3(p);
CPHSynchronize* pSyncObj = NULL;
pSyncObj = object().PHGetSyncItem(0);
if (!pSyncObj) return;
SPHNetState state;
pSyncObj->get_State(state);
state.position = p;
state.previous_position = p;
pSyncObj->set_State(state);
}break;
}
}
示例10:
void CSE_SmartCover::STATE_Read (NET_Packet &tNetPacket, u16 size)
{
inherited1::STATE_Read (tNetPacket, size);
cform_read (tNetPacket);
tNetPacket.r_stringZ (m_description);
m_hold_position_time = tNetPacket.r_float();
if (m_wVersion >= 120) {
m_enter_min_enemy_distance = tNetPacket.r_float();
m_exit_min_enemy_distance = tNetPacket.r_float();
}
if (m_wVersion >= 122)
m_is_combat_cover = tNetPacket.r_u8();
if (m_wVersion >= 128)
m_can_fire = tNetPacket.r_u8();
}
示例11: movement
void CAI_Stalker::net_Import (NET_Packet& P)
{
R_ASSERT (Remote());
net_update N;
u8 flags;
P.r_float ();
set_money ( P.r_u32(), false );
float health;
P.r_float (health);
SetfHealth (health);
// fEntityHealth = health;
P.r_u32 (N.dwTimeStamp);
P.r_u8 (flags);
P.r_vec3 (N.p_pos);
P.r_float /*r_angle8*/ (N.o_model);
P.r_float /*r_angle8*/ (N.o_torso.yaw);
P.r_float /*r_angle8*/ (N.o_torso.pitch);
P.r_float /*r_angle8*/ (N.o_torso.roll );
id_Team = P.r_u8();
id_Squad = P.r_u8();
id_Group = P.r_u8();
GameGraph::_GRAPH_ID graph_vertex_id = movement().game_dest_vertex_id();
P.r (&graph_vertex_id, sizeof(GameGraph::_GRAPH_ID));
graph_vertex_id = ai_location().game_vertex_id();
P.r (&graph_vertex_id, sizeof(GameGraph::_GRAPH_ID));
if (NET.empty() || (NET.back().dwTimeStamp<N.dwTimeStamp)) {
NET.push_back (N);
NET_WasInterpolating = TRUE;
}
P.r_float ();
P.r_float ();
P.r_stringZ (m_sStartDialog);
setVisible (TRUE);
setEnabled (TRUE);
}
示例12: OnEvent
void CInventoryOwner::OnEvent (NET_Packet& P, u16 type)
{
switch (type)
{
case GE_INFO_TRANSFER:
{
u16 id;
shared_str info_id;
u8 add_info;
P.r_u16 (id); //отправитель
P.r_stringZ (info_id); //номер полученной информации
P.r_u8 (add_info); //добавление или убирание информации
if(add_info)
OnReceiveInfo (info_id);
else
OnDisableInfo (info_id);
}
break;
}
}
示例13: CLevel__cl_Process_CustomEvent
void CLevel__cl_Process_CustomEvent(NET_Packet& pack)
{
if (!HookHandle->IsServer() || (HookHandle->IsServer() && !HookHandle->IsDedicated())) {
unsigned char type = 0;
pack.r_u8(type);
if (type == e_so_engine_packet) {
unsigned char e;
pack.r_u8(e);
switch (e) {
default:
LogHandle->Write("CLevel__cl_Process_CustomEvent unknown event %d",e);
break;
}
} else if (type == e_so_script_packet) {
char data[2048];
pack.r_stringZ(data);
LogHandle->Write("Recieved data at client side '%s'",data);
HookHandle->messanges_cl.push_back(data);
} else {
LogHandle->Write("ERROR: CLevel__cl_Process_CustomEvent unknown type");
}
}
}
示例14: cl_Process_Spawn
void CLevel::cl_Process_Spawn(NET_Packet& P)
{
// Begin analysis
shared_str s_name;
P.r_stringZ (s_name);
// Create DC (xrSE)
CSE_Abstract* E = F_entity_Create (*s_name);
R_ASSERT2(E, *s_name);
E->Spawn_Read (P);
if (E->s_flags.is(M_SPAWN_UPDATE))
E->UPDATE_Read (P);
if (!E->match_configuration())
{
F_entity_Destroy(E);
return;
}
//-------------------------------------------------
//. Msg ("M_SPAWN - %s[%d][%x] - %d %d", *s_name, E->ID, E,E->ID_Parent, Device.dwFrame);
//-------------------------------------------------
//force object to be local for server client
if (OnServer()) {
E->s_flags.set(M_SPAWN_OBJECT_LOCAL, TRUE);
};
/*
game_spawn_queue.push_back(E);
if (g_bDebugEvents) ProcessGameSpawns();
/*/
g_sv_Spawn (E);
F_entity_Destroy (E);
//*/
};
示例15: graph
void CGameGraphBuilder::load_graph_point (NET_Packet &net_packet)
{
string256 section_id;
u16 id;
net_packet.r_begin (id);
R_ASSERT (M_SPAWN == id);
net_packet.r_stringZ (section_id);
// if (xr_strcmp("graph_point",section_id))
// return;
CSE_Abstract *entity = F_entity_Create(section_id);
if (!entity) {
Msg ("Cannot create entity from section %s, skipping",section_id);
return;
}
CSE_ALifeGraphPoint *graph_point = smart_cast<CSE_ALifeGraphPoint*>(entity);
if (!graph_point) {
F_entity_Destroy (entity);
return;
}
entity->Spawn_Read (net_packet);
vertex_type vertex;
vertex.tLocalPoint = graph_point->o_Position;
// check for duplicate graph point positions
{
graph_type::const_vertex_iterator I = graph().vertices().begin();
graph_type::const_vertex_iterator E = graph().vertices().end();
for ( ; I != E; ++I) {
if ((*I).second->data().tLocalPoint.distance_to_sqr(vertex.tLocalPoint) < EPS_L) {
Msg ("! removing graph point [%s][%f][%f][%f] because it is too close to the another graph point",entity->name_replace(),VPUSH(entity->o_Position));
return;
}
}
}
vertex.tGlobalPoint = graph_point->o_Position;
vertex.tNodeID = level_graph().valid_vertex_position(vertex.tLocalPoint) ? level_graph().vertex_id(vertex.tLocalPoint) : u32(-1);
if (!level_graph().valid_vertex_id(vertex.tNodeID)) {
Msg ("! removing graph point [%s][%f][%f][%f] because it is outside of the AI map",entity->name_replace(),VPUSH(entity->o_Position));
return;
}
{
graph_type::const_vertex_iterator I = graph().vertices().begin();
graph_type::const_vertex_iterator E = graph().vertices().end();
for ( ; I != E; ++I) {
if ((*I).second->data().tNodeID == vertex.tNodeID) {
Msg ("! removing graph point [%s][%f][%f][%f] because it has the same AI node as another graph point",entity->name_replace(),VPUSH(entity->o_Position));
return;
}
}
}
vertex.tNeighbourCount = 0;
Memory.mem_copy (vertex.tVertexTypes,graph_point->m_tLocations,GameGraph::LOCATION_TYPE_COUNT*sizeof(GameGraph::_LOCATION_ID));
vertex.tLevelID = 0;
vertex.tDeathPointCount = 0;
vertex.dwPointOffset = 0;
graph().add_vertex (vertex,graph().vertices().size());
F_entity_Destroy (entity);
}