Core/Arena: Fix an exploit which made you gain personal rating when you leave arena, and add some comments to the arena system (which I should have done way earlier).

--HG--
branch : trunk
This commit is contained in:
Liberate
2010-10-07 16:35:08 +02:00
parent 31d4a34000
commit 6a504b983c
2 changed files with 4 additions and 1 deletions
@@ -644,6 +644,7 @@ int32 ArenaTeam::GetRatingMod(uint32 own_rating, uint32 enemy_rating, bool won,
int32 ArenaTeam::GetPersonalRatingMod(int32 base_rating, uint32 own_rating, uint32 enemy_rating)
{
// max (2 * team rating gain/loss), min 0 gain/loss
float chance = GetChanceAgainst(own_rating, enemy_rating);
chance *= 2.0f;
return (int32)ceil(float(base_rating) * chance);
@@ -671,6 +672,7 @@ void ArenaTeam::FinishGame(int32 mod)
int32 ArenaTeam::WonAgainst(uint32 againstRating)
{
// called when the team has won
// own team rating versus opponents matchmaker rating
int32 mod = GetRatingMod(m_stats.rating, againstRating, true);
// modify the team stats accordingly
@@ -685,6 +687,7 @@ int32 ArenaTeam::WonAgainst(uint32 againstRating)
int32 ArenaTeam::LostAgainst(uint32 againstRating)
{
// called when the team has lost
// own team rating versus opponents matchmaker rating
int32 mod = GetRatingMod(m_stats.rating, againstRating, false);
// modify the team stats accordingly