1
This commit is contained in:
parent
13bad22749
commit
b5149a0e6e
@ -1666,11 +1666,14 @@ void Human::SendGameOver()
|
||||
if (room->IsNewBieRoom()) {
|
||||
return;
|
||||
}
|
||||
if (GetTeam()->HasPlayer()) {
|
||||
if (stats->abandon_battle == 1 || (GetTeam()->HasPlayer()) || GetTeam()->MemberHasOb()) {
|
||||
if (GetTeam()->already_report_battle) {
|
||||
cs::SMGameOver msg;
|
||||
FillSMGameOver(msg);
|
||||
SendNotifyMsg(msg);
|
||||
if (msg.settlement_new().battle_uuid().empty()) {
|
||||
abort();
|
||||
}
|
||||
SendMsgSelfAndOb(msg);
|
||||
#ifdef MYDEBUG
|
||||
if (IsPlayer()) {
|
||||
a8::XPrintf("SMGameOver:%s\n", {f8::PbToJson(&msg)});
|
||||
@ -1682,7 +1685,7 @@ void Human::SendGameOver()
|
||||
SendPersonalBattleReport();
|
||||
sent_personal_report_ = true;
|
||||
}
|
||||
if (GetTeam()->team_rank) {
|
||||
if (GetTeam()->team_rank && GetTeam()->HasPlayer()) {
|
||||
if (!GetTeam()->sending_battlereport) {
|
||||
GetTeam()->sending_battlereport = true;
|
||||
GetTeam()->SendTeamBattleReport(this);
|
||||
@ -1690,7 +1693,10 @@ void Human::SendGameOver()
|
||||
} else {
|
||||
cs::SMGameOver msg;
|
||||
FillSMGameOver(msg);
|
||||
SendNotifyMsg(msg);
|
||||
if (msg.settlement_new().battle_uuid().empty()) {
|
||||
abort();
|
||||
}
|
||||
SendMsgSelfAndOb(msg);
|
||||
#ifdef MYDEBUG
|
||||
if (IsPlayer()) {
|
||||
a8::XPrintf("SMGameOver:%s\n", {f8::PbToJson(&msg)});
|
||||
|
@ -2147,7 +2147,7 @@ void Room::AddObjectLater(RoomEntity* entity)
|
||||
|
||||
void Room::OnGameOver()
|
||||
{
|
||||
TraverseRawHumanList
|
||||
TraverseHumanList
|
||||
(
|
||||
[] (Human* ele_hum) -> bool
|
||||
{
|
||||
@ -2173,7 +2173,7 @@ void Room::OnGameOver()
|
||||
#endif
|
||||
RoomMgr::Instance()->AddOverRoom(room_uuid_);
|
||||
}
|
||||
TraverseRawHumanList
|
||||
TraverseHumanList
|
||||
(
|
||||
[] (Human* ele_hum) -> bool
|
||||
{
|
||||
|
@ -574,3 +574,30 @@ void Team::RemoveMember(Human* member)
|
||||
first_member_ = hum;
|
||||
}
|
||||
}
|
||||
|
||||
bool Team::MemberHasOb()
|
||||
{
|
||||
if (IsViewTeam()) {
|
||||
return false;
|
||||
}
|
||||
bool has = false;
|
||||
TraverseMembers
|
||||
(
|
||||
[&has] (Human* ele_hum) -> bool
|
||||
{
|
||||
ele_hum->TraverseObservers
|
||||
(
|
||||
[&has] (Human* ele_hum, bool& stop)
|
||||
{
|
||||
if (ele_hum->IsOb()) {
|
||||
has = true;
|
||||
stop = true;
|
||||
}
|
||||
});
|
||||
if (has) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
return has;
|
||||
}
|
||||
|
@ -60,6 +60,7 @@ class Team : public std::enable_shared_from_this<Team>
|
||||
void IncKillCount();
|
||||
int GetKillCount();
|
||||
long long GetLastKillFrameNo() { return last_kill_frameno_; }
|
||||
bool MemberHasOb();
|
||||
|
||||
private:
|
||||
int team_id_ = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user