From 0d4f50f6a2ba32a0176d768646208dbec3136084 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 13 Apr 2007 16:28:45 +0000 Subject: Fixed some Bugs in Skipto and Random Methods Now the last Song of a Category could be the Result of Randomize when there is an odd number of Songs. Also a little bit better Random Results git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@85 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenSong.pas | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index e873d287..7ea5d268 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -66,7 +66,7 @@ type procedure SelectNext; procedure SelectPrev; procedure UpdateLCD; - procedure SkipTo(Target: integer); + procedure SkipTo(Target: Cardinal); procedure FixSelected; //Show Wrong Song when Tabs on Fix procedure FixSelected2; //Show Wrong Song when Tabs on Fix procedure ShowCatTL(Cat: Integer);// Show Cat in Top left @@ -208,7 +208,7 @@ begin begin if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Title)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Title[1]) = Letter) then begin - SkipTo(2 + CatSongs.VisibleIndex((I + Interaction) mod I2)); + SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); Music.PlayChange; @@ -521,7 +521,7 @@ begin SelectNext; //Fix: Not Existing Song selected: - if (I+1=I2) then Inc(I2); + //if (I+1=I2) then Inc(I2); //Choose Song SkipTo(I2-I); @@ -529,7 +529,7 @@ begin end else //Random in one Category begin - SkipTo(2+Random(CatSongs.VisibleSongs-1)); + SkipTo(Random(CatSongs.VisibleSongs)); end; Music.PlayChange; @@ -1324,7 +1324,7 @@ begin Music.Stop; end; -procedure TScreenSong.SkipTo(Target: integer); // 0.5.0 +procedure TScreenSong.SkipTo(Target: Cardinal); // 0.5.0 var Skip: integer; I: integer; @@ -1339,7 +1339,7 @@ begin Interaction := 0; SongTarget := 0; - for I := 2 to Target do + for I := 1 to Target+1 do SelectNext; FixSelected2; @@ -1481,7 +1481,7 @@ begin SelectNext; //Fix: Not Existing Song selected: - if (I+1=I2) then Inc(I2); + //if (I+1=I2) then Inc(I2); //Choose Song SkipTo(I2-I); @@ -1495,7 +1495,7 @@ begin SelectNext; FixSelected; - SkipTo(2+Random(CatSongs.VisibleSongs-1)); + SkipTo(Random(CatSongs.VisibleSongs)); Music.PlayChange; ChangeMusic; SetScroll4; @@ -1505,7 +1505,7 @@ begin begin PlaylistMan.SetPlayList(PlaylistMan.CurPlayList); - SkipTo(2+Random(CatSongs.VisibleSongs-1)); + SkipTo(Random(CatSongs.VisibleSongs)); Music.PlayChange; ChangeMusic; SetScroll4; -- cgit v1.2.3