tvintris: fix else cases

pull/3011/head
Nicolas Sauzede 2019-12-08 11:45:29 +01:00 committed by Alexander Medvednikov
parent 8178e1f7da
commit 8bc94947e5
1 changed files with 8 additions and 0 deletions

View File

@ -398,6 +398,7 @@ fn main() {
game.handle_jhat(jh, jv, joyid) game.handle_jhat(jh, jv, joyid)
game2.handle_jhat(jh, jv, joyid) game2.handle_jhat(jh, jv, joyid)
} }
else {}
} }
} }
if should_close { if should_close {
@ -445,6 +446,7 @@ fn (game mut Game) handle_key(key int) {
match key { match key {
C.SDLK_SPACE { action = .space } C.SDLK_SPACE { action = .space }
game.k_fire { action = .fire } game.k_fire { action = .fire }
else {}
} }
if action == .space { if action == .space {
@ -457,6 +459,7 @@ fn (game mut Game) handle_key(key int) {
C.Mix_ResumeMusic() C.Mix_ResumeMusic()
game.state = .running game.state = .running
} }
else {}
} }
} }
@ -466,6 +469,7 @@ fn (game mut Game) handle_key(key int) {
game.init_game() game.init_game()
game.state = .running game.state = .running
} }
else {}
} }
} }
if game.state != .running { return } if game.state != .running { return }
@ -475,6 +479,7 @@ fn (game mut Game) handle_key(key int) {
game.k_left { game.move_right(-1) } game.k_left { game.move_right(-1) }
game.k_right { game.move_right(1) } game.k_right { game.move_right(1) }
game.k_down { game.move_tetro() } // drop faster when the player presses <down> game.k_down { game.move_tetro() } // drop faster when the player presses <down>
else {}
} }
} }
@ -486,6 +491,7 @@ fn (game mut Game) handle_jbutton(jb int, joyid int) {
mut action := Action(.idle) mut action := Action(.idle)
match jb { match jb {
game.jb_fire { action = .fire } game.jb_fire { action = .fire }
else {}
} }
if action == .fire { if action == .fire {
@ -494,6 +500,7 @@ fn (game mut Game) handle_jbutton(jb int, joyid int) {
game.init_game() game.init_game()
game.state = .running game.state = .running
} }
else {}
} }
} }
} }
@ -510,6 +517,7 @@ fn (game mut Game) handle_jhat(jh int, jv int, joyid int) {
game.jh_left { game.move_right(-1) } game.jh_left { game.move_right(-1) }
game.jh_right { game.move_right(1) } game.jh_right { game.move_right(1) }
game.jh_down { game.move_tetro() } // drop faster when the player presses <down> game.jh_down { game.move_tetro() } // drop faster when the player presses <down>
else {}
} }
} }