Update fc submodule

This commit is contained in:
Eric Frias 2016-10-03 15:52:26 -04:00
parent e57a5e84db
commit b4f9eb05fb
2 changed files with 25 additions and 4 deletions

View file

@ -30,6 +30,7 @@
#include <boost/archive/binary_oarchive.hpp> #include <boost/archive/binary_oarchive.hpp>
#include <boost/archive/binary_iarchive.hpp> #include <boost/archive/binary_iarchive.hpp>
#include <boost/msm/back/tools.hpp> #include <boost/msm/back/tools.hpp>
#include <boost/range/algorithm/copy.hpp>
namespace graphene { namespace chain { namespace graphene { namespace chain {
@ -67,10 +68,13 @@ namespace graphene { namespace chain {
{ {
void on_entry(const initiate_match& event, match_state_machine_& fsm) 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"), fc_ilog(fc::logger::get("tournament"),
"Match ${id} is now in progress", "Match ${id} is now in progress",
("id", fsm.match_obj->id)); ("id", match.id));
} }
}; };
struct match_complete : public msm::front::state<> struct match_complete : public msm::front::state<>
@ -81,6 +85,17 @@ namespace graphene { namespace chain {
"Match ${id} is complete", "Match ${id} is complete",
("id", fsm.match_obj->id)); ("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; typedef waiting_on_previous_matches initial_state;
@ -96,6 +111,11 @@ namespace graphene { namespace chain {
//return match_obj->registered_players == match_obj->options.number_of_players - 1; //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) void start_next_game(const game_complete& event)
{ {
fc_ilog(fc::logger::get("tournament"), fc_ilog(fc::logger::get("tournament"),
@ -106,7 +126,8 @@ namespace graphene { namespace chain {
struct transition_table : mpl::vector< struct transition_table : mpl::vector<
// Start Event Next Action Guard // 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 >, 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 > g_row < match_in_progress, game_complete, match_complete, &x::was_final_game >

@ -1 +1 @@
Subproject commit 622ff58039f2388433272a44fe416f5b8025589a Subproject commit 15f0dfe583b099955b1102555854e9a0e0925067