修复视野问题

This commit is contained in:
aozhiwei 2019-05-05 17:40:05 +08:00
parent eaf14c67fc
commit e6d60ff750
4 changed files with 48 additions and 4 deletions

View File

@ -878,6 +878,20 @@ void Human::OnGridListChange(std::set<GridCell*>& 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<GridCell*>& 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();

View File

@ -168,6 +168,7 @@ class Human : public Entity
}
void UpdateGameOver();
void FollowTarget(Human* target);
void SendDebugMsg(const std::string& debug_msg);
private:
void ClearFrameData();

View File

@ -29,4 +29,5 @@ enum SMMessageId_e
_SMVoiceNotify = 1007;
_SMDisconnectNotify = 1008;
_SMGameOver = 1009;
_SMDebugMsg = 1010;
}

View File

@ -760,3 +760,9 @@ message SMVoiceNotify
optional string account_id = 2; //id
optional string download_url = 3; //
}
//
message SMDebugMsg
{
optional string debug_msg = 3; //
}