添加调试信息

This commit is contained in:
aozhiwei 2019-09-19 11:35:21 +08:00
parent 793275c8a3
commit 5bb68a169e
3 changed files with 25 additions and 25 deletions

View File

@ -285,7 +285,7 @@ void Human::Shot(a8::Vec2& target_dir)
AutoLoadingBullet(); AutoLoadingBullet();
} }
need_sync_active_player = true; need_sync_active_player = true;
SyncAroundPlayers(); SyncAroundPlayers(__FILE__, __LINE__, __func__);
} }
break; break;
case 6: case 6:
@ -306,7 +306,7 @@ void Human::Shot(a8::Vec2& target_dir)
AutoLoadingBullet(); AutoLoadingBullet();
} }
need_sync_active_player = true; need_sync_active_player = true;
SyncAroundPlayers(); SyncAroundPlayers(__FILE__, __LINE__, __func__);
} }
break; break;
} }
@ -619,11 +619,11 @@ void Human::UpdatePoisoning()
poisoning_time -= 1000; poisoning_time -= 1000;
} }
if (need_notify && entity_subtype == EST_Player) { if (need_notify && entity_subtype == EST_Player) {
SyncAroundPlayers(); SyncAroundPlayers(__FILE__, __LINE__, __func__);
} }
} }
void Human::SyncAroundPlayers() void Human::SyncAroundPlayers(const char* file, int line, const char* func)
{ {
for (auto& cell : grid_list) { for (auto& cell : grid_list) {
for (Human* hum : cell->human_list) { for (Human* hum : cell->human_list) {
@ -762,7 +762,7 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
} else { } else {
((Human*)hum)->stats.kills++; ((Human*)hum)->stats.kills++;
((Human*)hum)->kill_humans.insert(this); ((Human*)hum)->kill_humans.insert(this);
((Human*)hum)->SyncAroundPlayers(); ((Human*)hum)->SyncAroundPlayers(__FILE__, __LINE__, __func__);
if (weapon_id == VW_Tank) { if (weapon_id == VW_Tank) {
std::string msg = a8::Format("%s 使用 %s 干掉了 %s", std::string msg = a8::Format("%s 使用 %s 干掉了 %s",
{ {
@ -831,7 +831,7 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
health = 0.0f; health = 0.0f;
dead_frameno = room->frame_no; dead_frameno = room->frame_no;
room->OnHumanDie(this); room->OnHumanDie(this);
SyncAroundPlayers(); SyncAroundPlayers(__FILE__, __LINE__, __func__);
if (team_members) { if (team_members) {
for (auto& hum : *team_members) { for (auto& hum : *team_members) {
if (hum != this && hum->action_type == AT_Relive && if (hum != this && hum->action_type == AT_Relive &&
@ -857,7 +857,7 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
member->health = 0.0f; member->health = 0.0f;
member->dead_frameno = room->frame_no; member->dead_frameno = room->frame_no;
member->room->OnHumanDie(this); member->room->OnHumanDie(this);
member->SyncAroundPlayers(); member->SyncAroundPlayers(__FILE__, __LINE__, __func__);
member->SendGameOver(); member->SendGameOver();
room->xtimer.DeleteTimer(member->downed_timer); room->xtimer.DeleteTimer(member->downed_timer);
member->downed_timer = nullptr; member->downed_timer = nullptr;
@ -938,7 +938,7 @@ void Human::DecHP(float dec_hp, int killer_id, const std::string& killer_name, i
} }
} }
} }
SyncAroundPlayers(); SyncAroundPlayers(__FILE__, __LINE__, __func__);
} }
void Human::AddToNewObjects(Entity* entity) void Human::AddToNewObjects(Entity* entity)
@ -1011,7 +1011,7 @@ void Human::Land()
} }
} }
FindLocation(); FindLocation();
SyncAroundPlayers(); SyncAroundPlayers(__FILE__, __LINE__, __func__);
} }
void Human::DoJump() void Human::DoJump()
@ -1020,7 +1020,7 @@ void Human::DoJump()
a8::UnSetBitFlag(status, HS_Fly); a8::UnSetBitFlag(status, HS_Fly);
a8::SetBitFlag(status, HS_Jump); a8::SetBitFlag(status, HS_Jump);
jump_frameno = room->frame_no; jump_frameno = room->frame_no;
SyncAroundPlayers(); SyncAroundPlayers(__FILE__, __LINE__, __func__);
room->xtimer.AddDeadLineTimerAndAttach(MetaMgr::Instance()->jump_time * SERVER_FRAME_RATE, room->xtimer.AddDeadLineTimerAndAttach(MetaMgr::Instance()->jump_time * SERVER_FRAME_RATE,
a8::XParams() a8::XParams()
.SetSender(this), .SetSender(this),
@ -1228,7 +1228,7 @@ void Human::DoGetDown()
tank_oil_value = 0.0f; tank_oil_value = 0.0f;
tank_oil_max = 0.0f; tank_oil_max = 0.0f;
RecalcSelfCollider(); RecalcSelfCollider();
SyncAroundPlayers(); SyncAroundPlayers(__FILE__, __LINE__, __func__);
room->NotifyUiUpdate(); room->NotifyUiUpdate();
need_sync_active_player = true; need_sync_active_player = true;
} }
@ -1850,7 +1850,7 @@ void Human::UpdateAction()
stats.heal_amount += health - old_health; stats.heal_amount += health - old_health;
DecInventory(item_meta->i->_inventory_slot(), 1); DecInventory(item_meta->i->_inventory_slot(), 1);
need_sync_active_player = true; need_sync_active_player = true;
SyncAroundPlayers(); SyncAroundPlayers(__FILE__, __LINE__, __func__);
} }
} }
} }
@ -1882,7 +1882,7 @@ void Human::UpdateAction()
hum->health += param.param1.GetDouble(); hum->health += param.param1.GetDouble();
hum->health = std::min(hum->health, hum->GetMaxHP()); hum->health = std::min(hum->health, hum->GetMaxHP());
hum->stats.heal_amount += hum->health - old_health; hum->stats.heal_amount += hum->health - old_health;
hum->SyncAroundPlayers(); hum->SyncAroundPlayers(__FILE__, __LINE__, __func__);
if (hum->room->frame_no - hum->pain_killer_frameno > hum->pain_killer_lastingtime * SERVER_FRAME_RATE) { if (hum->room->frame_no - hum->pain_killer_frameno > hum->pain_killer_lastingtime * SERVER_FRAME_RATE) {
hum->room->xtimer.DeleteTimer(hum->pain_killer_timer); hum->room->xtimer.DeleteTimer(hum->pain_killer_timer);
hum->pain_killer_timer = nullptr; hum->pain_killer_timer = nullptr;
@ -1924,7 +1924,7 @@ void Human::UpdateAction()
} }
++hum->stats.rescue_member; ++hum->stats.rescue_member;
} }
hum->SyncAroundPlayers(); hum->SyncAroundPlayers(__FILE__, __LINE__, __func__);
} }
break; break;
default: default:
@ -2355,7 +2355,7 @@ void Human::ProcLootSkin(Loot* entity, MetaData::Equip* item_meta)
pos = entity->pos; pos = entity->pos;
RecalcSelfCollider(); RecalcSelfCollider();
RecalcBuff(); RecalcBuff();
SyncAroundPlayers(); SyncAroundPlayers(__FILE__, __LINE__, __func__);
room->TakeOnCarObject(skin_tank.tank_uniid); room->TakeOnCarObject(skin_tank.tank_uniid);
room->NotifyUiUpdate(); room->NotifyUiUpdate();
room->frame_event.AddTankBulletNumChg(this); room->frame_event.AddTankBulletNumChg(this);
@ -2383,7 +2383,7 @@ void Human::ProcLootSkin(Loot* entity, MetaData::Equip* item_meta)
skill_meta = nullptr; skill_meta = nullptr;
} }
RecalcBuff(); RecalcBuff();
SyncAroundPlayers(); SyncAroundPlayers(__FILE__, __LINE__, __func__);
} }
} }
} }

