From c7e4891c2528317170b92a0a39c02a37c5907ac6 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Sat, 6 Jun 2009 21:41:40 +0000 Subject: work around to prevent division by zero by PopUp.ScoreDiff. may need review, why it happens at all. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1801 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/base/USingScores.pas | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/base') diff --git a/src/base/USingScores.pas b/src/base/USingScores.pas index 499e1188..89896d2d 100644 --- a/src/base/USingScores.pas +++ b/src/base/USingScores.pas @@ -750,7 +750,10 @@ begin aPlayers[PopUp.Player].ScoreDisplayed := Players[PopUp.Player].ScoreDisplayed + ScoreToAdd; // change bar positions - aPlayers[PopUp.Player].RBTarget := aPlayers[PopUp.Player].RBTarget + ScoreToAdd/PopUp.ScoreDiff * (PopUp.Rating / 20 - 0.26); + if PopUp.ScoreDiff = 0 then + Log.LogError('TSingScores.DrawPopUp', 'PopUp.ScoreDiff is 0 and we want to divide by it. No idea how this happens.') + else + aPlayers[PopUp.Player].RBTarget := aPlayers[PopUp.Player].RBTarget + ScoreToAdd/PopUp.ScoreDiff * (PopUp.Rating / 20 - 0.26); if (aPlayers[PopUp.Player].RBTarget > 1) then aPlayers[PopUp.Player].RBTarget := 1 else if (aPlayers[PopUp.Player].RBTarget < 0) then -- cgit v1.2.3