This commit is contained in:
azw 2023-03-22 09:14:44 +00:00
parent 3e9b34cbe0
commit 073da111a4
3 changed files with 23 additions and 9 deletions

View File

@ -3835,3 +3835,9 @@ void Room::CreateWorldObjects()
}
}
}
Team* Room::GetTeam(int team_id)
{
auto itr = team_hash_.find(team_id);
return itr != team_hash_.end() ? itr->second : nullptr;
}

View File

@ -164,6 +164,7 @@ public:
Human* GetWatchWarTarget(Human* hum);
bool BattleStarted();
int GetTeamNum();
Team* GetTeam(int team_id);
int GetAliveTeamNum();
Team* GetAliveTeam();
void TraverseTeams(std::function<bool (Team*)> cb);

View File

@ -11,6 +11,7 @@
#include "stats.h"
#include "jsondatamgr.h"
#include "httpproxy.h"
#include "roommgr.h"
#include "mt/Map.h"
#include "mt/Hero.h"
@ -219,19 +220,25 @@ void Team::SendTeamBattleReport(Human* sender)
[room_uuid, team_id]
(bool ok, a8::XObject* rsp_obj, f8::HttpContext* ctx)
{
Room* room = RoomMgr::Instance()->GetRoomByUuid(room_uuid);
if (room) {
Team* team = room->GetTeam(team_id);
if (team) {
team->already_report_battle = true;
team->sending_battlereport = false;
team->TraverseMembers
(
[] (Human* hum)
{
hum->SendGameOver();
return true;
});
}
}
},
url.c_str(),
*params.get()
);
already_report_battle = true;
sending_battlereport = false;
TraverseMembers
(
[] (Human* hum)
{
hum->SendGameOver();
return true;
});
}
void Team::GenBattleReportData(a8::MutableXObject* params)