添加调试日志

This commit is contained in:
aozhiwei 2020-05-25 11:28:30 +08:00
parent 7c94897a69
commit 445d360dfe
5 changed files with 68 additions and 1 deletions

View File

@ -2984,6 +2984,15 @@ void Human::DropItems(Obstacle* obstacle)
} else { } else {
++normal_drop_times_; ++normal_drop_times_;
} }
#ifdef DEBUG
a8::UdpLog::Instance()->Debug("DropItems normal:%d box:%d drop_id:%d is_treasure_box:%d",
{
normal_drop_times_,
box_drop_times_,
drop_id,
is_treasure_box ? 1 : 0
});
#endif
} }
void Human::RecalcBuffAttr() void Human::RecalcBuffAttr()
@ -3219,6 +3228,16 @@ void Human::AdjustDecHp(float old_health, float& new_health)
if (buff) { if (buff) {
if (GetHP() < GetMaxHP() * buff->meta->param1) { if (GetHP() < GetMaxHP() * buff->meta->param1) {
new_health = std::max(GetMaxHP() * buff->meta->param1, GetMaxHP()); new_health = std::max(GetMaxHP() * buff->meta->param1, GetMaxHP());
#ifdef DEBUG
a8::UdpLog::Instance()->Debug("触发新手保护buff %d %s %s %f %f",
{
room->room_idx,
account_id,
name,
old_health,
new_health
});
#endif
} }
} }
} }

View File

@ -201,6 +201,14 @@ void Room::AddPlayer(Player* hum)
if (buff_meta) { if (buff_meta) {
hum->AddBuff(buff_meta, 1); hum->AddBuff(buff_meta, 1);
} }
#ifdef DEBUG
a8::UdpLog::Instance()->Debug("添加新手buff %s %s %d",
{
hum->account_id,
hum->name,
buff_id
});
#endif
} }
} }
while (human_hash_.size() > ROOM_MAX_PLAYER_NUM) { while (human_hash_.size() > ROOM_MAX_PLAYER_NUM) {
@ -1730,6 +1738,13 @@ void Room::DisableHuman(Human* target)
void Room::ShuaNewBieAndroid(Human* target) void Room::ShuaNewBieAndroid(Human* target)
{ {
#ifdef DEBUG
a8::UdpLog::Instance()->Debug("ShuaNewBieAndroid %s %s",
{
target->account_id,
target->name
});
#endif
for (auto& pair : human_hash_) { for (auto& pair : human_hash_) {
if (pair.second->entity_subtype == EST_Android && if (pair.second->entity_subtype == EST_Android &&
a8::HasBitFlag(pair.second->status, HS_Disable)) { a8::HasBitFlag(pair.second->status, HS_Disable)) {
@ -1848,6 +1863,13 @@ void Room::DieAndroidTimerFunc()
void Room::ProcShuaAndroid(int shua_time, int shua_num) void Room::ProcShuaAndroid(int shua_time, int shua_num)
{ {
#ifdef DEBUG
a8::UdpLog::Instance()->Debug("ProcShuaAndroid shua_time:%d shua_num%d",
{
shua_time,
shua_num
});
#endif
for (auto& pair : human_hash_) { for (auto& pair : human_hash_) {
if (pair.second->entity_subtype == EST_Android && if (pair.second->entity_subtype == EST_Android &&
a8::HasBitFlag(pair.second->status, HS_Disable)) { a8::HasBitFlag(pair.second->status, HS_Disable)) {
@ -1858,6 +1880,13 @@ void Room::ProcShuaAndroid(int shua_time, int shua_num)
void Room::ProcDieAndroid(int die_time, int die_num) void Room::ProcDieAndroid(int die_time, int die_num)
{ {
#ifdef DEBUG
a8::UdpLog::Instance()->Debug("ProcDieAndroid die_time:%d die_num:%d",
{
die_time,
die_num
});
#endif
for (auto& pair : human_hash_) { for (auto& pair : human_hash_) {
if (pair.second->entity_subtype == EST_Android && if (pair.second->entity_subtype == EST_Android &&
a8::HasBitFlag(pair.second->status, HS_Disable)) { a8::HasBitFlag(pair.second->status, HS_Disable)) {

View File

@ -91,6 +91,7 @@ void RoomMgr::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg)
hdr.socket_handle, hdr.socket_handle,
msg); msg);
hum->meta = MetaMgr::Instance()->human_meta; hum->meta = MetaMgr::Instance()->human_meta;
hum->room = room;
hum->ProcPrepareItems(msg.prepare_items()); hum->ProcPrepareItems(msg.prepare_items());
hum->ProcPrepareItems2(msg.prepare_items2()); hum->ProcPrepareItems2(msg.prepare_items2());
room->AddPlayer(hum); room->AddPlayer(hum);

View File

@ -57,9 +57,27 @@ void RoomObstacle::RecalcSelfCollider()
break; break;
} }
} }
if (!self_collider_) {
#ifdef DEBUG
a8::UdpLog::Instance()->Debug("OnAddCollider %d %d %d",
{
room->room_idx,
entity_uniid,
(long long)self_collider_
});
#endif
}
} }
void RoomObstacle::OnRemoveCollider(ColliderComponent* collider) void RoomObstacle::OnRemoveCollider(ColliderComponent* collider)
{ {
#ifdef DEBUG
a8::UdpLog::Instance()->Debug("OnRemoveCollider %d %d %d",
{
room->room_idx,
entity_uniid,
(long long)collider
});
#endif
room->map_service->RemoveCollider(collider); room->map_service->RemoveCollider(collider);
} }

@ -1 +1 @@
Subproject commit 837e2d9f9e700a58f3536f97206c2abf39cd4303 Subproject commit 8303f98fe3cd6fa6ed60263676fa6b4a3beddeac