From 41903e0e0549b5a1a9fd97d8f72407a5231392da Mon Sep 17 00:00:00 2001
From: Paul Weber <work@paul-weber.de>
Date: Mon, 5 Jul 2021 14:50:51 +0200
Subject: [PATCH] Silence warnings

---
 src/game_state.rs | 28 ++++++++++++++++++++--------
 1 file changed, 20 insertions(+), 8 deletions(-)

diff --git a/src/game_state.rs b/src/game_state.rs
index 0597d6b..23f0525 100644
--- a/src/game_state.rs
+++ b/src/game_state.rs
@@ -15,7 +15,7 @@ use tetra::input::{self, Key};
 use run::Run;
 use textures::Textures;
 use crate::game_state::tile::{Tile, TreasureType};
-use tetra::math::{Vec2, vec2};
+use tetra::math::Vec2;
 use std::cmp::{min, max};
 use std::usize;
 use rand::{thread_rng, Rng};
@@ -99,31 +99,43 @@ impl State for GameState {
 
 impl GameState {
     fn play_sound_player_attack(&mut self, ctx: &mut Context) {
-        self.sounds.hit.play(ctx);
+        if let Err(error) = self.sounds.hit.play(ctx) {
+            println!("{}", error);
+        }
     }
 
     fn play_sound_enemy_attack(&mut self, ctx: &mut Context) {
-        self.sounds.hit.play(ctx);
+        self.play_sound_player_attack(ctx);
     }
 
     fn play_sound_killed_enemy(&mut self, ctx: &mut Context) {
-        self.sounds.kill.play(ctx);
+        if let Err(error) = self.sounds.kill.play(ctx) {
+            println!("{}", error);
+        }
     }
 
     fn play_sound_death(&mut self, ctx: &mut Context) {
-        self.sounds.gameover.play(ctx);
+        if let Err(error) = self.sounds.gameover.play(ctx) {
+            println!("{}", error);
+        }
     }
 
     fn play_sound_chest(&mut self, ctx: &mut Context) {
-        self.sounds.chest.play(ctx);
+        if let Err(error) = self.sounds.chest.play(ctx) {
+            println!("{}", error);
+        }
     }
 
     fn play_sound_level_up(&mut self, ctx: &mut Context) {
-        self.sounds.fanfare.play(ctx);
+        if let Err(error) = self.sounds.fanfare.play(ctx) {
+            println!("{}", error);
+        }
     }
 
     fn play_sound_exit(&mut self, ctx: &mut Context) {
-        self.sounds.exit.play(ctx);
+        if let Err(error) = self.sounds.exit.play(ctx) {
+            println!("{}", error);
+        }
     }
 }
 
-- 
GitLab