index 3f26b360c8e770e30c6592c38f0e0c64780d6543..cc5fe2f81de41d70337bafc18d1c4b9271891f25 100644 (file)
--- a/src/game/g_holmes_ui.inc
+++ b/src/game/g_holmes_ui.inc
SDL_SCANCODE_UP:
begin
result := true;
- if (mCurIndex < 0) then mCurIndex := Length(mItems)
- else if (mCurIndex > 0) then Dec(mCurIndex);
+ if (Length(mItems) > 0) then
+ begin
+ if (mCurIndex < 0) then mCurIndex := Length(mItems);
+ while (mCurIndex > 0) do
+ begin
+ Dec(mCurIndex);
+ if (mChecks[mCurIndex] <> nil) then break;
+ end;
+ end
+ else
+ begin
+ mCurIndex := -1;
+ end;
end;
SDL_SCANCODE_DOWN:
begin
result := true;
- if (mCurIndex < 0) then mCurIndex := 0
- else if (mCurIndex < High(mItems)) then Inc(mCurIndex);
+ if (Length(mItems) > 0) then
+ begin
+ if (mCurIndex < 0) then mCurIndex := -1;
+ while (mCurIndex < High(mItems)) do
+ begin
+ Inc(mCurIndex);
+ if (mChecks[mCurIndex] <> nil) then break;
+ end;
+ end
+ else
+ begin
+ mCurIndex := -1;
+ end;
end;
SDL_SCANCODE_SPACE,
SDL_SCANCODE_RETURN: