From 7b10c3bca93ed91b86a94dd7ea3cfa0329c5d7d2 Mon Sep 17 00:00:00 2001 From: moonleay Date: Tue, 17 Dec 2024 14:35:22 +0100 Subject: [PATCH] fix: fixed game not exiting when typing q --- Game.cpp | 3 --- main.cpp | 5 +++++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Game.cpp b/Game.cpp index fd012d1..e2e7da0 100644 --- a/Game.cpp +++ b/Game.cpp @@ -106,9 +106,6 @@ namespace game // Namespace = Scope with name and no features { movement_vector = handle_user_input(game_input); } catch (UnkownAction& err) - { - cout << err.what() << "\n"; - } catch (ExitGame& err) { cout << err.what() << "\n"; } diff --git a/main.cpp b/main.cpp index b7325b9..efc5103 100644 --- a/main.cpp +++ b/main.cpp @@ -3,6 +3,7 @@ #include "PositionVector.h" #include "MazeParser.h" #include "Game.h" +#include "Exceptions/ExitGame.h" #include "Exceptions/MalformedMaze.h" #include "Exceptions/MovementNotPossible.h" #include "Exceptions/UnkownAction.h" @@ -16,6 +17,7 @@ using game::Game; using game_exceptions::MalformedMaze; using game_exceptions::UnkownAction; using game_exceptions::MovementNotPossible; +using game_exceptions::ExitGame; // Ein Programm, welches dir erlaubt ein Labyrinth zu erkunden mit 'w', 'a', 's', und 'd'. @@ -34,6 +36,9 @@ int main() // Das Labyrinth einlesen hat nicht geklappt. Gebe Fehlermeldung aus und beende das Programm. cout << "Fehler beim Einlesen des Labyrinths.\n"; return 0; + } catch (ExitGame& err) + { + cout << err.what() << "\n"; }