View File

@ -151,7 +151,7 @@ class Human : public Entity
float GetRadius(); float GetRadius();
float GetMaxHP(); float GetMaxHP();
void UpdatePoisoning(); void UpdatePoisoning();
void SyncAroundPlayers(); void SyncAroundPlayers(const char* file, int line, const char* func);
void AutoLoadingBullet(bool manual = false); void AutoLoadingBullet(bool manual = false);
void StartAction(ActionType_e action_type, void StartAction(ActionType_e action_type,
int action_duration, int action_duration,

View File

@ -183,7 +183,7 @@ void Player::UpdateSelectWeapon()
curr_weapon = weapon; curr_weapon = weapon;
ResetAction(); ResetAction();
need_sync_active_player = true; need_sync_active_player = true;
SyncAroundPlayers(); SyncAroundPlayers(__FILE__, __LINE__, __func__);
if (old_weapon != weapon) { if (old_weapon != weapon) {
AutoLoadingBullet(); AutoLoadingBullet();
} }
@ -397,7 +397,7 @@ void Player::Shot()
} }
} }
need_sync_active_player = true; need_sync_active_player = true;
SyncAroundPlayers(); SyncAroundPlayers(__FILE__, __LINE__, __func__);
} }
break; break;
case 6: case 6:
@ -420,7 +420,7 @@ void Player::Shot()
} }
} }
need_sync_active_player = true; need_sync_active_player = true;
SyncAroundPlayers(); SyncAroundPlayers(__FILE__, __LINE__, __func__);
} }
break; break;
} }
@ -525,7 +525,7 @@ void Player::LootInteraction(Loot* entity)
weapons[0].Recalc(); weapons[0].Recalc();
} }
need_sync_active_player = true; need_sync_active_player = true;
SyncAroundPlayers(); SyncAroundPlayers(__FILE__, __LINE__, __func__);
} else { } else {
Weapon* weapon = nullptr; Weapon* weapon = nullptr;
if (weapons[GUN_SLOT1].weapon_id == 0) { if (weapons[GUN_SLOT1].weapon_id == 0) {
@ -556,7 +556,7 @@ void Player::LootInteraction(Loot* entity)
weapon->Recalc(); weapon->Recalc();
AutoLoadingBullet(); AutoLoadingBullet();
need_sync_active_player = true; need_sync_active_player = true;
SyncAroundPlayers(); SyncAroundPlayers(__FILE__, __LINE__, __func__);
} }
} }
break; break;
@ -655,7 +655,7 @@ void Player::LootInteraction(Loot* entity)
AutoLoadingBullet(); AutoLoadingBullet();
} }
need_sync_active_player = true; need_sync_active_player = true;
SyncAroundPlayers(); SyncAroundPlayers(__FILE__, __LINE__, __func__);
} }
break; break;
} }
@ -819,7 +819,7 @@ void Player::ProcPrepareItems(const ::google::protobuf::RepeatedField< ::google:
}//end for }//end for
need_sync_active_player = true; need_sync_active_player = true;
if (prepare_items.size() > 0) { if (prepare_items.size() > 0) {
SyncAroundPlayers(); SyncAroundPlayers(__FILE__, __LINE__, __func__);
} }
} }
@ -1003,7 +1003,7 @@ void Player::UpdateDropWeapon()
} }
} }
need_sync_active_player = true; need_sync_active_player = true;
SyncAroundPlayers(); SyncAroundPlayers(__FILE__, __LINE__, __func__);
} }
} }
} }