From 05d348b7e4e8f6deda3328abaad23f4184fe2266 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Thu, 14 Sep 2023 17:06:06 +0200 Subject: [PATCH] correct action parsing --- include/download.h | 2 +- include/game_state.h | 1 + src/download.cpp | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/download.h b/include/download.h index cd5aa62..cdb82bb 100644 --- a/include/download.h +++ b/include/download.h @@ -20,7 +20,7 @@ namespace Download { struct Action { Hanabi::ActionType type{}; - uint8_t target{}; + int8_t target{}; }; Action tag_invoke(boost::json::value_to_tag, boost::json::value const &jv); diff --git a/include/game_state.h b/include/game_state.h index 58e02fa..01c07bc 100644 --- a/include/game_state.h +++ b/include/game_state.h @@ -170,6 +170,7 @@ enum class ActionType : std::uint8_t { color_clue = 2, rank_clue = 3, end_game = 4, + vote_terminate_players = 5, vote_terminate = 10, }; diff --git a/src/download.cpp b/src/download.cpp index c9a1a5f..1187a0e 100644 --- a/src/download.cpp +++ b/src/download.cpp @@ -44,6 +44,7 @@ namespace Download { action.type = Hanabi::ActionType::clue; break; case Hanabi::ActionType::end_game: + case Hanabi::ActionType::vote_terminate_players: case Hanabi::ActionType::vote_terminate: action.type = Hanabi::ActionType::end_game; break; @@ -122,6 +123,7 @@ namespace Download { ASSERT(index != std::uint8_t(-1)); game->play(index); break; + case Hanabi::ActionType::vote_terminate_players: case Hanabi::ActionType::vote_terminate: case Hanabi::ActionType::end_game: return game;