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); Human* GetWatchWarTarget(Human* hum);
bool BattleStarted(); bool BattleStarted();
int GetTeamNum(); int GetTeamNum();
Team* GetTeam(int team_id);
int GetAliveTeamNum(); int GetAliveTeamNum();
Team* GetAliveTeam(); Team* GetAliveTeam();
void TraverseTeams(std::function<bool (Team*)> cb); void TraverseTeams(std::function<bool (Team*)> cb);

View File

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