aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-08-16 13:17:01 +0000
committerwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-08-16 13:17:01 +0000
commita77cf53f7f71a525a33c7617d74d57b4fd84e357 (patch)
tree4d6573482b12a4936a6fd50031dd112eecb9a842
parent55c03e4fc90bd365c26d3d59b1a6ac72a5658246 (diff)
downloadusdx-a77cf53f7f71a525a33c7617d74d57b4fd84e357.tar.gz
usdx-a77cf53f7f71a525a33c7617d74d57b4fd84e357.tar.xz
usdx-a77cf53f7f71a525a33c7617d74d57b4fd84e357.zip
some changes to prevent integer size conversions
attempt to fix weird score bugs git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1932 b956fd51-792f-4845-bead-9b4dfca2ff2c
-rw-r--r--src/base/USingScores.pas14
-rw-r--r--src/screens/UScreenSing.pas2
2 files changed, 9 insertions, 7 deletions
diff --git a/src/base/USingScores.pas b/src/base/USingScores.pas
index 89896d2d..ed99e2c5 100644
--- a/src/base/USingScores.pas
+++ b/src/base/USingScores.pas
@@ -117,9 +117,9 @@ type
TScorePopUp = record
Player: byte; // index of the popups player
TimeStamp: cardinal; // timestamp of popups spawn
- Rating: byte; // 0 to 8, type of rating (cool, bad, etc.)
- ScoreGiven: word; // score that has already been given to the player
- ScoreDiff: word; // difference between cur score at spawn and old score
+ Rating: integer; // 0 to 8, type of rating (cool, bad, etc.)
+ ScoreGiven: integer; // score that has already been given to the player
+ ScoreDiff: integer; // difference between cur score at spawn and old score
Next: PScorePopUp; // next item in list
end;
aScorePopUp = array of TScorePopUp;
@@ -202,7 +202,7 @@ type
procedure Init;
// spawns a new line bonus popup for the player
- procedure SpawnPopUp(const PlayerIndex: byte; const Rating: byte; const Score: word);
+ procedure SpawnPopUp(const PlayerIndex: byte; const Rating: integer; const Score: integer);
// removes all popups from mem
procedure KillAllPopUps;
@@ -402,7 +402,7 @@ end;
{**
* spawns a new line bonus popup for the player
*}
-procedure TSingScores.SpawnPopUp(const PlayerIndex: byte; const Rating: byte; const Score: word);
+procedure TSingScores.SpawnPopUp(const PlayerIndex: byte; const Rating: integer; const Score: integer);
var
Cur: PScorePopUp;
begin
@@ -414,10 +414,12 @@ begin
Cur.Player := PlayerIndex;
Cur.TimeStamp := SDL_GetTicks;
- // limit rating value to 8
+ // limit rating value to 0..8
// a higher value would cause a crash when selecting the bg texture
if (Rating > 8) then
Cur.Rating := 8
+ else if (Rating < 0) then
+ Cur.Rating := 0
else
Cur.Rating := Rating;
diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas
index 9a620320..157f7e64 100644
--- a/src/screens/UScreenSing.pas
+++ b/src/screens/UScreenSing.pas
@@ -859,7 +859,7 @@ end;
procedure TScreenSing.OnSentenceEnd(SentenceIndex: cardinal);
var
- PlayerIndex: integer;
+ PlayerIndex: byte;
CurrentPlayer: PPLayer;
CurrentScore: real;
Line: PLine;