aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrunzelchen <brunzelchen@b956fd51-792f-4845-bead-9b4dfca2ff2c>2011-04-17 15:36:40 +0000
committerbrunzelchen <brunzelchen@b956fd51-792f-4845-bead-9b4dfca2ff2c>2011-04-17 15:36:40 +0000
commitb827aa00841254b941665aa767aa19ca7620c2c7 (patch)
tree456c4b04c54d4db6b607c8167ef74018073edac9
parentfd313cf8ba1e77bbfa76ffebf579dc7957a287c3 (diff)
downloadusdx-b827aa00841254b941665aa767aa19ca7620c2c7.tar.gz
usdx-b827aa00841254b941665aa767aa19ca7620c2c7.tar.xz
usdx-b827aa00841254b941665aa767aa19ca7620c2c7.zip
fix for last commit: check if there are any selectable interactions
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/1.0.1 Challenge MOD@2821 b956fd51-792f-4845-bead-9b4dfca2ff2c
-rw-r--r--Game/Code/Menu/UMenu.pas40
1 files changed, 29 insertions, 11 deletions
diff --git a/Game/Code/Menu/UMenu.pas b/Game/Code/Menu/UMenu.pas
index 1ed91087..2729546b 100644
--- a/Game/Code/Menu/UMenu.pas
+++ b/Game/Code/Menu/UMenu.pas
@@ -127,7 +127,8 @@ type
procedure SetAnimationProgress(Progress: real); virtual;
function IsSelectable(Int: Cardinal): Boolean;
-
+ function NumSelectable(Int: Cardinal): Integer;
+
procedure InteractNext; virtual;
procedure InteractCustom(CustomSwitch: integer); virtual;
procedure InteractPrev; virtual;
@@ -837,6 +838,19 @@ begin
end;
end;
+function TMenu.NumSelectable(Int: Cardinal): Integer;
+var
+ i: Integer;
+
+begin
+ Result := 0;
+ for i := 0 to Length(Interactions) - 1 do
+ begin
+ if (i <> Int) and IsSelectable(i) then
+ inc(Result);
+ end;
+end;
+
procedure TMenu.InteractNext;
var
Int: Integer;
@@ -844,10 +858,12 @@ begin
Int := Interaction;
// change interaction as long as it's needed
- repeat
- Int := (Int + 1) Mod Length(Interactions);
- Until IsSelectable(Int);
-
+ if (NumSelectable(Int)>0) then
+ begin
+ repeat
+ Int := (Int + 1) Mod Length(Interactions);
+ Until IsSelectable(Int);
+ end;
//Set Interaction
Interaction := Int;
end;
@@ -860,12 +876,14 @@ begin
Int := Interaction;
// change interaction as long as it's needed
- repeat
- Int := Int - 1;
- if Int = -1 then
- Int := High(Interactions);
- Until IsSelectable(Int);
-
+ if (NumSelectable(Int)>0) then
+ begin
+ repeat
+ Int := Int - 1;
+ if Int = -1 then
+ Int := High(Interactions);
+ Until IsSelectable(Int);
+ end;
//Set Interaction
Interaction := Int
end;