From e6d60ff750009861bb10b88e6a47dd50a2a73672 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Sun, 5 May 2019 17:40:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=A7=86=E9=87=8E=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/gameserver/human.cc | 44 +++++++++++++++++++++++--- server/gameserver/human.h | 1 + server/tools/protobuild/cs_msgid.proto | 1 + server/tools/protobuild/cs_proto.proto | 6 ++++ 4 files changed, 48 insertions(+), 4 deletions(-) diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index 5a177b1..491b81a 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -878,6 +878,20 @@ void Human::OnGridListChange(std::set& old_grid_list, hum->AddToPartObjects(this); AddToNewObjects(hum); AddToPartObjects(hum); +#if 1 + { + hum->SendDebugMsg(a8::Format("myself:%d uniid:%d name:%s 进入你的视野", + { + hum->entity_uniid, + entity_uniid, + name})); + SendDebugMsg(a8::Format("myself:%d uniid:%d name:%s 进入你的视野", + { + entity_uniid, + hum->entity_uniid, + hum->name})); + } +#endif } } for (Entity* entity : cell->entity_list) { @@ -899,9 +913,24 @@ void Human::OnGridListChange(std::set& old_grid_list, } } for (GridCell* cell : dec_grid_list) { - for (Human* entity : cell->human_list) { - if (!room->grid_service.HumanInGridList(entity, grid_list)) { - OutObjects(entity); + for (Human* hum : cell->human_list) { + if (!room->grid_service.HumanInGridList(hum, grid_list)) { + OutObjects(hum); + hum->OutObjects(this); +#if 1 + { + hum->SendDebugMsg(a8::Format("myself:%d uniid:%d name:%s 退出你的视野", + { + hum->entity_uniid, + entity_uniid, + name})); + SendDebugMsg(a8::Format("myself:%d uniid:%d name:%s 退出你的视野", + { + entity_uniid, + hum->entity_uniid, + hum->name})); + } +#endif } } for (Entity* entity : cell->entity_list) { @@ -1338,6 +1367,13 @@ void Human::FollowTarget(Human* target) follow_synced_active_player = false; } +void Human::SendDebugMsg(const std::string& debug_msg) +{ + cs::SMDebugMsg notify_msg; + notify_msg.set_debug_msg(debug_msg); + SendNotifyMsg(notify_msg); +} + void Human::ClearFrameData() { if (!new_objects.empty()) { @@ -1359,7 +1395,7 @@ void Human::ClearFrameData() part_objects.erase(entity); } } - del_objects.clear(); + out_objects.clear(); } if (!shots_.empty()) { shots_.clear(); diff --git a/server/gameserver/human.h b/server/gameserver/human.h index b297ec3..909fd37 100644 --- a/server/gameserver/human.h +++ b/server/gameserver/human.h @@ -168,6 +168,7 @@ class Human : public Entity } void UpdateGameOver(); void FollowTarget(Human* target); + void SendDebugMsg(const std::string& debug_msg); private: void ClearFrameData(); diff --git a/server/tools/protobuild/cs_msgid.proto b/server/tools/protobuild/cs_msgid.proto index af4bea8..f26d1b0 100644 --- a/server/tools/protobuild/cs_msgid.proto +++ b/server/tools/protobuild/cs_msgid.proto @@ -29,4 +29,5 @@ enum SMMessageId_e _SMVoiceNotify = 1007; _SMDisconnectNotify = 1008; _SMGameOver = 1009; + _SMDebugMsg = 1010; } diff --git a/server/tools/protobuild/cs_proto.proto b/server/tools/protobuild/cs_proto.proto index f3df5f9..0ecd060 100755 --- a/server/tools/protobuild/cs_proto.proto +++ b/server/tools/protobuild/cs_proto.proto @@ -760,3 +760,9 @@ message SMVoiceNotify optional string account_id = 2; //唯一id optional string download_url = 3; //语音下载地址 } + +//调试信息 +message SMDebugMsg +{ + optional string debug_msg = 3; //调试信息 +}