Remove redundant type_of_game field

This commit is contained in:
Eric Frias 2016-10-19 18:19:13 -04:00
parent c4ad900026
commit 72d48cf3d2
3 changed files with 2 additions and 17 deletions

View file

@ -36,15 +36,6 @@
namespace graphene { namespace chain {
/**
* @brief List of games currently supported on the blockchain
*/
enum game_type
{
rock_paper_scissors,
GAME_TYPE_COUNT
};
typedef fc::static_variant<rock_paper_scissors_game_options> game_specific_options;
/**
@ -52,9 +43,6 @@ namespace graphene { namespace chain {
*/
struct tournament_options
{
/// The type of game in this tournament
uint16_t type_of_game; /* actually a game_type, but that doesn't reflect properly */
/// If there aren't enough players registered for the tournament before this time,
/// the tournament is canceled
fc::time_point_sec registration_deadline;
@ -94,6 +82,8 @@ namespace graphene { namespace chain {
fc::variant_object meta;
/// Parameters that are specific to the type_of_game in this tournament
/// The type stored in this static_variant field determines what type of game is being
/// played, so each different supported game must have a unique game_options data type
game_specific_options game_options;
void validate() const;
@ -175,11 +165,9 @@ namespace graphene { namespace chain {
} }
FC_REFLECT_ENUM( graphene::chain::game_type, (rock_paper_scissors)(GAME_TYPE_COUNT) )
FC_REFLECT_TYPENAME( graphene::chain::game_specific_options )
FC_REFLECT_TYPENAME( graphene::chain::game_specific_moves )
FC_REFLECT( graphene::chain::tournament_options,
(type_of_game)
(registration_deadline)
(number_of_players)
(buy_in)

View file

@ -11,8 +11,6 @@ namespace graphene { namespace chain {
void_result tournament_create_evaluator::do_evaluate( const tournament_create_operation& op )
{ try {
database& d = db();
FC_ASSERT(op.options.type_of_game == rock_paper_scissors, "Unsupported game type ${type}", ("type", op.options.type_of_game));
FC_ASSERT(op.options.registration_deadline >= d.head_block_time(), "Registration deadline has already passed");
// TODO: make this committee-set

View file

@ -2451,7 +2451,6 @@ public:
{
asset_object buy_in_asset = get_asset(tournament_obj.options.buy_in.asset_id);
ss << fc::variant(tournament_obj.id).as<std::string>() << " "
<< fc::variant(game_type(tournament_obj.options.type_of_game)).as<std::string>() << " "
<< buy_in_asset.amount_to_pretty_string(tournament_obj.options.buy_in.amount) << " "
<< tournament_obj.options.number_of_players << " players\n";
switch (tournament_obj.get_state())