Reset intels and team scores after receiving winning IntelCapture
This problem was originally reported in: <https://github.com/piqueserver/piqueserver/issues/586> Upon receiving `IntelCapture` with `winning = 1`, the voxlap client resets both team scores and the holding status of both teams' intels, but OpenSpades didn't do that, resulting in a weird behavior described in piqueserver/piqueserver#586. This commit changes OpenSpades' behavior to be congruent with the voxlap client's behavior. Fixes #890.
This commit is contained in:
parent
a455307017
commit
4fbe5ee5ce
@ -44,5 +44,12 @@ namespace spades {
|
||||
auto &team = teams[player.GetTeamId()];
|
||||
return team.hasIntel && team.carrier == player.GetId();
|
||||
}
|
||||
|
||||
void CTFGameMode::ResetTeamScoreAndIntelHoldingStatus() {
|
||||
for (Team &team : teams) {
|
||||
team.score = 0;
|
||||
team.hasIntel = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -50,6 +50,14 @@ namespace spades {
|
||||
void SetCaptureLimit(int v) { captureLimit = v; }
|
||||
|
||||
bool PlayerHasIntel(World &world, Player &player);
|
||||
|
||||
/**
|
||||
* Resets both team score and the holding status of both flags.
|
||||
*
|
||||
* This is what the vanila client does upon receiving a winning
|
||||
* `IntelCapture`.
|
||||
*/
|
||||
void ResetTeamScoreAndIntelHoldingStatus();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -1399,8 +1399,10 @@ namespace spades {
|
||||
ctf->GetTeam(p->GetTeamId()).score++;
|
||||
|
||||
bool winning = reader.ReadByte() != 0;
|
||||
if (winning)
|
||||
if (winning) {
|
||||
ctf->ResetTeamScoreAndIntelHoldingStatus();
|
||||
client->TeamWon(p->GetTeamId());
|
||||
}
|
||||
} break;
|
||||
case PacketTypeIntelPickup: {
|
||||
Player *p = GetPlayer(reader.ReadByte());
|
||||
|
Loading…
x
Reference in New Issue
Block a user