From a77cf53f7f71a525a33c7617d74d57b4fd84e357 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 16 Aug 2009 13:17:01 +0000 Subject: 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 --- src/base/USingScores.pas | 14 ++++++++------ src/screens/UScreenSing.pas | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'src') 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; -- cgit v1.2.3