Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Win game if last line is empty (except of "next-Button") #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 14 additions & 18 deletions ztrcktrsr_game_tentactics.prog.abap
Original file line number Diff line number Diff line change
Expand Up @@ -849,10 +849,8 @@ CLASS lcl_main IMPLEMENTATION.

METHOD shrink_lines.

DATA lt_lines_to_delete TYPE STANDARD TABLE OF i.
FIELD-SYMBOLS <field> LIKE LINE OF mt_field.


*== shrink lines
LOOP AT mt_field TRANSPORTING NO FIELDS
WHERE s01 IS INITIAL
Expand All @@ -864,29 +862,27 @@ CLASS lcl_main IMPLEMENTATION.
AND s07 IS INITIAL
AND s08 IS INITIAL
AND s09 IS INITIAL.
APPEND sy-index TO lt_lines_to_delete.
DELETE mt_field.
ADD 10 TO mv_score.

ENDLOOP.
CHECK sy-subrc = 0.

DELETE mt_field
WHERE s01 IS INITIAL
AND s02 IS INITIAL
AND s03 IS INITIAL
AND s04 IS INITIAL
AND s05 IS INITIAL
AND s06 IS INITIAL
AND s07 IS INITIAL
AND s08 IS INITIAL
AND s09 IS INITIAL.

IF mt_field IS INITIAL.
MESSAGE i000(oo) WITH 'You won! Your Score:' mv_score.
ELSEIF lines( mt_field ) = 1.
READ TABLE mt_field ASSIGNING <field> INDEX 1.
"Check, if last line is empty (except of "next-Button")
"todo
IF ( <field>-s01 IS INITIAL OR <field>-s01 = icon_next_object )
AND ( <field>-s02 IS INITIAL OR <field>-s02 = icon_next_object )
AND ( <field>-s03 IS INITIAL OR <field>-s03 = icon_next_object )
AND ( <field>-s04 IS INITIAL OR <field>-s04 = icon_next_object )
AND ( <field>-s05 IS INITIAL OR <field>-s05 = icon_next_object )
AND ( <field>-s06 IS INITIAL OR <field>-s06 = icon_next_object )
AND ( <field>-s07 IS INITIAL OR <field>-s07 = icon_next_object )
AND ( <field>-s08 IS INITIAL OR <field>-s08 = icon_next_object )
AND ( <field>-s09 IS INITIAL OR <field>-s09 = icon_next_object ).
ADD 10 TO mv_score.
MESSAGE i000(oo) WITH 'You won! Your Score:' mv_score.
ENDIF.
ENDIF.

ENDMETHOD.
Expand Down Expand Up @@ -1025,4 +1021,4 @@ AT SELECTION-SCREEN.
WRITE space.
CHECK gr_main IS INITIAL.
gr_main = NEW lcl_main( ).
gr_main->start( type = p_typ sequence = p_seq ).
gr_main->start( type = p_typ sequence = p_seq ).