This commit is contained in:
aozhiwei 2020-05-28 11:32:14 +08:00
parent f800f29338
commit 69a655901d

View File

@ -1700,6 +1700,11 @@ void Room::SecondRandPoint()
break; break;
} }
} }
for (auto& pair : accountid_hash_) {
if (room_type == RT_MidBrid) {
pair.second->on_grid_chg = std::bind(&Room::OnHumanGridChg, this, std::placeholders::_1);
}
}
} }
void Room::NotifyGameStart() void Room::NotifyGameStart()
@ -1711,8 +1716,6 @@ void Room::NotifyGameStart()
pair.second->SendNotifyMsg(msg); pair.second->SendNotifyMsg(msg);
if (room_type == RT_NewBrid) { if (room_type == RT_NewBrid) {
first_newbie = pair.second; first_newbie = pair.second;
} else if (room_type == RT_MidBrid) {
pair.second->on_grid_chg = std::bind(&Room::OnHumanGridChg, this, std::placeholders::_1);
} }
} }
xtimer.AddDeadLineTimerAndAttach(SERVER_FRAME_RATE * 1, xtimer.AddDeadLineTimerAndAttach(SERVER_FRAME_RATE * 1,
@ -2085,6 +2088,7 @@ void Room::ProcDieAndroid(int die_time, int die_num)
if (pair.second->IsAndroid() && if (pair.second->IsAndroid() &&
!pair.second->real_dead && !pair.second->real_dead &&
pair.second->team_uuid.empty() && pair.second->team_uuid.empty() &&
a8::HasBitFlag(pair.second->status, HS_Disable) &&
!HasPlayerInRound(pair.second->GetPos(), VIEW_RANGE)) !HasPlayerInRound(pair.second->GetPos(), VIEW_RANGE))
{ {
Android* hum = (Android*)pair.second; Android* hum = (Android*)pair.second;
@ -2174,7 +2178,7 @@ void Room::CheckAutoDie(Human* target,
} else { } else {
for (auto& pair : human_hash_) { for (auto& pair : human_hash_) {
if (pair.second->entity_uniid != target->entity_uniid && if (pair.second->entity_uniid != target->entity_uniid &&
pair.second->entity_subtype == EST_Android && pair.second->IsAndroid() &&
!pair.second->real_dead && !pair.second->real_dead &&
a8::HasBitFlag(pair.second->status, HS_Disable)) { a8::HasBitFlag(pair.second->status, HS_Disable)) {
Android* hum = (Android*)pair.second; Android* hum = (Android*)pair.second;
@ -2238,7 +2242,7 @@ void Room::ProcDisableHuman()
void Room::OnHumanGridChg(Human* target) void Room::OnHumanGridChg(Human* target)
{ {
#if 1 int count = 0;
for (auto& pair : human_hash_) { for (auto& pair : human_hash_) {
Human* hum = pair.second; Human* hum = pair.second;
if (hum->IsAndroid() && if (hum->IsAndroid() &&
@ -2248,7 +2252,10 @@ void Room::OnHumanGridChg(Human* target)
grid_service->InView(target->grid_id, hum->GetPos().x, hum->GetPos().y) grid_service->InView(target->grid_id, hum->GetPos().x, hum->GetPos().y)
) { ) {
EnableHuman(hum); EnableHuman(hum);
++count;
} }
} }
#ifdef DEBUG
a8::UdpLog::Instance()->Debug("OnHumanGrid %d %d", {target->grid_id, count});
#endif #endif
} }