aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authork-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-06-06 21:41:40 +0000
committerk-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-06-06 21:41:40 +0000
commitc7e4891c2528317170b92a0a39c02a37c5907ac6 (patch)
treedf7dbd7d0ecbda1699590e9883fcbc43fb39c423
parent133f0b4ebcc3b731e680a72ced52d00638791bf7 (diff)
downloadusdx-c7e4891c2528317170b92a0a39c02a37c5907ac6.tar.gz
usdx-c7e4891c2528317170b92a0a39c02a37c5907ac6.tar.xz
usdx-c7e4891c2528317170b92a0a39c02a37c5907ac6.zip
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
-rw-r--r--src/base/USingScores.pas5
1 files changed, 4 insertions, 1 deletions
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