aboutsummaryrefslogtreecommitdiffstats
path: root/src/base
diff options
context:
space:
mode:
authorwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-09-21 18:35:29 +0000
committerwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-09-21 18:35:29 +0000
commit0214da20cb257aba5a8a9bca35c22efddf3004f3 (patch)
tree65ce2af72fc036be88e42e4cfa9b50c9c71932bd /src/base
parent8c649b5959469659555b162d55a736d69ec7725d (diff)
downloadusdx-0214da20cb257aba5a8a9bca35c22efddf3004f3.tar.gz
usdx-0214da20cb257aba5a8a9bca35c22efddf3004f3.tar.xz
usdx-0214da20cb257aba5a8a9bca35c22efddf3004f3.zip
fixed popups w/ rating = 0 doesn't change the rating bar value
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1393 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'src/base')
-rw-r--r--src/base/USingScores.pas29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/base/USingScores.pas b/src/base/USingScores.pas
index 59cdaf67..02b0b9e2 100644
--- a/src/base/USingScores.pas
+++ b/src/base/USingScores.pas
@@ -385,7 +385,14 @@ begin
Cur.Player := PlayerIndex;
Cur.TimeStamp := SDL_GetTicks;
- Cur.Rating := Rating;
+
+ //limit rating value to 8
+ //a higher value would cause a crash when selecting the bg textur
+ if (Rating > 8) then
+ Cur.Rating := 8
+ else
+ Cur.Rating := Rating;
+
Cur.ScoreGiven:= 0;
If (Players[PlayerIndex].Score < Score) then
begin
@@ -417,21 +424,21 @@ end;
// Removes a PopUp w/o destroying the List
//-----------
Procedure TSingScores.KillPopUp(const last, cur: PScorePopUp);
-var
- lTempA ,
- lTempB : real;
begin
//Give Player the Last Points that missing till now
aPlayers[Cur.Player].ScoreDisplayed := aPlayers[Cur.Player].ScoreDisplayed + Cur.ScoreDiff - Cur.ScoreGiven;
//Change Bars Position
- lTempA := ( (Cur.ScoreDiff - Cur.ScoreGiven) );
- lTempB := ( Cur.ScoreDiff );
-
- if ( lTempA > 0 ) AND
- ( lTempB > 0 ) THEN
- begin
- aPlayers[Cur.Player].RBTarget := aPlayers[Cur.Player].RBTarget + lTempA / lTempB * (Cur.Rating / 20 - 0.26);
+ if (Cur.ScoreDiff > 0) THEN
+ begin //Popup w/ scorechange -> give missing percents
+ aPlayers[Cur.Player].RBTarget := aPlayers[Cur.Player].RBTarget +
+ (Cur.ScoreDiff - Cur.ScoreGiven) / Cur.ScoreDiff
+ * (Cur.Rating / 20 - 0.26);
+ end
+ else
+ begin //Popup w/o scorechange -> give complete percentage
+ aPlayers[Cur.Player].RBTarget := aPlayers[Cur.Player].RBTarget +
+ (Cur.Rating / 20 - 0.26);
end;
If (aPlayers[Cur.Player].RBTarget > 1) then