diff --git a/server/gameserver/room.cc b/server/gameserver/room.cc index dbb849c..6b367e1 100644 --- a/server/gameserver/room.cc +++ b/server/gameserver/room.cc @@ -1700,6 +1700,11 @@ void Room::SecondRandPoint() 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() @@ -1711,8 +1716,6 @@ void Room::NotifyGameStart() pair.second->SendNotifyMsg(msg); if (room_type == RT_NewBrid) { 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, @@ -2085,6 +2088,7 @@ void Room::ProcDieAndroid(int die_time, int die_num) if (pair.second->IsAndroid() && !pair.second->real_dead && pair.second->team_uuid.empty() && + a8::HasBitFlag(pair.second->status, HS_Disable) && !HasPlayerInRound(pair.second->GetPos(), VIEW_RANGE)) { Android* hum = (Android*)pair.second; @@ -2174,7 +2178,7 @@ void Room::CheckAutoDie(Human* target, } else { for (auto& pair : human_hash_) { if (pair.second->entity_uniid != target->entity_uniid && - pair.second->entity_subtype == EST_Android && + pair.second->IsAndroid() && !pair.second->real_dead && a8::HasBitFlag(pair.second->status, HS_Disable)) { Android* hum = (Android*)pair.second; @@ -2238,7 +2242,7 @@ void Room::ProcDisableHuman() void Room::OnHumanGridChg(Human* target) { - #if 1 + int count = 0; for (auto& pair : human_hash_) { Human* hum = pair.second; if (hum->IsAndroid() && @@ -2248,7 +2252,10 @@ void Room::OnHumanGridChg(Human* target) grid_service->InView(target->grid_id, hum->GetPos().x, hum->GetPos().y) ) { EnableHuman(hum); + ++count; } } + #ifdef DEBUG + a8::UdpLog::Instance()->Debug("OnHumanGrid %d %d", {target->grid_id, count}); #endif }