修复组队结算问题

This commit is contained in:
aozhiwei 2019-06-26 17:54:57 +08:00
parent e15d50950a
commit 8bd922db5b
2 changed files with 42 additions and 35 deletions

View File

@ -560,6 +560,7 @@ void Human::ResetAction()
void Human::FillSMGameOver(cs::SMGameOver& msg)
{
if (stats.rank <= 0) {
std::vector<Human*> human_list;
room->TouchHumanList(a8::XParams(),
[&human_list] (Human* hum, a8::XParams& param) -> bool
@ -587,12 +588,17 @@ void Human::FillSMGameOver(cs::SMGameOver& msg)
break;
}
}
if (!dead && room->GetAliveTeamNum() == 1) {
if (room->GetAliveTeamNum() == 1) {
std::set<Human*>* alive_team = room->GetAliveTeam();
if (alive_team == team_members) {
rank = 1;
}
}
stats.rank = rank;
}
msg.set_team_id(team_id);
msg.set_team_rank(rank);
msg.set_team_rank(stats.rank);
msg.set_team_allcnt(1);
msg.set_game_over(room->game_over);
msg.set_victory(!dead);
@ -713,15 +719,15 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
}
}
if (room->GetAliveTeamNum() == 1) {
std::set<Human*>* members = room->GetAliveTeam();
if (members) {
for (Human* member : *members) {
std::set<Human*>* alive_team = room->GetAliveTeam();
if (team_members != alive_team) {
SendGameOver();
}
if (alive_team) {
for (Human* member : *alive_team) {
member->SendGameOver();
}
}
if (team_members != members) {
SendGameOver();
}
}
DeadDrop();
}

View File

@ -87,6 +87,7 @@ struct PlayerStats
std::string killer_name;
int weapon_id = 0;
int rank = 0;
};
struct Plane