aboutsummaryrefslogtreecommitdiffstats
path: root/Game
diff options
context:
space:
mode:
authorwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-07-03 14:56:15 +0000
committerwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-07-03 14:56:15 +0000
commitdce08a8771098ac1a56dd4548202454ab268e951 (patch)
tree8b78f0af78bb9af28adb4aae12a48f61c29a4942 /Game
parent7050f9d54fc4603a952c12efbab2e3331413865f (diff)
downloadusdx-dce08a8771098ac1a56dd4548202454ab268e951.tar.gz
usdx-dce08a8771098ac1a56dd4548202454ab268e951.tar.xz
usdx-dce08a8771098ac1a56dd4548202454ab268e951.zip
Fixed a bug in EditorSub that causes a crash when the last note of a sentence was deleted.
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@273 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game')
-rw-r--r--Game/Code/Screens/UScreenEditSub.pas53
1 files changed, 41 insertions, 12 deletions
diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas
index 8a5eaab8..9e84462d 100644
--- a/Game/Code/Screens/UScreenEditSub.pas
+++ b/Game/Code/Screens/UScreenEditSub.pas
@@ -882,20 +882,49 @@ var
begin
C := Czesci[0].Akt;
- // we copy all notes from the next to the selected one
- for N := AktNuta+1 to Czesci[0].Czesc[C].HighNut do begin
- Czesci[0].Czesc[C].Nuta[N-1] := Czesci[0].Czesc[C].Nuta[N];
- end;
-
- NLen := Czesci[0].Czesc[C].IlNut - 1;
- SetLength(Czesci[0].Czesc[C].Nuta, NLen);
- Dec(Czesci[0].Czesc[C].HighNut);
- Dec(Czesci[0].Czesc[C].IlNut);
+ //Do Not delete Last Note
+ if (Czesci[0].High > 0) OR (Czesci[0].Czesc[C].HighNut > 0) then
+ begin
+ // we copy all notes from the next to the selected one
+ for N := AktNuta+1 to Czesci[0].Czesc[C].HighNut do begin
+ Czesci[0].Czesc[C].Nuta[N-1] := Czesci[0].Czesc[C].Nuta[N];
+ end;
- // me slightly modify new note
- if AktNuta > Czesci[0].Czesc[C].HighNut then Dec(AktNuta);
- Czesci[0].Czesc[C].Nuta[AktNuta].Color := 1;
+ NLen := Czesci[0].Czesc[C].IlNut - 1;
+
+ if (NLen > 0) then
+ begin
+ SetLength(Czesci[0].Czesc[C].Nuta, NLen);
+ Dec(Czesci[0].Czesc[C].HighNut);
+ Dec(Czesci[0].Czesc[C].IlNut);
+
+
+ // me slightly modify new note
+ if AktNuta > Czesci[0].Czesc[C].HighNut then Dec(AktNuta);
+ Czesci[0].Czesc[C].Nuta[AktNuta].Color := 1;
+ end
+ //Last Note of current Sentence Deleted - > Delete Sentence
+ else
+ begin
+ //Move all Sentences after the current to the Left
+ for N := C+1 to Czesci[0].High do
+ Czesci[0].Czesc[N-1] := Czesci[0].Czesc[N];
+
+ //Delete Last Sentence
+ SetLength(Czesci[0].Czesc, Czesci[0].High);
+ Czesci[0].High := High(Czesci[0].Czesc);
+ Czesci[0].Ilosc := Length(Czesci[0].Czesc);
+
+ AktNuta := 0;
+ if (C > 0) then
+ Czesci[0].Akt := C - 1
+ else
+ Czesci[0].Akt := 0;
+
+ Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Color := 1;
+ end;
+ end;
end;
procedure TScreenEditSub.TransposeNote(Transpose: integer);