correct action parsing

This commit is contained in:
Maximilian Keßler 2023-09-14 17:06:06 +02:00
parent 3211a20c9c
commit 05d348b7e4
Signed by: max
GPG key ID: BCC5A619923C0BA5
3 changed files with 4 additions and 1 deletions

View file

@ -20,7 +20,7 @@ namespace Download {
struct Action { struct Action {
Hanabi::ActionType type{}; Hanabi::ActionType type{};
uint8_t target{}; int8_t target{};
}; };
Action tag_invoke(boost::json::value_to_tag<Action>, boost::json::value const &jv); Action tag_invoke(boost::json::value_to_tag<Action>, boost::json::value const &jv);

View file

@ -170,6 +170,7 @@ enum class ActionType : std::uint8_t {
color_clue = 2, color_clue = 2,
rank_clue = 3, rank_clue = 3,
end_game = 4, end_game = 4,
vote_terminate_players = 5,
vote_terminate = 10, vote_terminate = 10,
}; };

View file

@ -44,6 +44,7 @@ namespace Download {
action.type = Hanabi::ActionType::clue; action.type = Hanabi::ActionType::clue;
break; break;
case Hanabi::ActionType::end_game: case Hanabi::ActionType::end_game:
case Hanabi::ActionType::vote_terminate_players:
case Hanabi::ActionType::vote_terminate: case Hanabi::ActionType::vote_terminate:
action.type = Hanabi::ActionType::end_game; action.type = Hanabi::ActionType::end_game;
break; break;
@ -122,6 +123,7 @@ namespace Download {
ASSERT(index != std::uint8_t(-1)); ASSERT(index != std::uint8_t(-1));
game->play(index); game->play(index);
break; break;
case Hanabi::ActionType::vote_terminate_players:
case Hanabi::ActionType::vote_terminate: case Hanabi::ActionType::vote_terminate:
case Hanabi::ActionType::end_game: case Hanabi::ActionType::end_game:
return game; return game;