From b1a8a3e503a260c0fa8489c2c6c6ca5dc8812535 Mon Sep 17 00:00:00 2001 From: Roman Olearski Date: Thu, 17 Nov 2016 19:04:14 +0100 Subject: [PATCH] cleaning unnecessary dumps and comments --- libraries/chain/tournament_object.cpp | 78 ++------------------------- 1 file changed, 5 insertions(+), 73 deletions(-) diff --git a/libraries/chain/tournament_object.cpp b/libraries/chain/tournament_object.cpp index bc7130c1..539f7f33 100644 --- a/libraries/chain/tournament_object.cpp +++ b/libraries/chain/tournament_object.cpp @@ -180,11 +180,11 @@ namespace graphene { namespace chain { tournament_details_obj.matches = matches; }); - // OLEK + // find "bye" matches, complete missing player in the next match for (unsigned i = 0; i < num_matches_in_first_round; ++i) { const match_object& match = matches[i](event.db); - if (match.players.size() == 1) // is bye + if (match.players.size() == 1) // is "bye" { unsigned tournament_num_matches = tournament_details_obj.matches.size(); unsigned next_round_match_index = (i + tournament_num_matches + 1) / 2; @@ -192,22 +192,13 @@ namespace graphene { namespace chain { const match_object& next_round_match = tournament_details_obj.matches[next_round_match_index](event.db); event.db.modify(next_round_match, [&](match_object& next_match) { next_match.players.emplace_back(match.players[0]); - if (next_match.players.size() > 1) // bye + bye + if (next_match.players.size() > 1) // both previous matches were "bye" next_match.on_initiate_match(event.db); }); } } - // OLEK - wdump((tournament_details_obj.matches[tournament_details_obj.matches.size() - 1])); - - for( match_id_type mid : tournament_details_obj.matches ) - { - wdump((mid(event.db))); - } - - } void on_entry(const match_completed& event, tournament_state_machine_& fsm) { @@ -243,13 +234,7 @@ namespace graphene { namespace chain { event.db.modify(next_round_match, [&](match_object& next_match_obj) { - // OLEK - wdump((event.match.get_state())); - wdump((event.match)); - wdump((other_match.get_state())); - wdump((other_match)); - - if (!event.match.match_winners.empty()) // if there is a winner + if (!event.match.match_winners.empty()) // if there is a winner { if (winner_index_in_next_match == 0) next_match_obj.players.insert(next_match_obj.players.begin(), *event.match.match_winners.begin()); @@ -257,24 +242,8 @@ namespace graphene { namespace chain { next_match_obj.players.push_back(*event.match.match_winners.begin()); } - //if (other_match.get_state() == match_state::match_complete) - // OLEK - if (!other_match.match_winners.empty()) - { -// // if other match was buy -// if (other_match.games.size() == 0 /*&& next_match_obj.players.size() < 2*/) -// { -// if (winner_index_in_next_match != 0) -// next_match_obj.players.insert(next_match_obj.players.begin(), *other_match.match_winners.begin()); -// else -// next_match_obj.players.push_back(*other_match.match_winners.begin()); -// } - // OLEK - wdump((next_match_obj.get_state())); - wdump((next_match_obj)); - + if (other_match.get_state() == match_state::match_complete) next_match_obj.on_initiate_match(event.db); - } }); } @@ -350,45 +319,9 @@ namespace graphene { namespace chain { fc_ilog(fc::logger::get("tournament"), "In was_final_match guard, returning ${value}", ("value", event.match.id == tournament_details_obj.matches[tournament_details_obj.matches.size()])); - - // OLEK - wdump((event.match.id)); - wdump((tournament_details_obj.matches[tournament_details_obj.matches.size() - 1])); - - for( match_id_type mid : tournament_details_obj.matches ) - { - wdump((mid(event.db))); - } - return event.match.id == tournament_details_obj.matches[tournament_details_obj.matches.size() - 1]; } -#if 0 - // OLEK - bool was_buy_match(const match_completed& event) - { - const tournament_details_object& tournament_details_obj = tournament_obj->tournament_details_id(event.db); - fc_ilog(fc::logger::get("tournament"), - "In was_buy_match guard, returning ${value}", - ("value", event.match.id == tournament_details_obj.matches[tournament_details_obj.matches.size()])); - - // OLEK - wdump((event.match.id)); - wdump((event.match)); - - /* - wdump((tournament_details_obj.matches[tournament_details_obj.matches.size() - 1])); - - for( match_id_type mid : tournament_details_obj.matches ) - { - wdump((mid(event.db))); - } - - return event.match.id == tournament_details_obj.matches[tournament_details_obj.matches.size() - 1]; - */ - return true; - } -#endif void register_player(const player_registered& event) { fc_ilog(fc::logger::get("tournament"), @@ -416,7 +349,6 @@ namespace graphene { namespace chain { _row < awaiting_start, start_time_arrived, in_progress >, // +---------------------------+-----------------------------+----------------------------+---------------------+----------------------+ _row < in_progress, match_completed, in_progress >, - //g_row < in_progress, match_completed, in_progress, &x::was_buy_match >, g_row < in_progress, match_completed, concluded, &x::was_final_match > // +---------------------------+-----------------------------+----------------------------+---------------------+----------------------+ > {};