aboutsummaryrefslogtreecommitdiffstats
path: root/ScoreConverter
diff options
context:
space:
mode:
authorwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-05-23 17:31:40 +0000
committerwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-05-23 17:31:40 +0000
commite58500643f569b426b4f6e4f9e21a549b007acf7 (patch)
tree8f85ad30deae04b616b8ed65283449e9d9e2138a /ScoreConverter
parent0df43e29d3d12f93fd4ace638cfb60b65dd32262 (diff)
downloadusdx-e58500643f569b426b4f6e4f9e21a549b007acf7.tar.gz
usdx-e58500643f569b426b4f6e4f9e21a549b007acf7.tar.xz
usdx-e58500643f569b426b4f6e4f9e21a549b007acf7.zip
Fixed a Bug in Score Converter, that causes Scores are added 2 Times when Database Scores are coverted back to *.sco Files.
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@227 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'ScoreConverter')
-rw-r--r--ScoreConverter/ToDo.txt2
-rw-r--r--ScoreConverter/Umainform.pas126
2 files changed, 64 insertions, 64 deletions
diff --git a/ScoreConverter/ToDo.txt b/ScoreConverter/ToDo.txt
deleted file mode 100644
index e8987f87..00000000
--- a/ScoreConverter/ToDo.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-There is still a Bug when Writing Scores from DB back to SCo files.
-Most high entrys are duplicated don't know why... \ No newline at end of file
diff --git a/ScoreConverter/Umainform.pas b/ScoreConverter/Umainform.pas
index 20c3e494..c5cc5347 100644
--- a/ScoreConverter/Umainform.pas
+++ b/ScoreConverter/Umainform.pas
@@ -137,92 +137,94 @@ var
I, J, K: Integer;
LastI: integer;
begin
- pProgress.Max := high(Songs.Song);
- pProgress.Position := 0;
- // Go through all Songs
- For I := 0 to high(Songs.Song) do
+ if (Messagebox(0, PChar('If the same directory is added more than one time the Score-File will be useless. Contėnue ?'), PChar(Mainform.Caption), MB_ICONWARNING or MB_YESNO) = IDYes) then
begin
- try
- //Read Scores from .SCO File
- ReadScore (Songs.Song[I]);
+ pProgress.Max := high(Songs.Song);
+ pProgress.Position := 0;
+ // Go through all Songs
+ For I := 0 to high(Songs.Song) do
+ begin
+ try
+ //Read Scores from .SCO File
+ ReadScore (Songs.Song[I]);
- //Go from Easy to Difficult
- For J := 0 to 2 do
- begin
- //Go through all Score Entrys with Difficulty J
- For K := 0 to high(Songs.Song[I].Score[J]) do
+ //Go from Easy to Difficult
+ For J := 0 to 2 do
begin
- //Add to DataBase
- DataBase.AddScore(Songs.Song[I], J, Songs.Song[I].Score[J][K].Name, Songs.Song[I].Score[J][K].Score);
+ //Go through all Score Entrys with Difficulty J
+ For K := 0 to high(Songs.Song[I].Score[J]) do
+ begin
+ //Add to DataBase
+ DataBase.AddScore(Songs.Song[I], J, Songs.Song[I].Score[J][K].Name, Songs.Song[I].Score[J][K].Score);
+ end;
end;
+
+ except
+ showmessage ('Error Converting Score From Song: ' + Songs.Song[I].Path + Songs.Song[I].FileName);
end;
- except
- showmessage ('Error Converting Score From Song: ' + Songs.Song[I].Path + Songs.Song[I].FileName);
+ //Update ProgressBar
+ J := I div 30;
+ if (LastI <> J) then
+ begin
+ LastI := J;
+ pProgress.Position := I;
+ lStatus.Caption := 'Adding Songscore: ' + Songs.Song[I].Artist + ' - ' + Songs.Song[I].Title;
+ Application.ProcessMessages;
+ end;
end;
- //Update ProgressBar
- if (LastI <> I div 30) then
- begin
- LastI := I div 30;
- pProgress.Position := I;
- lStatus.Caption := 'Adding Songscore: ' + Songs.Song[I].Artist + ' - ' + Songs.Song[I].Title;
- Application.ProcessMessages;
- end;
+ pProgress.Position := pProgress.Max;
+ lStatus.Caption := 'Finished';
end;
-
- pProgress.Position := pProgress.Max;
- lStatus.Caption := 'Finished';
end;
procedure Tmainform.bFromDBClick(Sender: TObject);
var
- I, J, K: Integer;
+ I, J: Integer;
LastI: integer;
anyScoreinthere: boolean;
begin
- pProgress.Max := high(Songs.Song);
- pProgress.Position := 0;
- // Go through all Songs
- For I := 0 to high(Songs.Song) do
+ if (Messagebox(0, PChar('All Score Entrys in the Song Directory having an equivalent will be Overwritten. Contėnue ?'), PChar(Mainform.Caption), MB_ICONWARNING or MB_YESNO) = IDYes) then
begin
- try
- //Not Write ScoreFile when there are no Scores for this File
- anyScoreinthere := false;
- //Read Scores from DB File
- Database.ReadScore (Songs.Song[I]);
-
- //Go from Easy to Difficult
- For J := 0 to 2 do
- begin
- //Go through all Score Entrys with Difficulty J
- For K := 0 to high(Songs.Song[I].Score[J]) do
+ pProgress.Max := high(Songs.Song);
+ pProgress.Position := 0;
+ // Go through all Songs
+ For I := 0 to high(Songs.Song) do
+ begin
+ try
+ //Not Write ScoreFile when there are no Scores for this File
+ anyScoreinthere := false;
+ //Read Scores from DB File
+ Database.ReadScore (Songs.Song[I]);
+
+ //Go from Easy to Difficult
+ For J := 0 to 2 do
begin
- //Add to ScoreFile
- AddScore(Songs.Song[I], J, Songs.Song[I].Score[J][K].Name, Songs.Song[I].Score[J][K].Score);
- anyScoreinthere := True;
+ anyScoreinthere := anyScoreinthere or (Length(Songs.Song[I].Score[J]) > 0);
end;
- end;
- if AnyScoreinThere then
- WriteScore(Songs.Song[I]);
+ if AnyScoreinThere then
+ WriteScore(Songs.Song[I]);
- except
- showmessage ('Error Converting Score From Song: ' + Songs.Song[I].Path + Songs.Song[I].FileName);
- end;
+ except
+ showmessage ('Error Converting Score From Song: ' + Songs.Song[I].Path + Songs.Song[I].FileName);
+ end;
- //Update ProgressBar
- if (LastI <> I div 30) then
- begin
- LastI := I div 30;
- pProgress.Position := I;
- lStatus.Caption := 'Writing ScoreFile: ' + Songs.Song[I].Artist + ' - ' + Songs.Song[I].Title;
- Application.ProcessMessages;
+ //Update ProgressBar
+ J := I div 30;
+ if (LastI <> J) then
+ begin
+ LastI := J;
+ pProgress.Position := I;
+ lStatus.Caption := 'Writing ScoreFile: ' + Songs.Song[I].Artist + ' - ' + Songs.Song[I].Title;
+ Application.ProcessMessages;
+ end;
end;
+
+ pProgress.Position := pProgress.Max;
+ lStatus.Caption := 'Finished';
end;
-
- pProgress.Position := pProgress.Max;
- lStatus.Caption := 'Finished';
end;
end.