From b4f9eb05fb873177070885b8ef796f252886528b Mon Sep 17 00:00:00 2001 From: Eric Frias Date: Mon, 3 Oct 2016 15:52:26 -0400 Subject: [PATCH] Update fc submodule --- libraries/chain/match_object.cpp | 27 ++++++++++++++++++++++++--- libraries/fc | 2 +- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/libraries/chain/match_object.cpp b/libraries/chain/match_object.cpp index 793347da..37a60d07 100644 --- a/libraries/chain/match_object.cpp +++ b/libraries/chain/match_object.cpp @@ -30,6 +30,7 @@ #include #include #include +#include namespace graphene { namespace chain { @@ -67,10 +68,13 @@ namespace graphene { namespace chain { { void on_entry(const initiate_match& event, match_state_machine_& fsm) { - fsm.match_obj->players = event.players; + match_object& match = *fsm.match_obj; + match.players = event.players; + match.start_time = event.db.head_block_time(); + fc_ilog(fc::logger::get("tournament"), "Match ${id} is now in progress", - ("id", fsm.match_obj->id)); + ("id", match.id)); } }; struct match_complete : public msm::front::state<> @@ -81,6 +85,17 @@ namespace graphene { namespace chain { "Match ${id} is complete", ("id", fsm.match_obj->id)); } + void on_entry(const initiate_match& event, match_state_machine_& fsm) + { + match_object& match = *fsm.match_obj; + fc_ilog(fc::logger::get("tournament"), + "Match ${id} is complete, it was a buy", + ("id", match)); + match.players = event.players; + boost::copy(event.players, std::inserter(match.match_winners, match.match_winners.end())); + match.start_time = event.db.head_block_time(); + match.end_time = event.db.head_block_time(); + } }; typedef waiting_on_previous_matches initial_state; @@ -95,6 +110,11 @@ namespace graphene { namespace chain { return false; //return match_obj->registered_players == match_obj->options.number_of_players - 1; } + + bool match_is_a_buy(const initiate_match& event) + { + return event.players.size() < 2; + } void start_next_game(const game_complete& event) { @@ -106,7 +126,8 @@ namespace graphene { namespace chain { struct transition_table : mpl::vector< // Start Event Next Action Guard // +-------------------------------+-------------------------+----------------------------+---------------------+----------------------+ - _row < waiting_on_previous_matches, initiate_match , match_in_progress >, + _row < waiting_on_previous_matches, initiate_match, match_in_progress >, + g_row < waiting_on_previous_matches, initiate_match, match_complete, &x::match_is_a_buy >, // +-------------------------------+-------------------------+----------------------------+---------------------+----------------------+ a_row < match_in_progress, game_complete, match_in_progress, &x::start_next_game >, g_row < match_in_progress, game_complete, match_complete, &x::was_final_game > diff --git a/libraries/fc b/libraries/fc index 622ff580..15f0dfe5 160000 --- a/libraries/fc +++ b/libraries/fc @@ -1 +1 @@ -Subproject commit 622ff58039f2388433272a44fe416f5b8025589a +Subproject commit 15f0dfe583b099955b1102555854e9a0e0925067