From 4a09d8f2c9020e6f2c2aae357f7a9e1b86d76e85 Mon Sep 17 00:00:00 2001 From: mtarnow <mtarnow@ethz.ch> Date: Thu, 12 Dec 2024 19:00:47 +0100 Subject: [PATCH 1/2] documented game state class and adapted tests to changes in game state --- html/_game_controller_8h_source.html | 2 +- html/_main_game_panel_wizard_8h_source.html | 2 +- html/_score_board_dialog_8h_source.html | 2 +- html/_trick_estimation_panel_8h_source.html | 2 +- html/annotated.html | 2 +- html/classdeck.html | 4 +- html/classgame__state-members.html | 71 +- html/classgame__state.html | 938 ++++++++++++++++++-- html/classserializable.html | 4 +- html/classtrick-members.html | 21 +- html/classtrick.html | 34 +- html/classunique__serializable.html | 2 +- html/doxygen_crawl.html | 35 + html/full__state__response_8h_source.html | 2 +- html/functions.html | 43 +- html/functions_func.html | 43 +- html/game__instance_8h_source.html | 2 +- html/game__state_8h_source.html | 290 +++--- html/hierarchy.html | 2 +- html/index.html | 45 +- html/menudata.js | 4 + html/search/all_12.js | 9 +- html/search/all_13.js | 9 +- html/search/all_14.js | 16 +- html/search/all_15.js | 2 +- html/search/all_16.js | 3 +- html/search/all_17.js | 4 +- html/search/all_18.js | 7 +- html/search/all_4.js | 3 +- html/search/all_8.js | 5 +- html/search/all_9.js | 5 +- html/search/all_a.js | 36 +- html/search/all_c.js | 7 +- html/search/functions_0.js | 3 +- html/search/functions_3.js | 2 +- html/search/functions_4.js | 16 +- html/search/functions_5.js | 26 +- html/search/functions_6.js | 2 +- html/search/functions_7.js | 7 +- html/search/functions_8.js | 3 +- html/search/functions_9.js | 9 +- html/search/functions_a.js | 11 +- html/search/functions_b.js | 5 +- html/search/functions_c.js | 6 +- html/search/functions_d.js | 6 +- html/search/functions_e.js | 21 +- html/search/searchdata.js | 2 +- html/trick_8h_source.html | 90 +- src/common/game_state/game_state.cpp | 498 ++++++----- src/common/game_state/game_state.h | 370 ++++++-- unit-tests/game_state.cpp | 44 +- 51 files changed, 2057 insertions(+), 720 deletions(-) diff --git a/html/_game_controller_8h_source.html b/html/_game_controller_8h_source.html index 92807e9..e30a266 100644 --- a/html/_game_controller_8h_source.html +++ b/html/_game_controller_8h_source.html @@ -145,7 +145,7 @@ $(function(){ initResizable(false); }); <div class="ttc" id="aclass_main_game_panel_wizard_html"><div class="ttname"><a href="class_main_game_panel_wizard.html">MainGamePanelWizard</a></div><div class="ttdef"><b>Definition</b> MainGamePanelWizard.h:8</div></div> <div class="ttc" id="aclass_trick_estimation_panel_html"><div class="ttname"><a href="class_trick_estimation_panel.html">TrickEstimationPanel</a></div><div class="ttdef"><b>Definition</b> TrickEstimationPanel.h:13</div></div> <div class="ttc" id="aclasscard_html"><div class="ttname"><a href="classcard.html">card</a></div><div class="ttdoc">Represents a card in the game.</div><div class="ttdef"><b>Definition</b> card.h:15</div></div> -<div class="ttc" id="aclassgame__state_html"><div class="ttname"><a href="classgame__state.html">game_state</a></div><div class="ttdef"><b>Definition</b> game_state.h:18</div></div> +<div class="ttc" id="aclassgame__state_html"><div class="ttname"><a href="classgame__state.html">game_state</a></div><div class="ttdoc">Represents the state of the game.</div><div class="ttdef"><b>Definition</b> game_state.h:27</div></div> <div class="ttc" id="aclassplayer_html"><div class="ttname"><a href="classplayer.html">player</a></div><div class="ttdoc">Represents a player in the game.</div><div class="ttdef"><b>Definition</b> player.h:18</div></div> </div><!-- fragment --></div><!-- contents --> <!-- start footer part --> diff --git a/html/_main_game_panel_wizard_8h_source.html b/html/_main_game_panel_wizard_8h_source.html index e143a4c..8c6280d 100644 --- a/html/_main_game_panel_wizard_8h_source.html +++ b/html/_main_game_panel_wizard_8h_source.html @@ -124,7 +124,7 @@ $(function(){ initResizable(false); }); <div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> </div> <div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span><span class="preprocessor">#endif </span><span class="comment">//MAINGAMEPANELWIZARD_H</span></div> <div class="ttc" id="aclass_main_game_panel_wizard_html"><div class="ttname"><a href="class_main_game_panel_wizard.html">MainGamePanelWizard</a></div><div class="ttdef"><b>Definition</b> MainGamePanelWizard.h:8</div></div> -<div class="ttc" id="aclassgame__state_html"><div class="ttname"><a href="classgame__state.html">game_state</a></div><div class="ttdef"><b>Definition</b> game_state.h:18</div></div> +<div class="ttc" id="aclassgame__state_html"><div class="ttname"><a href="classgame__state.html">game_state</a></div><div class="ttdoc">Represents the state of the game.</div><div class="ttdef"><b>Definition</b> game_state.h:27</div></div> <div class="ttc" id="aclassplayer_html"><div class="ttname"><a href="classplayer.html">player</a></div><div class="ttdoc">Represents a player in the game.</div><div class="ttdef"><b>Definition</b> player.h:18</div></div> </div><!-- fragment --></div><!-- contents --> <!-- start footer part --> diff --git a/html/_score_board_dialog_8h_source.html b/html/_score_board_dialog_8h_source.html index 290231f..03f2486 100644 --- a/html/_score_board_dialog_8h_source.html +++ b/html/_score_board_dialog_8h_source.html @@ -118,7 +118,7 @@ $(function(){ initResizable(false); }); <div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span><span class="preprocessor">#endif </span><span class="comment">//WIZARD_SCOREBOARDDIALOG_H</span></div> <div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> </div> <div class="ttc" id="aclass_score_board_dialog_html"><div class="ttname"><a href="class_score_board_dialog.html">ScoreBoardDialog</a></div><div class="ttdef"><b>Definition</b> ScoreBoardDialog.h:13</div></div> -<div class="ttc" id="aclassgame__state_html"><div class="ttname"><a href="classgame__state.html">game_state</a></div><div class="ttdef"><b>Definition</b> game_state.h:18</div></div> +<div class="ttc" id="aclassgame__state_html"><div class="ttname"><a href="classgame__state.html">game_state</a></div><div class="ttdoc">Represents the state of the game.</div><div class="ttdef"><b>Definition</b> game_state.h:27</div></div> </div><!-- fragment --></div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> diff --git a/html/_trick_estimation_panel_8h_source.html b/html/_trick_estimation_panel_8h_source.html index 72bf632..0467c3f 100644 --- a/html/_trick_estimation_panel_8h_source.html +++ b/html/_trick_estimation_panel_8h_source.html @@ -131,7 +131,7 @@ $(function(){ initResizable(false); }); <div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span><span class="preprocessor">#endif </span><span class="comment">//TRICKESTIMATIONPANEL_H</span></div> <div class="ttc" id="aclass_input_field_html"><div class="ttname"><a href="class_input_field.html">InputField</a></div><div class="ttdef"><b>Definition</b> InputField.h:7</div></div> <div class="ttc" id="aclass_trick_estimation_panel_html"><div class="ttname"><a href="class_trick_estimation_panel.html">TrickEstimationPanel</a></div><div class="ttdef"><b>Definition</b> TrickEstimationPanel.h:13</div></div> -<div class="ttc" id="aclassgame__state_html"><div class="ttname"><a href="classgame__state.html">game_state</a></div><div class="ttdef"><b>Definition</b> game_state.h:18</div></div> +<div class="ttc" id="aclassgame__state_html"><div class="ttname"><a href="classgame__state.html">game_state</a></div><div class="ttdoc">Represents the state of the game.</div><div class="ttdef"><b>Definition</b> game_state.h:27</div></div> <div class="ttc" id="aclassplayer_html"><div class="ttname"><a href="classplayer.html">player</a></div><div class="ttdoc">Represents a player in the game.</div><div class="ttdef"><b>Definition</b> player.h:18</div></div> </div><!-- fragment --></div><!-- contents --> <!-- start footer part --> diff --git a/html/annotated.html b/html/annotated.html index b7653b9..6682dd8 100644 --- a/html/annotated.html +++ b/html/annotated.html @@ -104,7 +104,7 @@ $(function(){ initResizable(false); }); <tr id="row_9_" class="odd"><td class="entry"><span style="width:16px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="classfull__state__response.html" target="_self">full_state_response</a></td><td class="desc"></td></tr> <tr id="row_10_" class="even"><td class="entry"><span style="width:16px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="classgame__instance.html" target="_self">game_instance</a></td><td class="desc"></td></tr> <tr id="row_11_" class="odd"><td class="entry"><span style="width:16px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="classgame__instance__manager.html" target="_self">game_instance_manager</a></td><td class="desc"></td></tr> -<tr id="row_12_" class="even"><td class="entry"><span style="width:16px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="classgame__state.html" target="_self">game_state</a></td><td class="desc"></td></tr> +<tr id="row_12_" class="even"><td class="entry"><span style="width:16px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="classgame__state.html" target="_self">game_state</a></td><td class="desc">Represents the state of the game </td></tr> <tr id="row_13_" class="odd"><td class="entry"><span style="width:16px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="class_game_controller.html" target="_self">GameController</a></td><td class="desc"></td></tr> <tr id="row_14_" class="even"><td class="entry"><span style="width:16px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="class_game_window.html" target="_self">GameWindow</a></td><td class="desc"></td></tr> <tr id="row_15_" class="odd"><td class="entry"><span style="width:16px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="classhand.html" target="_self">hand</a></td><td class="desc">Represents a player's hand in the game </td></tr> diff --git a/html/classdeck.html b/html/classdeck.html index f2e7adb..e19c3dc 100644 --- a/html/classdeck.html +++ b/html/classdeck.html @@ -187,7 +187,7 @@ std::string </td><td class="memItemRight" valign="bottom"><b>_id</b></td></ </div><div class="memdoc"> <p>Constructs a new deck object. </p> -<p>This is the main constructor of the deck class used by the <a class="el" href="classgame__state.html">game_state</a> to create a deck for a game. When this constructor is called, all possible cards in <a class="el" href="class_wizard.html">Wizard</a> are created and added to the deck. This is the only time actual card objects are created, every card only exists exactly once. In all other instances where cards are removed or added somewhere (e.g., to a player's hand), actually only pointers are added or removed. </p> +<p>This is the main constructor of the deck class used by the <a class="el" href="classgame__state.html" title="Represents the state of the game.">game_state</a> to create a deck for a game. When this constructor is called, all possible cards in <a class="el" href="class_wizard.html">Wizard</a> are created and added to the deck. This is the only time actual card objects are created, every card only exists exactly once. In all other instances where cards are removed or added somewhere (e.g., to a player's hand), actually only pointers are added or removed. </p> </div> </div> @@ -316,7 +316,7 @@ std::string </td><td class="memItemRight" valign="bottom"><b>_id</b></td></ <p>Draws a random trump card from the remaining cards. </p> <dl class="section return"><dt>Returns</dt><dd>The card used as trump.</dd></dl> -<p>This function randomly draws one card from the remaining cards, which is then used as the trump for a round. In the last round, there are no more remaining cards after dealing. In this case, a nullptr is returned. The logic to handle this case further is implemented in the <a class="el" href="classgame__state.html">game_state</a> class. </p> +<p>This function randomly draws one card from the remaining cards, which is then used as the trump for a round. In the last round, there are no more remaining cards after dealing. In this case, a nullptr is returned. The logic to handle this case further is implemented in the <a class="el" href="classgame__state.html" title="Represents the state of the game.">game_state</a> class. </p> </div> </div> diff --git a/html/classgame__state-members.html b/html/classgame__state-members.html index 2bbf239..3e88c3b 100644 --- a/html/classgame__state-members.html +++ b/html/classgame__state-members.html @@ -92,41 +92,42 @@ $(function(){ initResizable(false); }); <p>This is the complete list of members for <a class="el" href="classgame__state.html">game_state</a>, including all inherited members.</p> <table class="directory"> <tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>_id</b> (defined in <a class="el" href="classunique__serializable.html">unique_serializable</a>)</td><td class="entry"><a class="el" href="classunique__serializable.html">unique_serializable</a></td><td class="entry"><span class="mlabel">protected</span></td></tr> - <tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>add_player</b>(player *player, std::string &err) (defined in <a class="el" href="classgame__state.html">game_state</a>)</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> - <tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>can_be_played</b>(player *player, const card *card, std::string &err) const noexcept (defined in <a class="el" href="classgame__state.html">game_state</a>)</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> - <tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>estimate_tricks</b>(player *player, std::string &err, int trick_estimate) (defined in <a class="el" href="classgame__state.html">game_state</a>)</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> - <tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>finish_game</b>(std::string &err) (defined in <a class="el" href="classgame__state.html">game_state</a>)</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> - <tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>from_json</b>(const rapidjson::Value &json) (defined in <a class="el" href="classgame__state.html">game_state</a>)</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"><span class="mlabel">static</span></td></tr> - <tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>game_state</b>() (defined in <a class="el" href="classgame__state.html">game_state</a>)</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> - <tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>get_current_player</b>() const (defined in <a class="el" href="classgame__state.html">game_state</a>)</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> - <tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>get_id</b>() const (defined in <a class="el" href="classunique__serializable.html">unique_serializable</a>)</td><td class="entry"><a class="el" href="classunique__serializable.html">unique_serializable</a></td><td class="entry"></td></tr> - <tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>get_max_round_number</b>() const (defined in <a class="el" href="classgame__state.html">game_state</a>)</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> - <tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>get_players</b>() (defined in <a class="el" href="classgame__state.html">game_state</a>)</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> - <tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>get_round_number</b>() const (defined in <a class="el" href="classgame__state.html">game_state</a>)</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> - <tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>get_starting_player</b>() const (defined in <a class="el" href="classgame__state.html">game_state</a>)</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> - <tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>get_trick</b>() const (defined in <a class="el" href="classgame__state.html">game_state</a>)</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> - <tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>get_trick_estimate_sum</b>() const (defined in <a class="el" href="classgame__state.html">game_state</a>)</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> - <tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>get_trick_number</b>() const (defined in <a class="el" href="classgame__state.html">game_state</a>)</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> - <tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>get_trick_starting_player</b>() const (defined in <a class="el" href="classgame__state.html">game_state</a>)</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> - <tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>get_trump_color</b>() const (defined in <a class="el" href="classgame__state.html">game_state</a>)</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> - <tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>is_estimation_phase</b>() const (defined in <a class="el" href="classgame__state.html">game_state</a>)</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> - <tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>is_finished</b>() const (defined in <a class="el" href="classgame__state.html">game_state</a>)</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> - <tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>is_full</b>() const (defined in <a class="el" href="classgame__state.html">game_state</a>)</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> - <tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>is_player_in_game</b>(player *player) const (defined in <a class="el" href="classgame__state.html">game_state</a>)</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> - <tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>is_started</b>() const (defined in <a class="el" href="classgame__state.html">game_state</a>)</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> - <tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>play_card</b>(player *player, const std::string &card_id, std::string &err) (defined in <a class="el" href="classgame__state.html">game_state</a>)</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> - <tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>remove_player</b>(player *player, std::string &err) (defined in <a class="el" href="classgame__state.html">game_state</a>)</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> - <tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>setup_round</b>(std::string &err) (defined in <a class="el" href="classgame__state.html">game_state</a>)</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> - <tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>start_game</b>(std::string &err) (defined in <a class="el" href="classgame__state.html">game_state</a>)</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> - <tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>to_json</b>() const (defined in <a class="el" href="classserializable.html">serializable</a>)</td><td class="entry"><a class="el" href="classserializable.html">serializable</a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">virtual</span></td></tr> - <tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>unique_serializable</b>() (defined in <a class="el" href="classunique__serializable.html">unique_serializable</a>)</td><td class="entry"><a class="el" href="classunique__serializable.html">unique_serializable</a></td><td class="entry"><span class="mlabel">protected</span></td></tr> - <tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>unique_serializable</b>(std::string id) (defined in <a class="el" href="classunique__serializable.html">unique_serializable</a>)</td><td class="entry"><a class="el" href="classunique__serializable.html">unique_serializable</a></td><td class="entry"><span class="mlabel">protected</span></td></tr> - <tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>update_current_player</b>(std::string &err) (defined in <a class="el" href="classgame__state.html">game_state</a>)</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> - <tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>wrap_up_round</b>(std::string &err) (defined in <a class="el" href="classgame__state.html">game_state</a>)</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> - <tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>write_into_json</b>(rapidjson::Value &json, rapidjson::Document::AllocatorType &allocator) const override (defined in <a class="el" href="classgame__state.html">game_state</a>)</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> - <tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>write_into_json</b>(rapidjson::Value &json, rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > &allocator) const override (defined in <a class="el" href="classunique__serializable.html">unique_serializable</a>)</td><td class="entry"><a class="el" href="classunique__serializable.html">unique_serializable</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> - <tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>~game_state</b>() override (defined in <a class="el" href="classgame__state.html">game_state</a>)</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> - <tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>~serializable</b>()=default (defined in <a class="el" href="classserializable.html">serializable</a>)</td><td class="entry"><a class="el" href="classserializable.html">serializable</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> + <tr class="odd"><td class="entry"><a class="el" href="classgame__state.html#a4a4fde0700a05c589a6b9c4dbcffac18">add_player</a>(player *player, std::string &err)</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> + <tr class="even"><td class="entry"><a class="el" href="classgame__state.html#ac4ebff625d83c633c124890537d60354">estimate_tricks</a>(const player *player, std::string &err, int trick_estimate)</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> + <tr class="odd"><td class="entry"><a class="el" href="classgame__state.html#a67fdd4b5682715cd2d848031a9911b17">finish_game</a>(std::string &err) const</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> + <tr class="even"><td class="entry"><a class="el" href="classgame__state.html#a794d484961c92b5b737586ec5599963f">from_json</a>(const rapidjson::Value &json)</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"><span class="mlabel">static</span></td></tr> + <tr class="odd"><td class="entry"><a class="el" href="classgame__state.html#a0c10b830e222d726557c3c33685c595a">game_state</a>()</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> + <tr class="even"><td class="entry"><a class="el" href="classgame__state.html#a2d16f420a8aa651685461a5efb8bb600">get_current_player</a>() const</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> + <tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>get_id</b>() const (defined in <a class="el" href="classunique__serializable.html">unique_serializable</a>)</td><td class="entry"><a class="el" href="classunique__serializable.html">unique_serializable</a></td><td class="entry"></td></tr> + <tr class="even"><td class="entry"><a class="el" href="classgame__state.html#a4327f753f1f5341f9fe3774ea3fbc99b">get_last_trick</a>() const</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> + <tr class="odd"><td class="entry"><a class="el" href="classgame__state.html#aa75c4da6c0056e48e5040be8127d7473">get_max_round_number</a>() const</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> + <tr class="even"><td class="entry"><a class="el" href="classgame__state.html#abcaccd551f938f961d12266e34c037d2">get_players</a>()</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> + <tr class="odd"><td class="entry"><a class="el" href="classgame__state.html#ab3ef836a1b3a1e2bc9e429a018c72eca">get_round_number</a>() const</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> + <tr class="even"><td class="entry"><a class="el" href="classgame__state.html#af4c553229260e307ff1f78dd0c74506d">get_starting_player</a>() const</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> + <tr class="odd"><td class="entry"><a class="el" href="classgame__state.html#a472fd1721c7cc9e3689394f18c767bf9">get_trick</a>() const</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> + <tr class="even"><td class="entry"><a class="el" href="classgame__state.html#aa5263d03c85bce1e9d252e9017cbe282">get_trick_estimate_sum</a>() const</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> + <tr class="odd"><td class="entry"><a class="el" href="classgame__state.html#a3fce12f31ad0aab82b0d2da90e3e8e15">get_trick_number</a>() const</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> + <tr class="even"><td class="entry"><a class="el" href="classgame__state.html#aa40554d105939c5dce934daaa858c242">get_trick_starting_player</a>() const</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> + <tr class="odd"><td class="entry"><a class="el" href="classgame__state.html#abdf6c5116ed643773d676c90a05e6fe4">get_trump_color</a>() const</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> + <tr class="even"><td class="entry"><a class="el" href="classgame__state.html#a88d19342ee76acc4660b3e56e8c126eb">is_estimation_phase</a>() const</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> + <tr class="odd"><td class="entry"><a class="el" href="classgame__state.html#a9b83de8a89e3bb506184492d22c3cf45">is_finished</a>() const</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> + <tr class="even"><td class="entry"><a class="el" href="classgame__state.html#ae161c283e275a57d71834754d11e9e40">is_full</a>() const</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> + <tr class="odd"><td class="entry"><a class="el" href="classgame__state.html#a371d6a6d84395b90c15d84549b05d553">is_player_in_game</a>(player *player) const</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> + <tr class="even"><td class="entry"><a class="el" href="classgame__state.html#aa0092c41779f38eba5e921e43b38559c">is_started</a>() const</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> + <tr class="odd"><td class="entry"><a class="el" href="classgame__state.html#a6c65d95086a88b8d111de5553e1210ec">play_card</a>(player *player, const std::string &card_id, std::string &err)</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> + <tr class="even"><td class="entry"><a class="el" href="classgame__state.html#a734fc594d457aa4e6db5bc7467e6442d">remove_player</a>(player *player, std::string &err)</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> + <tr class="odd"><td class="entry"><a class="el" href="classgame__state.html#a745dd23945b6165470c494b036ac4667">set_trick</a>(trick *new_trick)</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> + <tr class="even"><td class="entry"><a class="el" href="classgame__state.html#ab520d4076c53f70a68bc19f355243a4d">setup_round</a>(std::string &err)</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> + <tr class="odd"><td class="entry"><a class="el" href="classgame__state.html#a6ca6536eaec3404ff9b1ab39b8df4e67">start_game</a>(std::string &err)</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> + <tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>to_json</b>() const (defined in <a class="el" href="classserializable.html">serializable</a>)</td><td class="entry"><a class="el" href="classserializable.html">serializable</a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">virtual</span></td></tr> + <tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>unique_serializable</b>() (defined in <a class="el" href="classunique__serializable.html">unique_serializable</a>)</td><td class="entry"><a class="el" href="classunique__serializable.html">unique_serializable</a></td><td class="entry"><span class="mlabel">protected</span></td></tr> + <tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>unique_serializable</b>(std::string id) (defined in <a class="el" href="classunique__serializable.html">unique_serializable</a>)</td><td class="entry"><a class="el" href="classunique__serializable.html">unique_serializable</a></td><td class="entry"><span class="mlabel">protected</span></td></tr> + <tr class="odd"><td class="entry"><a class="el" href="classgame__state.html#a49851709fcec061d36478ed2fdcc3d9d">update_current_player</a>(std::string &err)</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> + <tr class="even"><td class="entry"><a class="el" href="classgame__state.html#ad2e967638043670ebae93dd6ec32e91e">wrap_up_round</a>(std::string &err)</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> + <tr class="odd"><td class="entry"><a class="el" href="classgame__state.html#a54873cd18b46555915d150a6d8dd6f83">write_into_json</a>(rapidjson::Value &json, rapidjson::Document::AllocatorType &allocator) const override</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> + <tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>write_into_json</b>(rapidjson::Value &json, rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > &allocator) const override (defined in <a class="el" href="classunique__serializable.html">unique_serializable</a>)</td><td class="entry"><a class="el" href="classunique__serializable.html">unique_serializable</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> + <tr class="odd"><td class="entry"><a class="el" href="classgame__state.html#a2fbc370f93617298719f61514afdb5bc">~game_state</a>() override</td><td class="entry"><a class="el" href="classgame__state.html">game_state</a></td><td class="entry"></td></tr> + <tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>~serializable</b>()=default (defined in <a class="el" href="classserializable.html">serializable</a>)</td><td class="entry"><a class="el" href="classserializable.html">serializable</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> </table></div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> diff --git a/html/classgame__state.html b/html/classgame__state.html index 5f51f35..7e99046 100644 --- a/html/classgame__state.html +++ b/html/classgame__state.html @@ -92,6 +92,11 @@ $(function(){ initResizable(false); }); <div class="headertitle"><div class="title">game_state Class Reference</div></div> </div><!--header--> <div class="contents"> + +<p>Represents the state of the game. + <a href="#details">More...</a></p> + +<p><code>#include <<a class="el" href="game__state_8h_source.html">game_state.h</a>></code></p> <div class="dynheader"> Inheritance diagram for game_state:</div> <div class="dyncontent"> @@ -105,82 +110,92 @@ Inheritance diagram for game_state:</div> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-methods" name="pub-methods"></a> Public Member Functions</h2></td></tr> -<tr class="memitem:ae161c283e275a57d71834754d11e9e40" id="r_ae161c283e275a57d71834754d11e9e40"><td class="memItemLeft" align="right" valign="top"><a id="ae161c283e275a57d71834754d11e9e40" name="ae161c283e275a57d71834754d11e9e40"></a> -bool </td><td class="memItemRight" valign="bottom"><b>is_full</b> () const</td></tr> +<tr class="memitem:a0c10b830e222d726557c3c33685c595a" id="r_a0c10b830e222d726557c3c33685c595a"><td class="memItemLeft" align="right" valign="top"><a id="a0c10b830e222d726557c3c33685c595a" name="a0c10b830e222d726557c3c33685c595a"></a> + </td><td class="memItemRight" valign="bottom"><b>game_state</b> ()</td></tr> +<tr class="memdesc:a0c10b830e222d726557c3c33685c595a"><td class="mdescLeft"> </td><td class="mdescRight">Constructs a new <a class="el" href="classgame__state.html" title="Represents the state of the game.">game_state</a> object. <br /></td></tr> +<tr class="separator:a0c10b830e222d726557c3c33685c595a"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:a2fbc370f93617298719f61514afdb5bc" id="r_a2fbc370f93617298719f61514afdb5bc"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#a2fbc370f93617298719f61514afdb5bc">~game_state</a> () override</td></tr> +<tr class="separator:a2fbc370f93617298719f61514afdb5bc"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:ae161c283e275a57d71834754d11e9e40" id="r_ae161c283e275a57d71834754d11e9e40"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#ae161c283e275a57d71834754d11e9e40">is_full</a> () const</td></tr> +<tr class="memdesc:ae161c283e275a57d71834754d11e9e40"><td class="mdescLeft"> </td><td class="mdescRight">Checks if the game is full. <br /></td></tr> <tr class="separator:ae161c283e275a57d71834754d11e9e40"><td class="memSeparator" colspan="2"> </td></tr> -<tr class="memitem:aa0092c41779f38eba5e921e43b38559c" id="r_aa0092c41779f38eba5e921e43b38559c"><td class="memItemLeft" align="right" valign="top"><a id="aa0092c41779f38eba5e921e43b38559c" name="aa0092c41779f38eba5e921e43b38559c"></a> -bool </td><td class="memItemRight" valign="bottom"><b>is_started</b> () const</td></tr> +<tr class="memitem:aa0092c41779f38eba5e921e43b38559c" id="r_aa0092c41779f38eba5e921e43b38559c"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#aa0092c41779f38eba5e921e43b38559c">is_started</a> () const</td></tr> +<tr class="memdesc:aa0092c41779f38eba5e921e43b38559c"><td class="mdescLeft"> </td><td class="mdescRight">Checks if the game is started. <br /></td></tr> <tr class="separator:aa0092c41779f38eba5e921e43b38559c"><td class="memSeparator" colspan="2"> </td></tr> -<tr class="memitem:a9b83de8a89e3bb506184492d22c3cf45" id="r_a9b83de8a89e3bb506184492d22c3cf45"><td class="memItemLeft" align="right" valign="top"><a id="a9b83de8a89e3bb506184492d22c3cf45" name="a9b83de8a89e3bb506184492d22c3cf45"></a> -bool </td><td class="memItemRight" valign="bottom"><b>is_finished</b> () const</td></tr> +<tr class="memitem:a9b83de8a89e3bb506184492d22c3cf45" id="r_a9b83de8a89e3bb506184492d22c3cf45"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#a9b83de8a89e3bb506184492d22c3cf45">is_finished</a> () const</td></tr> +<tr class="memdesc:a9b83de8a89e3bb506184492d22c3cf45"><td class="mdescLeft"> </td><td class="mdescRight">Checks if the game is finished. <br /></td></tr> <tr class="separator:a9b83de8a89e3bb506184492d22c3cf45"><td class="memSeparator" colspan="2"> </td></tr> -<tr class="memitem:a88d19342ee76acc4660b3e56e8c126eb" id="r_a88d19342ee76acc4660b3e56e8c126eb"><td class="memItemLeft" align="right" valign="top"><a id="a88d19342ee76acc4660b3e56e8c126eb" name="a88d19342ee76acc4660b3e56e8c126eb"></a> -bool </td><td class="memItemRight" valign="bottom"><b>is_estimation_phase</b> () const</td></tr> +<tr class="memitem:a88d19342ee76acc4660b3e56e8c126eb" id="r_a88d19342ee76acc4660b3e56e8c126eb"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#a88d19342ee76acc4660b3e56e8c126eb">is_estimation_phase</a> () const</td></tr> +<tr class="memdesc:a88d19342ee76acc4660b3e56e8c126eb"><td class="mdescLeft"> </td><td class="mdescRight">Checks if the game is in estimation phase. <br /></td></tr> <tr class="separator:a88d19342ee76acc4660b3e56e8c126eb"><td class="memSeparator" colspan="2"> </td></tr> -<tr class="memitem:a371d6a6d84395b90c15d84549b05d553" id="r_a371d6a6d84395b90c15d84549b05d553"><td class="memItemLeft" align="right" valign="top"><a id="a371d6a6d84395b90c15d84549b05d553" name="a371d6a6d84395b90c15d84549b05d553"></a> -bool </td><td class="memItemRight" valign="bottom"><b>is_player_in_game</b> (<a class="el" href="classplayer.html">player</a> *<a class="el" href="classplayer.html">player</a>) const</td></tr> +<tr class="memitem:a371d6a6d84395b90c15d84549b05d553" id="r_a371d6a6d84395b90c15d84549b05d553"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#a371d6a6d84395b90c15d84549b05d553">is_player_in_game</a> (<a class="el" href="classplayer.html">player</a> *<a class="el" href="classplayer.html">player</a>) const</td></tr> +<tr class="memdesc:a371d6a6d84395b90c15d84549b05d553"><td class="mdescLeft"> </td><td class="mdescRight">Checks if the given player is in the game. <br /></td></tr> <tr class="separator:a371d6a6d84395b90c15d84549b05d553"><td class="memSeparator" colspan="2"> </td></tr> -<tr class="memitem:ab3ef836a1b3a1e2bc9e429a018c72eca" id="r_ab3ef836a1b3a1e2bc9e429a018c72eca"><td class="memItemLeft" align="right" valign="top"><a id="ab3ef836a1b3a1e2bc9e429a018c72eca" name="ab3ef836a1b3a1e2bc9e429a018c72eca"></a> -int </td><td class="memItemRight" valign="bottom"><b>get_round_number</b> () const</td></tr> +<tr class="memitem:ab3ef836a1b3a1e2bc9e429a018c72eca" id="r_ab3ef836a1b3a1e2bc9e429a018c72eca"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="#ab3ef836a1b3a1e2bc9e429a018c72eca">get_round_number</a> () const</td></tr> +<tr class="memdesc:ab3ef836a1b3a1e2bc9e429a018c72eca"><td class="mdescLeft"> </td><td class="mdescRight">Gets the round number. <br /></td></tr> <tr class="separator:ab3ef836a1b3a1e2bc9e429a018c72eca"><td class="memSeparator" colspan="2"> </td></tr> -<tr class="memitem:a3fce12f31ad0aab82b0d2da90e3e8e15" id="r_a3fce12f31ad0aab82b0d2da90e3e8e15"><td class="memItemLeft" align="right" valign="top"><a id="a3fce12f31ad0aab82b0d2da90e3e8e15" name="a3fce12f31ad0aab82b0d2da90e3e8e15"></a> -int </td><td class="memItemRight" valign="bottom"><b>get_trick_number</b> () const</td></tr> +<tr class="memitem:a3fce12f31ad0aab82b0d2da90e3e8e15" id="r_a3fce12f31ad0aab82b0d2da90e3e8e15"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="#a3fce12f31ad0aab82b0d2da90e3e8e15">get_trick_number</a> () const</td></tr> +<tr class="memdesc:a3fce12f31ad0aab82b0d2da90e3e8e15"><td class="mdescLeft"> </td><td class="mdescRight">Gets the trick number. <br /></td></tr> <tr class="separator:a3fce12f31ad0aab82b0d2da90e3e8e15"><td class="memSeparator" colspan="2"> </td></tr> -<tr class="memitem:aa5263d03c85bce1e9d252e9017cbe282" id="r_aa5263d03c85bce1e9d252e9017cbe282"><td class="memItemLeft" align="right" valign="top"><a id="aa5263d03c85bce1e9d252e9017cbe282" name="aa5263d03c85bce1e9d252e9017cbe282"></a> -int </td><td class="memItemRight" valign="bottom"><b>get_trick_estimate_sum</b> () const</td></tr> +<tr class="memitem:aa5263d03c85bce1e9d252e9017cbe282" id="r_aa5263d03c85bce1e9d252e9017cbe282"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="#aa5263d03c85bce1e9d252e9017cbe282">get_trick_estimate_sum</a> () const</td></tr> +<tr class="memdesc:aa5263d03c85bce1e9d252e9017cbe282"><td class="mdescLeft"> </td><td class="mdescRight">Gets the trick estimate sum. <br /></td></tr> <tr class="separator:aa5263d03c85bce1e9d252e9017cbe282"><td class="memSeparator" colspan="2"> </td></tr> -<tr class="memitem:a58b83ac26d0fd99b3ac5c4cf664d3ece" id="r_a58b83ac26d0fd99b3ac5c4cf664d3ece"><td class="memItemLeft" align="right" valign="top"><a id="a58b83ac26d0fd99b3ac5c4cf664d3ece" name="a58b83ac26d0fd99b3ac5c4cf664d3ece"></a> -int </td><td class="memItemRight" valign="bottom"><b>get_max_round_number</b> () const</td></tr> -<tr class="separator:a58b83ac26d0fd99b3ac5c4cf664d3ece"><td class="memSeparator" colspan="2"> </td></tr> -<tr class="memitem:abdf6c5116ed643773d676c90a05e6fe4" id="r_abdf6c5116ed643773d676c90a05e6fe4"><td class="memItemLeft" align="right" valign="top"><a id="abdf6c5116ed643773d676c90a05e6fe4" name="abdf6c5116ed643773d676c90a05e6fe4"></a> -int </td><td class="memItemRight" valign="bottom"><b>get_trump_color</b> () const</td></tr> +<tr class="memitem:aa75c4da6c0056e48e5040be8127d7473" id="r_aa75c4da6c0056e48e5040be8127d7473"><td class="memItemLeft" align="right" valign="top">unsigned int </td><td class="memItemRight" valign="bottom"><a class="el" href="#aa75c4da6c0056e48e5040be8127d7473">get_max_round_number</a> () const</td></tr> +<tr class="memdesc:aa75c4da6c0056e48e5040be8127d7473"><td class="mdescLeft"> </td><td class="mdescRight">Gets the maximum round number. <br /></td></tr> +<tr class="separator:aa75c4da6c0056e48e5040be8127d7473"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:abdf6c5116ed643773d676c90a05e6fe4" id="r_abdf6c5116ed643773d676c90a05e6fe4"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="#abdf6c5116ed643773d676c90a05e6fe4">get_trump_color</a> () const</td></tr> +<tr class="memdesc:abdf6c5116ed643773d676c90a05e6fe4"><td class="mdescLeft"> </td><td class="mdescRight">Gets the trump color. <br /></td></tr> <tr class="separator:abdf6c5116ed643773d676c90a05e6fe4"><td class="memSeparator" colspan="2"> </td></tr> -<tr class="memitem:a2d16f420a8aa651685461a5efb8bb600" id="r_a2d16f420a8aa651685461a5efb8bb600"><td class="memItemLeft" align="right" valign="top"><a id="a2d16f420a8aa651685461a5efb8bb600" name="a2d16f420a8aa651685461a5efb8bb600"></a> -<a class="el" href="classplayer.html">player</a> * </td><td class="memItemRight" valign="bottom"><b>get_current_player</b> () const</td></tr> +<tr class="memitem:a2d16f420a8aa651685461a5efb8bb600" id="r_a2d16f420a8aa651685461a5efb8bb600"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classplayer.html">player</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="#a2d16f420a8aa651685461a5efb8bb600">get_current_player</a> () const</td></tr> +<tr class="memdesc:a2d16f420a8aa651685461a5efb8bb600"><td class="mdescLeft"> </td><td class="mdescRight">Gets the current player. <br /></td></tr> <tr class="separator:a2d16f420a8aa651685461a5efb8bb600"><td class="memSeparator" colspan="2"> </td></tr> -<tr class="memitem:aa40554d105939c5dce934daaa858c242" id="r_aa40554d105939c5dce934daaa858c242"><td class="memItemLeft" align="right" valign="top"><a id="aa40554d105939c5dce934daaa858c242" name="aa40554d105939c5dce934daaa858c242"></a> -<a class="el" href="classplayer.html">player</a> * </td><td class="memItemRight" valign="bottom"><b>get_trick_starting_player</b> () const</td></tr> +<tr class="memitem:aa40554d105939c5dce934daaa858c242" id="r_aa40554d105939c5dce934daaa858c242"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classplayer.html">player</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="#aa40554d105939c5dce934daaa858c242">get_trick_starting_player</a> () const</td></tr> +<tr class="memdesc:aa40554d105939c5dce934daaa858c242"><td class="mdescLeft"> </td><td class="mdescRight">Gets the starting player of the current trick. <br /></td></tr> <tr class="separator:aa40554d105939c5dce934daaa858c242"><td class="memSeparator" colspan="2"> </td></tr> -<tr class="memitem:af4c553229260e307ff1f78dd0c74506d" id="r_af4c553229260e307ff1f78dd0c74506d"><td class="memItemLeft" align="right" valign="top"><a id="af4c553229260e307ff1f78dd0c74506d" name="af4c553229260e307ff1f78dd0c74506d"></a> -<a class="el" href="classplayer.html">player</a> * </td><td class="memItemRight" valign="bottom"><b>get_starting_player</b> () const</td></tr> +<tr class="memitem:af4c553229260e307ff1f78dd0c74506d" id="r_af4c553229260e307ff1f78dd0c74506d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classplayer.html">player</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="#af4c553229260e307ff1f78dd0c74506d">get_starting_player</a> () const</td></tr> +<tr class="memdesc:af4c553229260e307ff1f78dd0c74506d"><td class="mdescLeft"> </td><td class="mdescRight">Gets the starting player of the current round. <br /></td></tr> <tr class="separator:af4c553229260e307ff1f78dd0c74506d"><td class="memSeparator" colspan="2"> </td></tr> -<tr class="memitem:a472fd1721c7cc9e3689394f18c767bf9" id="r_a472fd1721c7cc9e3689394f18c767bf9"><td class="memItemLeft" align="right" valign="top"><a id="a472fd1721c7cc9e3689394f18c767bf9" name="a472fd1721c7cc9e3689394f18c767bf9"></a> -<a class="el" href="classtrick.html">trick</a> * </td><td class="memItemRight" valign="bottom"><b>get_trick</b> () const</td></tr> +<tr class="memitem:a472fd1721c7cc9e3689394f18c767bf9" id="r_a472fd1721c7cc9e3689394f18c767bf9"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classtrick.html">trick</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="#a472fd1721c7cc9e3689394f18c767bf9">get_trick</a> () const</td></tr> +<tr class="memdesc:a472fd1721c7cc9e3689394f18c767bf9"><td class="mdescLeft"> </td><td class="mdescRight">Gets the current trick. <br /></td></tr> <tr class="separator:a472fd1721c7cc9e3689394f18c767bf9"><td class="memSeparator" colspan="2"> </td></tr> -<tr class="memitem:abcaccd551f938f961d12266e34c037d2" id="r_abcaccd551f938f961d12266e34c037d2"><td class="memItemLeft" align="right" valign="top"><a id="abcaccd551f938f961d12266e34c037d2" name="abcaccd551f938f961d12266e34c037d2"></a> -std::vector< <a class="el" href="classplayer.html">player</a> * > & </td><td class="memItemRight" valign="bottom"><b>get_players</b> ()</td></tr> +<tr class="memitem:a4327f753f1f5341f9fe3774ea3fbc99b" id="r_a4327f753f1f5341f9fe3774ea3fbc99b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classtrick.html">trick</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="#a4327f753f1f5341f9fe3774ea3fbc99b">get_last_trick</a> () const</td></tr> +<tr class="memdesc:a4327f753f1f5341f9fe3774ea3fbc99b"><td class="mdescLeft"> </td><td class="mdescRight">Gets the previous trick. <br /></td></tr> +<tr class="separator:a4327f753f1f5341f9fe3774ea3fbc99b"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:abcaccd551f938f961d12266e34c037d2" id="r_abcaccd551f938f961d12266e34c037d2"><td class="memItemLeft" align="right" valign="top">std::vector< <a class="el" href="classplayer.html">player</a> * > & </td><td class="memItemRight" valign="bottom"><a class="el" href="#abcaccd551f938f961d12266e34c037d2">get_players</a> ()</td></tr> +<tr class="memdesc:abcaccd551f938f961d12266e34c037d2"><td class="mdescLeft"> </td><td class="mdescRight">Gets the players that joined the game. <br /></td></tr> <tr class="separator:abcaccd551f938f961d12266e34c037d2"><td class="memSeparator" colspan="2"> </td></tr> -<tr class="memitem:a734fc594d457aa4e6db5bc7467e6442d" id="r_a734fc594d457aa4e6db5bc7467e6442d"><td class="memItemLeft" align="right" valign="top"><a id="a734fc594d457aa4e6db5bc7467e6442d" name="a734fc594d457aa4e6db5bc7467e6442d"></a> -bool </td><td class="memItemRight" valign="bottom"><b>remove_player</b> (<a class="el" href="classplayer.html">player</a> *<a class="el" href="classplayer.html">player</a>, std::string &err)</td></tr> +<tr class="memitem:a745dd23945b6165470c494b036ac4667" id="r_a745dd23945b6165470c494b036ac4667"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="#a745dd23945b6165470c494b036ac4667">set_trick</a> (<a class="el" href="classtrick.html">trick</a> *new_trick)</td></tr> +<tr class="memdesc:a745dd23945b6165470c494b036ac4667"><td class="mdescLeft"> </td><td class="mdescRight">Sets the trick to the given trick. <br /></td></tr> +<tr class="separator:a745dd23945b6165470c494b036ac4667"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:a734fc594d457aa4e6db5bc7467e6442d" id="r_a734fc594d457aa4e6db5bc7467e6442d"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#a734fc594d457aa4e6db5bc7467e6442d">remove_player</a> (<a class="el" href="classplayer.html">player</a> *<a class="el" href="classplayer.html">player</a>, std::string &err)</td></tr> +<tr class="memdesc:a734fc594d457aa4e6db5bc7467e6442d"><td class="mdescLeft"> </td><td class="mdescRight">Removes a player from the game. <br /></td></tr> <tr class="separator:a734fc594d457aa4e6db5bc7467e6442d"><td class="memSeparator" colspan="2"> </td></tr> -<tr class="memitem:a4a4fde0700a05c589a6b9c4dbcffac18" id="r_a4a4fde0700a05c589a6b9c4dbcffac18"><td class="memItemLeft" align="right" valign="top"><a id="a4a4fde0700a05c589a6b9c4dbcffac18" name="a4a4fde0700a05c589a6b9c4dbcffac18"></a> -bool </td><td class="memItemRight" valign="bottom"><b>add_player</b> (<a class="el" href="classplayer.html">player</a> *<a class="el" href="classplayer.html">player</a>, std::string &err)</td></tr> +<tr class="memitem:a4a4fde0700a05c589a6b9c4dbcffac18" id="r_a4a4fde0700a05c589a6b9c4dbcffac18"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#a4a4fde0700a05c589a6b9c4dbcffac18">add_player</a> (<a class="el" href="classplayer.html">player</a> *<a class="el" href="classplayer.html">player</a>, std::string &err)</td></tr> +<tr class="memdesc:a4a4fde0700a05c589a6b9c4dbcffac18"><td class="mdescLeft"> </td><td class="mdescRight">Adds a player to the game. <br /></td></tr> <tr class="separator:a4a4fde0700a05c589a6b9c4dbcffac18"><td class="memSeparator" colspan="2"> </td></tr> -<tr class="memitem:a6ca6536eaec3404ff9b1ab39b8df4e67" id="r_a6ca6536eaec3404ff9b1ab39b8df4e67"><td class="memItemLeft" align="right" valign="top"><a id="a6ca6536eaec3404ff9b1ab39b8df4e67" name="a6ca6536eaec3404ff9b1ab39b8df4e67"></a> -bool </td><td class="memItemRight" valign="bottom"><b>start_game</b> (std::string &err)</td></tr> +<tr class="memitem:a6ca6536eaec3404ff9b1ab39b8df4e67" id="r_a6ca6536eaec3404ff9b1ab39b8df4e67"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#a6ca6536eaec3404ff9b1ab39b8df4e67">start_game</a> (std::string &err)</td></tr> +<tr class="memdesc:a6ca6536eaec3404ff9b1ab39b8df4e67"><td class="mdescLeft"> </td><td class="mdescRight">Starts the game. <br /></td></tr> <tr class="separator:a6ca6536eaec3404ff9b1ab39b8df4e67"><td class="memSeparator" colspan="2"> </td></tr> -<tr class="memitem:aef74df457394582c6767ad9dc0162360" id="r_aef74df457394582c6767ad9dc0162360"><td class="memItemLeft" align="right" valign="top"><a id="aef74df457394582c6767ad9dc0162360" name="aef74df457394582c6767ad9dc0162360"></a> -bool </td><td class="memItemRight" valign="bottom"><b>finish_game</b> (std::string &err)</td></tr> -<tr class="separator:aef74df457394582c6767ad9dc0162360"><td class="memSeparator" colspan="2"> </td></tr> -<tr class="memitem:ab520d4076c53f70a68bc19f355243a4d" id="r_ab520d4076c53f70a68bc19f355243a4d"><td class="memItemLeft" align="right" valign="top"><a id="ab520d4076c53f70a68bc19f355243a4d" name="ab520d4076c53f70a68bc19f355243a4d"></a> -void </td><td class="memItemRight" valign="bottom"><b>setup_round</b> (std::string &err)</td></tr> +<tr class="memitem:a67fdd4b5682715cd2d848031a9911b17" id="r_a67fdd4b5682715cd2d848031a9911b17"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#a67fdd4b5682715cd2d848031a9911b17">finish_game</a> (std::string &err) const</td></tr> +<tr class="memdesc:a67fdd4b5682715cd2d848031a9911b17"><td class="mdescLeft"> </td><td class="mdescRight">Finishes a game. <br /></td></tr> +<tr class="separator:a67fdd4b5682715cd2d848031a9911b17"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:ab520d4076c53f70a68bc19f355243a4d" id="r_ab520d4076c53f70a68bc19f355243a4d"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="#ab520d4076c53f70a68bc19f355243a4d">setup_round</a> (std::string &err)</td></tr> +<tr class="memdesc:ab520d4076c53f70a68bc19f355243a4d"><td class="mdescLeft"> </td><td class="mdescRight">Sets up a round. <br /></td></tr> <tr class="separator:ab520d4076c53f70a68bc19f355243a4d"><td class="memSeparator" colspan="2"> </td></tr> -<tr class="memitem:ad2e967638043670ebae93dd6ec32e91e" id="r_ad2e967638043670ebae93dd6ec32e91e"><td class="memItemLeft" align="right" valign="top"><a id="ad2e967638043670ebae93dd6ec32e91e" name="ad2e967638043670ebae93dd6ec32e91e"></a> -void </td><td class="memItemRight" valign="bottom"><b>wrap_up_round</b> (std::string &err)</td></tr> +<tr class="memitem:ad2e967638043670ebae93dd6ec32e91e" id="r_ad2e967638043670ebae93dd6ec32e91e"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="#ad2e967638043670ebae93dd6ec32e91e">wrap_up_round</a> (std::string &err)</td></tr> +<tr class="memdesc:ad2e967638043670ebae93dd6ec32e91e"><td class="mdescLeft"> </td><td class="mdescRight">Wraps up a round. <br /></td></tr> <tr class="separator:ad2e967638043670ebae93dd6ec32e91e"><td class="memSeparator" colspan="2"> </td></tr> -<tr class="memitem:a1f16f3d986305dbbf271233329a3eba1" id="r_a1f16f3d986305dbbf271233329a3eba1"><td class="memItemLeft" align="right" valign="top"><a id="a1f16f3d986305dbbf271233329a3eba1" name="a1f16f3d986305dbbf271233329a3eba1"></a> -bool </td><td class="memItemRight" valign="bottom"><b>estimate_tricks</b> (<a class="el" href="classplayer.html">player</a> *<a class="el" href="classplayer.html">player</a>, std::string &err, int trick_estimate)</td></tr> -<tr class="separator:a1f16f3d986305dbbf271233329a3eba1"><td class="memSeparator" colspan="2"> </td></tr> -<tr class="memitem:ab909b3801d96854daebd26f399834a72" id="r_ab909b3801d96854daebd26f399834a72"><td class="memItemLeft" align="right" valign="top"><a id="ab909b3801d96854daebd26f399834a72" name="ab909b3801d96854daebd26f399834a72"></a> -bool </td><td class="memItemRight" valign="bottom"><b>can_be_played</b> (<a class="el" href="classplayer.html">player</a> *<a class="el" href="classplayer.html">player</a>, const <a class="el" href="classcard.html">card</a> *<a class="el" href="classcard.html">card</a>, std::string &err) const noexcept</td></tr> -<tr class="separator:ab909b3801d96854daebd26f399834a72"><td class="memSeparator" colspan="2"> </td></tr> -<tr class="memitem:a6c65d95086a88b8d111de5553e1210ec" id="r_a6c65d95086a88b8d111de5553e1210ec"><td class="memItemLeft" align="right" valign="top"><a id="a6c65d95086a88b8d111de5553e1210ec" name="a6c65d95086a88b8d111de5553e1210ec"></a> -bool </td><td class="memItemRight" valign="bottom"><b>play_card</b> (<a class="el" href="classplayer.html">player</a> *<a class="el" href="classplayer.html">player</a>, const std::string &card_id, std::string &err)</td></tr> +<tr class="memitem:ac4ebff625d83c633c124890537d60354" id="r_ac4ebff625d83c633c124890537d60354"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#ac4ebff625d83c633c124890537d60354">estimate_tricks</a> (const <a class="el" href="classplayer.html">player</a> *<a class="el" href="classplayer.html">player</a>, std::string &err, int trick_estimate)</td></tr> +<tr class="memdesc:ac4ebff625d83c633c124890537d60354"><td class="mdescLeft"> </td><td class="mdescRight">Sets the trick estimates for a player. <br /></td></tr> +<tr class="separator:ac4ebff625d83c633c124890537d60354"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:a6c65d95086a88b8d111de5553e1210ec" id="r_a6c65d95086a88b8d111de5553e1210ec"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#a6c65d95086a88b8d111de5553e1210ec">play_card</a> (<a class="el" href="classplayer.html">player</a> *<a class="el" href="classplayer.html">player</a>, const std::string &card_id, std::string &err)</td></tr> +<tr class="memdesc:a6c65d95086a88b8d111de5553e1210ec"><td class="mdescLeft"> </td><td class="mdescRight">Plays a card. <br /></td></tr> <tr class="separator:a6c65d95086a88b8d111de5553e1210ec"><td class="memSeparator" colspan="2"> </td></tr> -<tr class="memitem:a49851709fcec061d36478ed2fdcc3d9d" id="r_a49851709fcec061d36478ed2fdcc3d9d"><td class="memItemLeft" align="right" valign="top"><a id="a49851709fcec061d36478ed2fdcc3d9d" name="a49851709fcec061d36478ed2fdcc3d9d"></a> -bool </td><td class="memItemRight" valign="bottom"><b>update_current_player</b> (std::string &err)</td></tr> +<tr class="memitem:a49851709fcec061d36478ed2fdcc3d9d" id="r_a49851709fcec061d36478ed2fdcc3d9d"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#a49851709fcec061d36478ed2fdcc3d9d">update_current_player</a> (std::string &err)</td></tr> +<tr class="memdesc:a49851709fcec061d36478ed2fdcc3d9d"><td class="mdescLeft"> </td><td class="mdescRight">Updates the current player after estimating tricks or playing cards. <br /></td></tr> <tr class="separator:a49851709fcec061d36478ed2fdcc3d9d"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a54873cd18b46555915d150a6d8dd6f83" id="r_a54873cd18b46555915d150a6d8dd6f83"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="#a54873cd18b46555915d150a6d8dd6f83">write_into_json</a> (rapidjson::Value &json, rapidjson::Document::AllocatorType &allocator) const override</td></tr> +<tr class="memdesc:a54873cd18b46555915d150a6d8dd6f83"><td class="mdescLeft"> </td><td class="mdescRight">Serializes a <a class="el" href="classgame__state.html" title="Represents the state of the game.">game_state</a> object into a json object. <br /></td></tr> <tr class="separator:a54873cd18b46555915d150a6d8dd6f83"><td class="memSeparator" colspan="2"> </td></tr> <tr class="inherit_header pub_methods_classunique__serializable"><td colspan="2" onclick="javascript:dynsection.toggleInherit('pub_methods_classunique__serializable')"><img src="closed.png" alt="-"/> Public Member Functions inherited from <a class="el" href="classunique__serializable.html">unique_serializable</a></td></tr> <tr class="memitem:afda021db3c4d16dfc6cd8cd6a7c2aad7 inherit pub_methods_classunique__serializable" id="r_afda021db3c4d16dfc6cd8cd6a7c2aad7"><td class="memItemLeft" align="right" valign="top"> @@ -196,8 +211,8 @@ virtual rapidjson::Document * </td><td class="memItemRight" valign="bottom" </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-static-methods" name="pub-static-methods"></a> Static Public Member Functions</h2></td></tr> -<tr class="memitem:a794d484961c92b5b737586ec5599963f" id="r_a794d484961c92b5b737586ec5599963f"><td class="memItemLeft" align="right" valign="top"><a id="a794d484961c92b5b737586ec5599963f" name="a794d484961c92b5b737586ec5599963f"></a> -static <a class="el" href="classgame__state.html">game_state</a> * </td><td class="memItemRight" valign="bottom"><b>from_json</b> (const rapidjson::Value &json)</td></tr> +<tr class="memitem:a794d484961c92b5b737586ec5599963f" id="r_a794d484961c92b5b737586ec5599963f"><td class="memItemLeft" align="right" valign="top">static <a class="el" href="classgame__state.html">game_state</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="#a794d484961c92b5b737586ec5599963f">from_json</a> (const rapidjson::Value &json)</td></tr> +<tr class="memdesc:a794d484961c92b5b737586ec5599963f"><td class="mdescLeft"> </td><td class="mdescRight">Deserializes a <a class="el" href="classgame__state.html" title="Represents the state of the game.">game_state</a> object from a json object. <br /></td></tr> <tr class="separator:a794d484961c92b5b737586ec5599963f"><td class="memSeparator" colspan="2"> </td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="inherited" name="inherited"></a> @@ -211,7 +226,809 @@ Additional Inherited Members</h2></td></tr> std::string </td><td class="memItemRight" valign="bottom"><b>_id</b></td></tr> <tr class="separator:a7d95a28fd25510504eedde50c0e3c95b inherit pro_attribs_classunique__serializable"><td class="memSeparator" colspan="2"> </td></tr> </table> +<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> +<div class="textblock"><p>Represents the state of the game. </p> +<p>This class encapsulates all information about a game, including the players, the deck, the trick, and some other variables.</p> +<p>The <a class="el" href="classgame__state.html" title="Represents the state of the game.">game_state</a> class contains most of the game logic and also holds all the other common classes as members (or as members of members, e.g., <a class="el" href="classgame__state.html" title="Represents the state of the game.">game_state</a> has players and players have hands). It also contains information about the progress and current state of the game, e.g., if the game has already started, is finished, or which phase the game is in (estimation phase or play phase). Moreover, it also keeps track of who is currently able to make predictions or play cards, and changes the state of the game according to the players' actions. </p> +</div><h2 class="groupheader">Constructor & Destructor Documentation</h2> +<a id="a2fbc370f93617298719f61514afdb5bc" name="a2fbc370f93617298719f61514afdb5bc"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a2fbc370f93617298719f61514afdb5bc">◆ </a></span>~game_state()</h2> + +<div class="memitem"> +<div class="memproto"> +<table class="mlabels"> + <tr> + <td class="mlabels-left"> + <table class="memname"> + <tr> + <td class="memname">game_state::~game_state </td> + <td>(</td> + <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td> + <td></td> + </tr> + </table> + </td> + <td class="mlabels-right"> +<span class="mlabels"><span class="mlabel">override</span></span> </td> + </tr> +</table> +</div><div class="memdoc"> +<p>Destructs a trick object. </p> + +</div> +</div> <h2 class="groupheader">Member Function Documentation</h2> +<a id="a4a4fde0700a05c589a6b9c4dbcffac18" name="a4a4fde0700a05c589a6b9c4dbcffac18"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a4a4fde0700a05c589a6b9c4dbcffac18">◆ </a></span>add_player()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">bool game_state::add_player </td> + <td>(</td> + <td class="paramtype"><a class="el" href="classplayer.html">player</a> *</td> <td class="paramname"><span class="paramname"><em>player</em></span>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">std::string &</td> <td class="paramname"><span class="paramname"><em>err</em></span> )</td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Adds a player to the game. </p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">player</td><td>The player that is added. </td></tr> + <tr><td class="paramname">err</td><td>The error message updated in case something does not work. </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>A boolean indicating whether adding the player worked or not.</dd></dl> +<p>This function tries to add a player to a game. To do so, it checks several things including if the maximum number of players is already reached and if the game has already started. </p> + +</div> +</div> +<a id="ac4ebff625d83c633c124890537d60354" name="ac4ebff625d83c633c124890537d60354"></a> +<h2 class="memtitle"><span class="permalink"><a href="#ac4ebff625d83c633c124890537d60354">◆ </a></span>estimate_tricks()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">bool game_state::estimate_tricks </td> + <td>(</td> + <td class="paramtype">const <a class="el" href="classplayer.html">player</a> *</td> <td class="paramname"><span class="paramname"><em>player</em></span>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">std::string &</td> <td class="paramname"><span class="paramname"><em>err</em></span>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">int</td> <td class="paramname"><span class="paramname"><em>trick_estimate</em></span> )</td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Sets the trick estimates for a player. </p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">player</td><td>The player that is estimating tricks. </td></tr> + <tr><td class="paramname">err</td><td>The error message updated in case something does not work. </td></tr> + <tr><td class="paramname">trick_estimate</td><td>The trick estimate. </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>A boolean indicating whether the trick estimate was valid or not.</dd></dl> +<p>This function is called whenever a player estimates their tricks (so predicts how many tricks they will win in the next round). To do so, the functions checks that the trick estimate is neither too low (smaller than zero), nor too high (greater than the round number), and for the last player, that the trick estimate sum of all players is not equal to the round number. If all of these checks pass, the players trick estimate is updated. Afterward, the game proceeds by calling update_current_player (see below). </p> + +</div> +</div> +<a id="a67fdd4b5682715cd2d848031a9911b17" name="a67fdd4b5682715cd2d848031a9911b17"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a67fdd4b5682715cd2d848031a9911b17">◆ </a></span>finish_game()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">bool game_state::finish_game </td> + <td>(</td> + <td class="paramtype">std::string &</td> <td class="paramname"><span class="paramname"><em>err</em></span></td><td>)</td> + <td> const</td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Finishes a game. </p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">err</td><td>The error message updated in case something does not work. </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>A boolean indicating whether finishing the game worked or not.</dd></dl> +<p>This function finishes the game by setting _is_finished to true. </p> + +</div> +</div> +<a id="a794d484961c92b5b737586ec5599963f" name="a794d484961c92b5b737586ec5599963f"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a794d484961c92b5b737586ec5599963f">◆ </a></span>from_json()</h2> + +<div class="memitem"> +<div class="memproto"> +<table class="mlabels"> + <tr> + <td class="mlabels-left"> + <table class="memname"> + <tr> + <td class="memname"><a class="el" href="classgame__state.html">game_state</a> * game_state::from_json </td> + <td>(</td> + <td class="paramtype">const rapidjson::Value &</td> <td class="paramname"><span class="paramname"><em>json</em></span></td><td>)</td> + <td></td> + </tr> + </table> + </td> + <td class="mlabels-right"> +<span class="mlabels"><span class="mlabel">static</span></span> </td> + </tr> +</table> +</div><div class="memdoc"> + +<p>Deserializes a <a class="el" href="classgame__state.html" title="Represents the state of the game.">game_state</a> object from a json object. </p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">json</td><td>The json object containing the <a class="el" href="classgame__state.html" title="Represents the state of the game.">game_state</a> information. </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>A pointer to a new <a class="el" href="classgame__state.html" title="Represents the state of the game.">game_state</a> object created from the given json object. </dd></dl> + +</div> +</div> +<a id="a2d16f420a8aa651685461a5efb8bb600" name="a2d16f420a8aa651685461a5efb8bb600"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a2d16f420a8aa651685461a5efb8bb600">◆ </a></span>get_current_player()</h2> + +<div class="memitem"> +<div class="memproto"> +<table class="mlabels"> + <tr> + <td class="mlabels-left"> + <table class="memname"> + <tr> + <td class="memname"><a class="el" href="classplayer.html">player</a> * game_state::get_current_player </td> + <td>(</td> + <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td> + <td> const</td> + </tr> + </table> + </td> + <td class="mlabels-right"> +<span class="mlabels"><span class="mlabel">nodiscard</span></span> </td> + </tr> +</table> +</div><div class="memdoc"> + +<p>Gets the current player. </p> +<dl class="section return"><dt>Returns</dt><dd>The current player. </dd></dl> + +</div> +</div> +<a id="a4327f753f1f5341f9fe3774ea3fbc99b" name="a4327f753f1f5341f9fe3774ea3fbc99b"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a4327f753f1f5341f9fe3774ea3fbc99b">◆ </a></span>get_last_trick()</h2> + +<div class="memitem"> +<div class="memproto"> +<table class="mlabels"> + <tr> + <td class="mlabels-left"> + <table class="memname"> + <tr> + <td class="memname"><a class="el" href="classtrick.html">trick</a> * game_state::get_last_trick </td> + <td>(</td> + <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td> + <td> const</td> + </tr> + </table> + </td> + <td class="mlabels-right"> +<span class="mlabels"><span class="mlabel">nodiscard</span></span> </td> + </tr> +</table> +</div><div class="memdoc"> + +<p>Gets the previous trick. </p> +<dl class="section return"><dt>Returns</dt><dd>The previous trick. </dd></dl> + +</div> +</div> +<a id="aa75c4da6c0056e48e5040be8127d7473" name="aa75c4da6c0056e48e5040be8127d7473"></a> +<h2 class="memtitle"><span class="permalink"><a href="#aa75c4da6c0056e48e5040be8127d7473">◆ </a></span>get_max_round_number()</h2> + +<div class="memitem"> +<div class="memproto"> +<table class="mlabels"> + <tr> + <td class="mlabels-left"> + <table class="memname"> + <tr> + <td class="memname">unsigned int game_state::get_max_round_number </td> + <td>(</td> + <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td> + <td> const</td> + </tr> + </table> + </td> + <td class="mlabels-right"> +<span class="mlabels"><span class="mlabel">nodiscard</span></span> </td> + </tr> +</table> +</div><div class="memdoc"> + +<p>Gets the maximum round number. </p> +<dl class="section return"><dt>Returns</dt><dd>The maximum round number.</dd></dl> +<p>The maximum number of rounds is determined by the number of players in the game. It is calculated by dividing 60 by the number of players. With 3 players, there are 20 rounds, while with 6 players, there are 10 rounds. </p> + +</div> +</div> +<a id="abcaccd551f938f961d12266e34c037d2" name="abcaccd551f938f961d12266e34c037d2"></a> +<h2 class="memtitle"><span class="permalink"><a href="#abcaccd551f938f961d12266e34c037d2">◆ </a></span>get_players()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">std::vector< <a class="el" href="classplayer.html">player</a> * > & game_state::get_players </td> + <td>(</td> + <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td> + <td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Gets the players that joined the game. </p> +<dl class="section return"><dt>Returns</dt><dd>The players that joined the game. </dd></dl> + +</div> +</div> +<a id="ab3ef836a1b3a1e2bc9e429a018c72eca" name="ab3ef836a1b3a1e2bc9e429a018c72eca"></a> +<h2 class="memtitle"><span class="permalink"><a href="#ab3ef836a1b3a1e2bc9e429a018c72eca">◆ </a></span>get_round_number()</h2> + +<div class="memitem"> +<div class="memproto"> +<table class="mlabels"> + <tr> + <td class="mlabels-left"> + <table class="memname"> + <tr> + <td class="memname">int game_state::get_round_number </td> + <td>(</td> + <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td> + <td> const</td> + </tr> + </table> + </td> + <td class="mlabels-right"> +<span class="mlabels"><span class="mlabel">nodiscard</span></span> </td> + </tr> +</table> +</div><div class="memdoc"> + +<p>Gets the round number. </p> +<dl class="section return"><dt>Returns</dt><dd>The round number. </dd></dl> + +</div> +</div> +<a id="af4c553229260e307ff1f78dd0c74506d" name="af4c553229260e307ff1f78dd0c74506d"></a> +<h2 class="memtitle"><span class="permalink"><a href="#af4c553229260e307ff1f78dd0c74506d">◆ </a></span>get_starting_player()</h2> + +<div class="memitem"> +<div class="memproto"> +<table class="mlabels"> + <tr> + <td class="mlabels-left"> + <table class="memname"> + <tr> + <td class="memname"><a class="el" href="classplayer.html">player</a> * game_state::get_starting_player </td> + <td>(</td> + <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td> + <td> const</td> + </tr> + </table> + </td> + <td class="mlabels-right"> +<span class="mlabels"><span class="mlabel">nodiscard</span></span> </td> + </tr> +</table> +</div><div class="memdoc"> + +<p>Gets the starting player of the current round. </p> +<dl class="section return"><dt>Returns</dt><dd>The starting player of the current round. </dd></dl> + +</div> +</div> +<a id="a472fd1721c7cc9e3689394f18c767bf9" name="a472fd1721c7cc9e3689394f18c767bf9"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a472fd1721c7cc9e3689394f18c767bf9">◆ </a></span>get_trick()</h2> + +<div class="memitem"> +<div class="memproto"> +<table class="mlabels"> + <tr> + <td class="mlabels-left"> + <table class="memname"> + <tr> + <td class="memname"><a class="el" href="classtrick.html">trick</a> * game_state::get_trick </td> + <td>(</td> + <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td> + <td> const</td> + </tr> + </table> + </td> + <td class="mlabels-right"> +<span class="mlabels"><span class="mlabel">nodiscard</span></span> </td> + </tr> +</table> +</div><div class="memdoc"> + +<p>Gets the current trick. </p> +<dl class="section return"><dt>Returns</dt><dd>The current trick. </dd></dl> + +</div> +</div> +<a id="aa5263d03c85bce1e9d252e9017cbe282" name="aa5263d03c85bce1e9d252e9017cbe282"></a> +<h2 class="memtitle"><span class="permalink"><a href="#aa5263d03c85bce1e9d252e9017cbe282">◆ </a></span>get_trick_estimate_sum()</h2> + +<div class="memitem"> +<div class="memproto"> +<table class="mlabels"> + <tr> + <td class="mlabels-left"> + <table class="memname"> + <tr> + <td class="memname">int game_state::get_trick_estimate_sum </td> + <td>(</td> + <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td> + <td> const</td> + </tr> + </table> + </td> + <td class="mlabels-right"> +<span class="mlabels"><span class="mlabel">nodiscard</span></span> </td> + </tr> +</table> +</div><div class="memdoc"> + +<p>Gets the trick estimate sum. </p> +<dl class="section return"><dt>Returns</dt><dd>The trick estimate sum. </dd></dl> + +</div> +</div> +<a id="a3fce12f31ad0aab82b0d2da90e3e8e15" name="a3fce12f31ad0aab82b0d2da90e3e8e15"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a3fce12f31ad0aab82b0d2da90e3e8e15">◆ </a></span>get_trick_number()</h2> + +<div class="memitem"> +<div class="memproto"> +<table class="mlabels"> + <tr> + <td class="mlabels-left"> + <table class="memname"> + <tr> + <td class="memname">int game_state::get_trick_number </td> + <td>(</td> + <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td> + <td> const</td> + </tr> + </table> + </td> + <td class="mlabels-right"> +<span class="mlabels"><span class="mlabel">nodiscard</span></span> </td> + </tr> +</table> +</div><div class="memdoc"> + +<p>Gets the trick number. </p> +<dl class="section return"><dt>Returns</dt><dd>The trick number. </dd></dl> + +</div> +</div> +<a id="aa40554d105939c5dce934daaa858c242" name="aa40554d105939c5dce934daaa858c242"></a> +<h2 class="memtitle"><span class="permalink"><a href="#aa40554d105939c5dce934daaa858c242">◆ </a></span>get_trick_starting_player()</h2> + +<div class="memitem"> +<div class="memproto"> +<table class="mlabels"> + <tr> + <td class="mlabels-left"> + <table class="memname"> + <tr> + <td class="memname"><a class="el" href="classplayer.html">player</a> * game_state::get_trick_starting_player </td> + <td>(</td> + <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td> + <td> const</td> + </tr> + </table> + </td> + <td class="mlabels-right"> +<span class="mlabels"><span class="mlabel">nodiscard</span></span> </td> + </tr> +</table> +</div><div class="memdoc"> + +<p>Gets the starting player of the current trick. </p> +<dl class="section return"><dt>Returns</dt><dd>The starting player of the current trick. </dd></dl> + +</div> +</div> +<a id="abdf6c5116ed643773d676c90a05e6fe4" name="abdf6c5116ed643773d676c90a05e6fe4"></a> +<h2 class="memtitle"><span class="permalink"><a href="#abdf6c5116ed643773d676c90a05e6fe4">◆ </a></span>get_trump_color()</h2> + +<div class="memitem"> +<div class="memproto"> +<table class="mlabels"> + <tr> + <td class="mlabels-left"> + <table class="memname"> + <tr> + <td class="memname">int game_state::get_trump_color </td> + <td>(</td> + <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td> + <td> const</td> + </tr> + </table> + </td> + <td class="mlabels-right"> +<span class="mlabels"><span class="mlabel">nodiscard</span></span> </td> + </tr> +</table> +</div><div class="memdoc"> + +<p>Gets the trump color. </p> +<dl class="section return"><dt>Returns</dt><dd>The trump color. </dd></dl> + +</div> +</div> +<a id="a88d19342ee76acc4660b3e56e8c126eb" name="a88d19342ee76acc4660b3e56e8c126eb"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a88d19342ee76acc4660b3e56e8c126eb">◆ </a></span>is_estimation_phase()</h2> + +<div class="memitem"> +<div class="memproto"> +<table class="mlabels"> + <tr> + <td class="mlabels-left"> + <table class="memname"> + <tr> + <td class="memname">bool game_state::is_estimation_phase </td> + <td>(</td> + <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td> + <td> const</td> + </tr> + </table> + </td> + <td class="mlabels-right"> +<span class="mlabels"><span class="mlabel">nodiscard</span></span> </td> + </tr> +</table> +</div><div class="memdoc"> + +<p>Checks if the game is in estimation phase. </p> +<dl class="section return"><dt>Returns</dt><dd>A boolean indicating whether the game is in estimation phase. </dd></dl> + +</div> +</div> +<a id="a9b83de8a89e3bb506184492d22c3cf45" name="a9b83de8a89e3bb506184492d22c3cf45"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a9b83de8a89e3bb506184492d22c3cf45">◆ </a></span>is_finished()</h2> + +<div class="memitem"> +<div class="memproto"> +<table class="mlabels"> + <tr> + <td class="mlabels-left"> + <table class="memname"> + <tr> + <td class="memname">bool game_state::is_finished </td> + <td>(</td> + <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td> + <td> const</td> + </tr> + </table> + </td> + <td class="mlabels-right"> +<span class="mlabels"><span class="mlabel">nodiscard</span></span> </td> + </tr> +</table> +</div><div class="memdoc"> + +<p>Checks if the game is finished. </p> +<dl class="section return"><dt>Returns</dt><dd>A boolean indicating whether the game is finished. </dd></dl> + +</div> +</div> +<a id="ae161c283e275a57d71834754d11e9e40" name="ae161c283e275a57d71834754d11e9e40"></a> +<h2 class="memtitle"><span class="permalink"><a href="#ae161c283e275a57d71834754d11e9e40">◆ </a></span>is_full()</h2> + +<div class="memitem"> +<div class="memproto"> +<table class="mlabels"> + <tr> + <td class="mlabels-left"> + <table class="memname"> + <tr> + <td class="memname">bool game_state::is_full </td> + <td>(</td> + <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td> + <td> const</td> + </tr> + </table> + </td> + <td class="mlabels-right"> +<span class="mlabels"><span class="mlabel">nodiscard</span></span> </td> + </tr> +</table> +</div><div class="memdoc"> + +<p>Checks if the game is full. </p> +<dl class="section return"><dt>Returns</dt><dd>A boolean indicating whether the game is full </dd></dl> + +</div> +</div> +<a id="a371d6a6d84395b90c15d84549b05d553" name="a371d6a6d84395b90c15d84549b05d553"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a371d6a6d84395b90c15d84549b05d553">◆ </a></span>is_player_in_game()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">bool game_state::is_player_in_game </td> + <td>(</td> + <td class="paramtype"><a class="el" href="classplayer.html">player</a> *</td> <td class="paramname"><span class="paramname"><em>player</em></span></td><td>)</td> + <td> const</td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Checks if the given player is in the game. </p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">player</td><td>The player that is checked. </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>A boolean indicating whether the given player is in the game. </dd></dl> + +</div> +</div> +<a id="aa0092c41779f38eba5e921e43b38559c" name="aa0092c41779f38eba5e921e43b38559c"></a> +<h2 class="memtitle"><span class="permalink"><a href="#aa0092c41779f38eba5e921e43b38559c">◆ </a></span>is_started()</h2> + +<div class="memitem"> +<div class="memproto"> +<table class="mlabels"> + <tr> + <td class="mlabels-left"> + <table class="memname"> + <tr> + <td class="memname">bool game_state::is_started </td> + <td>(</td> + <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td> + <td> const</td> + </tr> + </table> + </td> + <td class="mlabels-right"> +<span class="mlabels"><span class="mlabel">nodiscard</span></span> </td> + </tr> +</table> +</div><div class="memdoc"> + +<p>Checks if the game is started. </p> +<dl class="section return"><dt>Returns</dt><dd>A boolean indicating whether the game is started. </dd></dl> + +</div> +</div> +<a id="a6c65d95086a88b8d111de5553e1210ec" name="a6c65d95086a88b8d111de5553e1210ec"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a6c65d95086a88b8d111de5553e1210ec">◆ </a></span>play_card()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">bool game_state::play_card </td> + <td>(</td> + <td class="paramtype"><a class="el" href="classplayer.html">player</a> *</td> <td class="paramname"><span class="paramname"><em>player</em></span>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">const std::string &</td> <td class="paramname"><span class="paramname"><em>card_id</em></span>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">std::string &</td> <td class="paramname"><span class="paramname"><em>err</em></span> )</td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Plays a card. </p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">player</td><td>The player that plays the card. </td></tr> + <tr><td class="paramname">card_id</td><td>The id of the card that is played. </td></tr> + <tr><td class="paramname">err</td><td>The error message updated in case something does not work. </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>A boolean indicating whether the card could be played or not.</dd></dl> +<p>This function is called whenever a player tries to play a card. If the card is in the player's hand, and it can be played (see can_be_played method of <a class="el" href="classgame__state.html" title="Represents the state of the game.">game_state</a>), the card is added to the trick and removed from the player's hand. Afterward, the game proceeds by calling update_current_player (see below). </p> + +</div> +</div> +<a id="a734fc594d457aa4e6db5bc7467e6442d" name="a734fc594d457aa4e6db5bc7467e6442d"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a734fc594d457aa4e6db5bc7467e6442d">◆ </a></span>remove_player()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">bool game_state::remove_player </td> + <td>(</td> + <td class="paramtype"><a class="el" href="classplayer.html">player</a> *</td> <td class="paramname"><span class="paramname"><em>player</em></span>, </td> + </tr> + <tr> + <td class="paramkey"></td> + <td></td> + <td class="paramtype">std::string &</td> <td class="paramname"><span class="paramname"><em>err</em></span> )</td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Removes a player from the game. </p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">player</td><td>The player that is removed. </td></tr> + <tr><td class="paramname">err</td><td>The error message updated in case something does not work. </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>A boolean indicating whether removing the player worked or not.</dd></dl> +<p>This function tries to remove a player from the game. While this is done, the players vector is updated so that the remaining players can start a new round. </p> + +</div> +</div> +<a id="a745dd23945b6165470c494b036ac4667" name="a745dd23945b6165470c494b036ac4667"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a745dd23945b6165470c494b036ac4667">◆ </a></span>set_trick()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">void game_state::set_trick </td> + <td>(</td> + <td class="paramtype"><a class="el" href="classtrick.html">trick</a> *</td> <td class="paramname"><span class="paramname"><em>new_trick</em></span></td><td>)</td> + <td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Sets the trick to the given trick. </p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">new_trick</td><td>The new trick. </td></tr> + </table> + </dd> +</dl> + +</div> +</div> +<a id="ab520d4076c53f70a68bc19f355243a4d" name="ab520d4076c53f70a68bc19f355243a4d"></a> +<h2 class="memtitle"><span class="permalink"><a href="#ab520d4076c53f70a68bc19f355243a4d">◆ </a></span>setup_round()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">void game_state::setup_round </td> + <td>(</td> + <td class="paramtype">std::string &</td> <td class="paramname"><span class="paramname"><em>err</em></span></td><td>)</td> + <td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Sets up a round. </p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">err</td><td>The error message updated in case something does not work.</td></tr> + </table> + </dd> +</dl> +<p>This function sets up a new round. To do so, it changes the phase to estimation phase, sets the trick estimate sum to zero, and updates the starting player indices. It also sets up the deck (which draws cards into players' hands), determines the trump, and sets up the trick. </p> + +</div> +</div> +<a id="a6ca6536eaec3404ff9b1ab39b8df4e67" name="a6ca6536eaec3404ff9b1ab39b8df4e67"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a6ca6536eaec3404ff9b1ab39b8df4e67">◆ </a></span>start_game()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">bool game_state::start_game </td> + <td>(</td> + <td class="paramtype">std::string &</td> <td class="paramname"><span class="paramname"><em>err</em></span></td><td>)</td> + <td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Starts the game. </p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">err</td><td>The error message updated in case something does not work. </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>A boolean indicating whether the game could be started or not.</dd></dl> +<p>This function tries to start the game. To do so, it checks if the round is already started and if enough players have joint the game. </p> + +</div> +</div> +<a id="a49851709fcec061d36478ed2fdcc3d9d" name="a49851709fcec061d36478ed2fdcc3d9d"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a49851709fcec061d36478ed2fdcc3d9d">◆ </a></span>update_current_player()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">bool game_state::update_current_player </td> + <td>(</td> + <td class="paramtype">std::string &</td> <td class="paramname"><span class="paramname"><em>err</em></span></td><td>)</td> + <td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Updates the current player after estimating tricks or playing cards. </p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">err</td><td>The error message updated in case something does not work. </td></tr> + </table> + </dd> +</dl> +<dl class="section return"><dt>Returns</dt><dd>A boolean indicating whether the current player could be updated or not.</dd></dl> +<p>This function is called whenever a trick estimation or playing of a card was successful, and it progresses the game after these actions. First, the function updates the current player to be the next player. If the updated current player still has to estimate their tricks or play their card in the current round or trick, the game just proceeds. However, if the updated current player is the same player that started the current trick or round, the current trick or round is wrapped up and a new one is set up. </p> + +</div> +</div> +<a id="ad2e967638043670ebae93dd6ec32e91e" name="ad2e967638043670ebae93dd6ec32e91e"></a> +<h2 class="memtitle"><span class="permalink"><a href="#ad2e967638043670ebae93dd6ec32e91e">◆ </a></span>wrap_up_round()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">void game_state::wrap_up_round </td> + <td>(</td> + <td class="paramtype">std::string &</td> <td class="paramname"><span class="paramname"><em>err</em></span></td><td>)</td> + <td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Wraps up a round. </p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">err</td><td>The error message updated in case something does not work.</td></tr> + </table> + </dd> +</dl> +<p>This function wraps up a round by moving the starting player index further to the next player, and by calling the wrap_up_round function of each player (this calculates the scores, see player class for more information). If the game is finished after the current round, the function also call finish_game to finish the game. </p> + +</div> +</div> <a id="a54873cd18b46555915d150a6d8dd6f83" name="a54873cd18b46555915d150a6d8dd6f83"></a> <h2 class="memtitle"><span class="permalink"><a href="#a54873cd18b46555915d150a6d8dd6f83">◆ </a></span>write_into_json()</h2> @@ -239,6 +1056,15 @@ std::string </td><td class="memItemRight" valign="bottom"><b>_id</b></td></ </table> </div><div class="memdoc"> +<p>Serializes a <a class="el" href="classgame__state.html" title="Represents the state of the game.">game_state</a> object into a json object. </p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">json</td><td>The json object for serializing the <a class="el" href="classgame__state.html" title="Represents the state of the game.">game_state</a>. </td></tr> + <tr><td class="paramname">allocator</td><td>The json allocator for serializing the <a class="el" href="classgame__state.html" title="Represents the state of the game.">game_state</a>. </td></tr> + </table> + </dd> +</dl> + <p>Implements <a class="el" href="classserializable.html">serializable</a>.</p> </div> diff --git a/html/classserializable.html b/html/classserializable.html index 762e339..10094f1 100644 --- a/html/classserializable.html +++ b/html/classserializable.html @@ -114,7 +114,7 @@ Inheritance diagram for serializable:</div> <area href="classrequest__response.html" alt="request_response" shape="rect" coords="1206,168,1397,192"/> <area href="classcard.html" title="Represents a card in the game." alt="card" shape="rect" coords="1608,112,1799,136"/> <area href="classdeck.html" title="Represents the card deck in the game." alt="deck" shape="rect" coords="1608,168,1799,192"/> -<area href="classgame__state.html" alt="game_state" shape="rect" coords="1608,224,1799,248"/> +<area href="classgame__state.html" title="Represents the state of the game." alt="game_state" shape="rect" coords="1608,224,1799,248"/> <area href="classhand.html" title="Represents a player's hand in the game." alt="hand" shape="rect" coords="1608,280,1799,304"/> <area href="classplayer.html" title="Represents a player in the game." alt="player" shape="rect" coords="1608,336,1799,360"/> <area href="classtrick.html" title="Represents the trick in the game." alt="trick" shape="rect" coords="1608,392,1799,416"/> @@ -157,7 +157,7 @@ virtual rapidjson::Document * </td><td class="memItemRight" valign="bottom" </table> </div><div class="memdoc"> -<p>Implemented in <a class="el" href="classcard.html#a7f900b843e44fb18364f32dbe6cdbc7a">card</a>, <a class="el" href="classdeck.html#a8d226fe699a36bf462010ba1f744fbeb">deck</a>, <a class="el" href="classhand.html#a505a82447d0ae305dadcc9c4aa54071e">hand</a>, <a class="el" href="classplayer.html#a0cf13abfdb6b837faa88eda064bf51dc">player</a>, and <a class="el" href="classtrick.html#a97176df194eae794691356cd83292b04">trick</a>.</p> +<p>Implemented in <a class="el" href="classcard.html#a7f900b843e44fb18364f32dbe6cdbc7a">card</a>, <a class="el" href="classdeck.html#a8d226fe699a36bf462010ba1f744fbeb">deck</a>, <a class="el" href="classgame__state.html#a54873cd18b46555915d150a6d8dd6f83">game_state</a>, <a class="el" href="classhand.html#a505a82447d0ae305dadcc9c4aa54071e">hand</a>, <a class="el" href="classplayer.html#a0cf13abfdb6b837faa88eda064bf51dc">player</a>, and <a class="el" href="classtrick.html#a97176df194eae794691356cd83292b04">trick</a>.</p> </div> </div> diff --git a/html/classtrick-members.html b/html/classtrick-members.html index b67cfe8..a4be812 100644 --- a/html/classtrick-members.html +++ b/html/classtrick-members.html @@ -102,16 +102,17 @@ $(function(){ initResizable(false); }); <tr class="even"><td class="entry"><a class="el" href="classtrick.html#ae5b769ed0fc2933c1a44b5e481c18b00">set_up_round</a>(int trump, std::string &err)</td><td class="entry"><a class="el" href="classtrick.html">trick</a></td><td class="entry"></td></tr> <tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>to_json</b>() const (defined in <a class="el" href="classserializable.html">serializable</a>)</td><td class="entry"><a class="el" href="classserializable.html">serializable</a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">virtual</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classtrick.html#a3b0a12789b87d15d9cdc4e5b6f85b47d">trick</a>()</td><td class="entry"><a class="el" href="classtrick.html">trick</a></td><td class="entry"></td></tr> - <tr class="odd"><td class="entry"><a class="el" href="classtrick.html#abb172ad9a476e96a754eea0c33e1eda9">trick</a>(const std::string &id)</td><td class="entry"><a class="el" href="classtrick.html">trick</a></td><td class="entry"><span class="mlabel">explicit</span></td></tr> - <tr class="even"><td class="entry"><a class="el" href="classtrick.html#ab756ba7a19c4bf98f0d8456ad0081fc3">trick</a>(const std::string &id, const std::vector< std::pair< card *, player * > > &cards, serializable_value< int > *trick_color, serializable_value< int > *trump_color)</td><td class="entry"><a class="el" href="classtrick.html">trick</a></td><td class="entry"></td></tr> - <tr class="odd"><td class="entry"><a class="el" href="classtrick.html#a3ecb1c5ebe84a300d7388e2846737fa4">trick</a>(int trump)</td><td class="entry"><a class="el" href="classtrick.html">trick</a></td><td class="entry"><span class="mlabel">explicit</span></td></tr> - <tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>unique_serializable</b>() (defined in <a class="el" href="classunique__serializable.html">unique_serializable</a>)</td><td class="entry"><a class="el" href="classunique__serializable.html">unique_serializable</a></td><td class="entry"><span class="mlabel">protected</span></td></tr> - <tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>unique_serializable</b>(std::string id) (defined in <a class="el" href="classunique__serializable.html">unique_serializable</a>)</td><td class="entry"><a class="el" href="classunique__serializable.html">unique_serializable</a></td><td class="entry"><span class="mlabel">protected</span></td></tr> - <tr class="even"><td class="entry"><a class="el" href="classtrick.html#a384560623ffaf776797948cf35197c73">wrap_up_trick</a>(std::string &err) const</td><td class="entry"><a class="el" href="classtrick.html">trick</a></td><td class="entry"></td></tr> - <tr class="odd"><td class="entry"><a class="el" href="classtrick.html#a97176df194eae794691356cd83292b04">write_into_json</a>(rapidjson::Value &json, rapidjson::Document::AllocatorType &allocator) const override</td><td class="entry"><a class="el" href="classtrick.html">trick</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> - <tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>write_into_json</b>(rapidjson::Value &json, rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > &allocator) const override (defined in <a class="el" href="classunique__serializable.html">unique_serializable</a>)</td><td class="entry"><a class="el" href="classunique__serializable.html">unique_serializable</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> - <tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>~serializable</b>()=default (defined in <a class="el" href="classserializable.html">serializable</a>)</td><td class="entry"><a class="el" href="classserializable.html">serializable</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> - <tr class="even"><td class="entry"><a class="el" href="classtrick.html#a22c0b586f1d6c3baeb7bb0e22eb7dfe2">~trick</a>() override</td><td class="entry"><a class="el" href="classtrick.html">trick</a></td><td class="entry"></td></tr> + <tr class="odd"><td class="entry"><a class="el" href="classtrick.html#ad55ad2f0462144ee39c0e6d392543a14">trick</a>(const trick &other)</td><td class="entry"><a class="el" href="classtrick.html">trick</a></td><td class="entry"></td></tr> + <tr class="even"><td class="entry"><a class="el" href="classtrick.html#abb172ad9a476e96a754eea0c33e1eda9">trick</a>(const std::string &id)</td><td class="entry"><a class="el" href="classtrick.html">trick</a></td><td class="entry"><span class="mlabel">explicit</span></td></tr> + <tr class="odd"><td class="entry"><a class="el" href="classtrick.html#ab756ba7a19c4bf98f0d8456ad0081fc3">trick</a>(const std::string &id, const std::vector< std::pair< card *, player * > > &cards, serializable_value< int > *trick_color, serializable_value< int > *trump_color)</td><td class="entry"><a class="el" href="classtrick.html">trick</a></td><td class="entry"></td></tr> + <tr class="even"><td class="entry"><a class="el" href="classtrick.html#a3ecb1c5ebe84a300d7388e2846737fa4">trick</a>(int trump)</td><td class="entry"><a class="el" href="classtrick.html">trick</a></td><td class="entry"><span class="mlabel">explicit</span></td></tr> + <tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>unique_serializable</b>() (defined in <a class="el" href="classunique__serializable.html">unique_serializable</a>)</td><td class="entry"><a class="el" href="classunique__serializable.html">unique_serializable</a></td><td class="entry"><span class="mlabel">protected</span></td></tr> + <tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>unique_serializable</b>(std::string id) (defined in <a class="el" href="classunique__serializable.html">unique_serializable</a>)</td><td class="entry"><a class="el" href="classunique__serializable.html">unique_serializable</a></td><td class="entry"><span class="mlabel">protected</span></td></tr> + <tr class="odd"><td class="entry"><a class="el" href="classtrick.html#a384560623ffaf776797948cf35197c73">wrap_up_trick</a>(std::string &err) const</td><td class="entry"><a class="el" href="classtrick.html">trick</a></td><td class="entry"></td></tr> + <tr class="even"><td class="entry"><a class="el" href="classtrick.html#a97176df194eae794691356cd83292b04">write_into_json</a>(rapidjson::Value &json, rapidjson::Document::AllocatorType &allocator) const override</td><td class="entry"><a class="el" href="classtrick.html">trick</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> + <tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>write_into_json</b>(rapidjson::Value &json, rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > &allocator) const override (defined in <a class="el" href="classunique__serializable.html">unique_serializable</a>)</td><td class="entry"><a class="el" href="classunique__serializable.html">unique_serializable</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> + <tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>~serializable</b>()=default (defined in <a class="el" href="classserializable.html">serializable</a>)</td><td class="entry"><a class="el" href="classserializable.html">serializable</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> + <tr class="odd"><td class="entry"><a class="el" href="classtrick.html#a22c0b586f1d6c3baeb7bb0e22eb7dfe2">~trick</a>() override</td><td class="entry"><a class="el" href="classtrick.html">trick</a></td><td class="entry"></td></tr> </table></div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> diff --git a/html/classtrick.html b/html/classtrick.html index cb1256f..ce546e1 100644 --- a/html/classtrick.html +++ b/html/classtrick.html @@ -114,6 +114,9 @@ Public Member Functions</h2></td></tr>  </td><td class="memItemRight" valign="bottom"><b>trick</b> ()</td></tr> <tr class="memdesc:a3b0a12789b87d15d9cdc4e5b6f85b47d"><td class="mdescLeft"> </td><td class="mdescRight">Constructs a new trick object. <br /></td></tr> <tr class="separator:a3b0a12789b87d15d9cdc4e5b6f85b47d"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:ad55ad2f0462144ee39c0e6d392543a14" id="r_ad55ad2f0462144ee39c0e6d392543a14"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#ad55ad2f0462144ee39c0e6d392543a14">trick</a> (const <a class="el" href="classtrick.html">trick</a> &other)</td></tr> +<tr class="memdesc:ad55ad2f0462144ee39c0e6d392543a14"><td class="mdescLeft"> </td><td class="mdescRight">Constructs a new trick object as a deep copy of another trick object. <br /></td></tr> +<tr class="separator:ad55ad2f0462144ee39c0e6d392543a14"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:abb172ad9a476e96a754eea0c33e1eda9" id="r_abb172ad9a476e96a754eea0c33e1eda9"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#abb172ad9a476e96a754eea0c33e1eda9">trick</a> (const std::string &id)</td></tr> <tr class="memdesc:abb172ad9a476e96a754eea0c33e1eda9"><td class="mdescLeft"> </td><td class="mdescRight">Constructs a new trick object (from_diff). <br /></td></tr> <tr class="separator:abb172ad9a476e96a754eea0c33e1eda9"><td class="memSeparator" colspan="2"> </td></tr> @@ -185,8 +188,33 @@ std::string </td><td class="memItemRight" valign="bottom"><b>_id</b></td></ <p>This class encapsulates all information about a trick, including the trick color (suit of the trick), the trump color, and the cards played in the trick.</p> <p>Every round consists of round-number-many tricks. In each trick, each player plays exactly one card. The first played color determines the trick color, and other players must play cards of that color if they hold any (exception: wizards and jesters can always be played). Each trick has one winner, which is determined by the player who played the first wizard, or by the player who played the highest trump color card, or by the player who played the highest trick color card (in that order). </p> </div><h2 class="groupheader">Constructor & Destructor Documentation</h2> +<a id="ad55ad2f0462144ee39c0e6d392543a14" name="ad55ad2f0462144ee39c0e6d392543a14"></a> +<h2 class="memtitle"><span class="permalink"><a href="#ad55ad2f0462144ee39c0e6d392543a14">◆ </a></span>trick() <span class="overload">[1/4]</span></h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">trick::trick </td> + <td>(</td> + <td class="paramtype">const <a class="el" href="classtrick.html">trick</a> &</td> <td class="paramname"><span class="paramname"><em>other</em></span></td><td>)</td> + <td></td> + </tr> + </table> +</div><div class="memdoc"> + +<p>Constructs a new trick object as a deep copy of another trick object. </p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">other</td><td>The trick it is copied from. </td></tr> + </table> + </dd> +</dl> + +</div> +</div> <a id="abb172ad9a476e96a754eea0c33e1eda9" name="abb172ad9a476e96a754eea0c33e1eda9"></a> -<h2 class="memtitle"><span class="permalink"><a href="#abb172ad9a476e96a754eea0c33e1eda9">◆ </a></span>trick() <span class="overload">[1/3]</span></h2> +<h2 class="memtitle"><span class="permalink"><a href="#abb172ad9a476e96a754eea0c33e1eda9">◆ </a></span>trick() <span class="overload">[2/4]</span></h2> <div class="memitem"> <div class="memproto"> @@ -219,7 +247,7 @@ std::string </td><td class="memItemRight" valign="bottom"><b>_id</b></td></ </div> </div> <a id="ab756ba7a19c4bf98f0d8456ad0081fc3" name="ab756ba7a19c4bf98f0d8456ad0081fc3"></a> -<h2 class="memtitle"><span class="permalink"><a href="#ab756ba7a19c4bf98f0d8456ad0081fc3">◆ </a></span>trick() <span class="overload">[2/3]</span></h2> +<h2 class="memtitle"><span class="permalink"><a href="#ab756ba7a19c4bf98f0d8456ad0081fc3">◆ </a></span>trick() <span class="overload">[3/4]</span></h2> <div class="memitem"> <div class="memproto"> @@ -261,7 +289,7 @@ std::string </td><td class="memItemRight" valign="bottom"><b>_id</b></td></ </div> </div> <a id="a3ecb1c5ebe84a300d7388e2846737fa4" name="a3ecb1c5ebe84a300d7388e2846737fa4"></a> -<h2 class="memtitle"><span class="permalink"><a href="#a3ecb1c5ebe84a300d7388e2846737fa4">◆ </a></span>trick() <span class="overload">[3/3]</span></h2> +<h2 class="memtitle"><span class="permalink"><a href="#a3ecb1c5ebe84a300d7388e2846737fa4">◆ </a></span>trick() <span class="overload">[4/4]</span></h2> <div class="memitem"> <div class="memproto"> diff --git a/html/classunique__serializable.html b/html/classunique__serializable.html index 487e3b7..2132cfc 100644 --- a/html/classunique__serializable.html +++ b/html/classunique__serializable.html @@ -102,7 +102,7 @@ Inheritance diagram for unique_serializable:</div> <area href="classserializable.html" alt="serializable" shape="rect" coords="325,0,445,24"/> <area href="classcard.html" title="Represents a card in the game." alt="card" shape="rect" coords="0,112,120,136"/> <area href="classdeck.html" title="Represents the card deck in the game." alt="deck" shape="rect" coords="130,112,250,136"/> -<area href="classgame__state.html" alt="game_state" shape="rect" coords="260,112,380,136"/> +<area href="classgame__state.html" title="Represents the state of the game." alt="game_state" shape="rect" coords="260,112,380,136"/> <area href="classhand.html" title="Represents a player's hand in the game." alt="hand" shape="rect" coords="390,112,510,136"/> <area href="classplayer.html" title="Represents a player in the game." alt="player" shape="rect" coords="520,112,640,136"/> <area href="classtrick.html" title="Represents the trick in the game." alt="trick" shape="rect" coords="650,112,770,136"/> diff --git a/html/doxygen_crawl.html b/html/doxygen_crawl.html index ed22813..42309a8 100644 --- a/html/doxygen_crawl.html +++ b/html/doxygen_crawl.html @@ -172,6 +172,10 @@ <a href="functions.html"/> <a href="functions.html"/> <a href="functions.html"/> +<a href="functions.html"/> +<a href="functions.html"/> +<a href="functions_func.html"/> +<a href="functions_func.html"/> <a href="functions_func.html"/> <a href="functions_func.html"/> <a href="functions_func.html"/> @@ -242,6 +246,36 @@ <a href="classgame__instance.html"/> <a href="classgame__instance__manager.html"/> <a href="classgame__state.html"/> +<a href="classgame__state.html#a0c10b830e222d726557c3c33685c595a"/> +<a href="classgame__state.html#a2d16f420a8aa651685461a5efb8bb600"/> +<a href="classgame__state.html#a2fbc370f93617298719f61514afdb5bc"/> +<a href="classgame__state.html#a371d6a6d84395b90c15d84549b05d553"/> +<a href="classgame__state.html#a3fce12f31ad0aab82b0d2da90e3e8e15"/> +<a href="classgame__state.html#a4327f753f1f5341f9fe3774ea3fbc99b"/> +<a href="classgame__state.html#a472fd1721c7cc9e3689394f18c767bf9"/> +<a href="classgame__state.html#a49851709fcec061d36478ed2fdcc3d9d"/> +<a href="classgame__state.html#a4a4fde0700a05c589a6b9c4dbcffac18"/> +<a href="classgame__state.html#a54873cd18b46555915d150a6d8dd6f83"/> +<a href="classgame__state.html#a67fdd4b5682715cd2d848031a9911b17"/> +<a href="classgame__state.html#a6c65d95086a88b8d111de5553e1210ec"/> +<a href="classgame__state.html#a6ca6536eaec3404ff9b1ab39b8df4e67"/> +<a href="classgame__state.html#a734fc594d457aa4e6db5bc7467e6442d"/> +<a href="classgame__state.html#a745dd23945b6165470c494b036ac4667"/> +<a href="classgame__state.html#a794d484961c92b5b737586ec5599963f"/> +<a href="classgame__state.html#a88d19342ee76acc4660b3e56e8c126eb"/> +<a href="classgame__state.html#a9b83de8a89e3bb506184492d22c3cf45"/> +<a href="classgame__state.html#aa0092c41779f38eba5e921e43b38559c"/> +<a href="classgame__state.html#aa40554d105939c5dce934daaa858c242"/> +<a href="classgame__state.html#aa5263d03c85bce1e9d252e9017cbe282"/> +<a href="classgame__state.html#aa75c4da6c0056e48e5040be8127d7473"/> +<a href="classgame__state.html#ab3ef836a1b3a1e2bc9e429a018c72eca"/> +<a href="classgame__state.html#ab520d4076c53f70a68bc19f355243a4d"/> +<a href="classgame__state.html#abcaccd551f938f961d12266e34c037d2"/> +<a href="classgame__state.html#abdf6c5116ed643773d676c90a05e6fe4"/> +<a href="classgame__state.html#ac4ebff625d83c633c124890537d60354"/> +<a href="classgame__state.html#ad2e967638043670ebae93dd6ec32e91e"/> +<a href="classgame__state.html#ae161c283e275a57d71834754d11e9e40"/> +<a href="classgame__state.html#af4c553229260e307ff1f78dd0c74506d"/> <a href="classhand.html"/> <a href="classhand.html#a0a50cbbb167e6a1d633dd48bc4b695fe"/> <a href="classhand.html#a4820b774c5446b60f74c6458691d1de8"/> @@ -300,6 +334,7 @@ <a href="classtrick.html#a97176df194eae794691356cd83292b04"/> <a href="classtrick.html#ab756ba7a19c4bf98f0d8456ad0081fc3"/> <a href="classtrick.html#abb172ad9a476e96a754eea0c33e1eda9"/> +<a href="classtrick.html#ad55ad2f0462144ee39c0e6d392543a14"/> <a href="classtrick.html#ae5b769ed0fc2933c1a44b5e481c18b00"/> <a href="classunique__serializable.html"/> <a href="classuuid__generator.html"/> diff --git a/html/full__state__response_8h_source.html b/html/full__state__response_8h_source.html index b700c4a..e642d90 100644 --- a/html/full__state__response_8h_source.html +++ b/html/full__state__response_8h_source.html @@ -131,7 +131,7 @@ $(function(){ initResizable(false); }); <div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> </div> <div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span><span class="preprocessor">#endif </span><span class="comment">//WIZARD_FULL_STATE_RESPONSE_H</span></div> <div class="ttc" id="aclassfull__state__response_html"><div class="ttname"><a href="classfull__state__response.html">full_state_response</a></div><div class="ttdef"><b>Definition</b> full_state_response.h:11</div></div> -<div class="ttc" id="aclassgame__state_html"><div class="ttname"><a href="classgame__state.html">game_state</a></div><div class="ttdef"><b>Definition</b> game_state.h:18</div></div> +<div class="ttc" id="aclassgame__state_html"><div class="ttname"><a href="classgame__state.html">game_state</a></div><div class="ttdoc">Represents the state of the game.</div><div class="ttdef"><b>Definition</b> game_state.h:27</div></div> <div class="ttc" id="aclassserver__response_html"><div class="ttname"><a href="classserver__response.html">server_response</a></div><div class="ttdef"><b>Definition</b> server_response.h:24</div></div> <div class="ttc" id="astructserver__response_1_1base__class__properties_html"><div class="ttname"><a href="structserver__response_1_1base__class__properties.html">server_response::base_class_properties</a></div><div class="ttdef"><b>Definition</b> server_response.h:36</div></div> </div><!-- fragment --></div><!-- contents --> diff --git a/html/functions.html b/html/functions.html index 9d0049f..223ade1 100644 --- a/html/functions.html +++ b/html/functions.html @@ -89,6 +89,7 @@ $(function(){ initResizable(false); }); <h3><a id="index_a" name="index_a"></a>- a -</h3><ul> <li>add_card() : <a class="el" href="classhand.html#ad4749893f36ff1d6dcda3bb18eaedffb">hand</a>, <a class="el" href="classplayer.html#ab3b087d03dd2c81d893b2ffad459a26f">player</a>, <a class="el" href="classtrick.html#a2d3b5aa88a1469dc3d58f30885752f5d">trick</a></li> +<li>add_player() : <a class="el" href="classgame__state.html#a4a4fde0700a05c589a6b9c4dbcffac18">game_state</a></li> </ul> @@ -104,25 +105,42 @@ $(function(){ initResizable(false); }); </ul> +<h3><a id="index_e" name="index_e"></a>- e -</h3><ul> +<li>estimate_tricks() : <a class="el" href="classgame__state.html#ac4ebff625d83c633c124890537d60354">game_state</a></li> +</ul> + + <h3><a id="index_f" name="index_f"></a>- f -</h3><ul> -<li>from_json() : <a class="el" href="classcard.html#a48593187c9bff442d61f197991954011">card</a>, <a class="el" href="classdeck.html#abe8dbe828189696c22f35ac3ed4fd296">deck</a>, <a class="el" href="classhand.html#aa9cffdf932d80c7304a335074403e785">hand</a>, <a class="el" href="classplayer.html#a5955c5f26db6a08862ccfb443fbe99c5">player</a>, <a class="el" href="classtrick.html#a1a3d94f638672d3d60d596190ae59dfb">trick</a></li> +<li>finish_game() : <a class="el" href="classgame__state.html#a67fdd4b5682715cd2d848031a9911b17">game_state</a></li> +<li>from_json() : <a class="el" href="classcard.html#a48593187c9bff442d61f197991954011">card</a>, <a class="el" href="classdeck.html#abe8dbe828189696c22f35ac3ed4fd296">deck</a>, <a class="el" href="classgame__state.html#a794d484961c92b5b737586ec5599963f">game_state</a>, <a class="el" href="classhand.html#aa9cffdf932d80c7304a335074403e785">hand</a>, <a class="el" href="classplayer.html#a5955c5f26db6a08862ccfb443fbe99c5">player</a>, <a class="el" href="classtrick.html#a1a3d94f638672d3d60d596190ae59dfb">trick</a></li> </ul> <h3><a id="index_g" name="index_g"></a>- g -</h3><ul> +<li>game_state() : <a class="el" href="classgame__state.html#a0c10b830e222d726557c3c33685c595a">game_state</a></li> <li>get_cards() : <a class="el" href="classhand.html#ad104b0376b1a13d987f349dd524ca47f">hand</a></li> <li>get_cards_and_players() : <a class="el" href="classtrick.html#a1d75f9e8fc94fd122adfc39a20089268">trick</a></li> <li>get_color() : <a class="el" href="classcard.html#ab033bc0e71b09d3cf3ac28c2f1fbde18">card</a></li> +<li>get_current_player() : <a class="el" href="classgame__state.html#a2d16f420a8aa651685461a5efb8bb600">game_state</a></li> <li>get_game_id() : <a class="el" href="classplayer.html#afeb6c5483a59042fcc4a3a2aed6a6a2c">player</a></li> <li>get_hand() : <a class="el" href="classplayer.html#af333dcbf7123726c9bda3ab94ba9ee6d">player</a></li> +<li>get_last_trick() : <a class="el" href="classgame__state.html#a4327f753f1f5341f9fe3774ea3fbc99b">game_state</a></li> +<li>get_max_round_number() : <a class="el" href="classgame__state.html#aa75c4da6c0056e48e5040be8127d7473">game_state</a></li> <li>get_nof_cards() : <a class="el" href="classhand.html#adc90d109b7b564a0dbca0b0798c99641">hand</a>, <a class="el" href="classplayer.html#a457c5ab90b0ecd610eead66b41c8333a">player</a></li> <li>get_nof_predicted() : <a class="el" href="classplayer.html#a40333c302ff51707749c544930fb80aa">player</a></li> <li>get_nof_tricks() : <a class="el" href="classplayer.html#a5e3d1374aee685b08a29d0ac7cec3df4">player</a></li> <li>get_number_of_remaining_cards() : <a class="el" href="classdeck.html#ae1c7a4174108a14cb1180de1afdcb6d6">deck</a></li> <li>get_player_name() : <a class="el" href="classplayer.html#a42d01dcf4cdbd452fc5dcaf5e6f21773">player</a></li> +<li>get_players() : <a class="el" href="classgame__state.html#abcaccd551f938f961d12266e34c037d2">game_state</a></li> +<li>get_round_number() : <a class="el" href="classgame__state.html#ab3ef836a1b3a1e2bc9e429a018c72eca">game_state</a></li> <li>get_scores() : <a class="el" href="classplayer.html#aef5c25a02a2fdbdb4d8270582faf5dac">player</a></li> +<li>get_starting_player() : <a class="el" href="classgame__state.html#af4c553229260e307ff1f78dd0c74506d">game_state</a></li> +<li>get_trick() : <a class="el" href="classgame__state.html#a472fd1721c7cc9e3689394f18c767bf9">game_state</a></li> <li>get_trick_color() : <a class="el" href="classtrick.html#a41f315804ac73454c8e41438da20a9c3">trick</a></li> -<li>get_trump_color() : <a class="el" href="classtrick.html#a69c49e2968abb235a6c7148cb05b0e64">trick</a></li> +<li>get_trick_estimate_sum() : <a class="el" href="classgame__state.html#aa5263d03c85bce1e9d252e9017cbe282">game_state</a></li> +<li>get_trick_number() : <a class="el" href="classgame__state.html#a3fce12f31ad0aab82b0d2da90e3e8e15">game_state</a></li> +<li>get_trick_starting_player() : <a class="el" href="classgame__state.html#aa40554d105939c5dce934daaa858c242">game_state</a></li> +<li>get_trump_color() : <a class="el" href="classgame__state.html#abdf6c5116ed643773d676c90a05e6fe4">game_state</a>, <a class="el" href="classtrick.html#a69c49e2968abb235a6c7148cb05b0e64">trick</a></li> <li>get_value() : <a class="el" href="classcard.html#a2baf8dfef09ac8c1a67b34c2e67186c3">card</a></li> </ul> @@ -134,16 +152,23 @@ $(function(){ initResizable(false); }); <h3><a id="index_i" name="index_i"></a>- i -</h3><ul> <li>is_empty() : <a class="el" href="classdeck.html#a6aef528ff7b9c608863cc77c19b7882d">deck</a></li> +<li>is_estimation_phase() : <a class="el" href="classgame__state.html#a88d19342ee76acc4660b3e56e8c126eb">game_state</a></li> +<li>is_finished() : <a class="el" href="classgame__state.html#a9b83de8a89e3bb506184492d22c3cf45">game_state</a></li> +<li>is_full() : <a class="el" href="classgame__state.html#ae161c283e275a57d71834754d11e9e40">game_state</a></li> +<li>is_player_in_game() : <a class="el" href="classgame__state.html#a371d6a6d84395b90c15d84549b05d553">game_state</a></li> +<li>is_started() : <a class="el" href="classgame__state.html#aa0092c41779f38eba5e921e43b38559c">game_state</a></li> </ul> <h3><a id="index_p" name="index_p"></a>- p -</h3><ul> +<li>play_card() : <a class="el" href="classgame__state.html#a6c65d95086a88b8d111de5553e1210ec">game_state</a></li> <li>player() : <a class="el" href="classplayer.html#a1f0916939a8caa2e7140d5c89a6aa718">player</a></li> </ul> <h3><a id="index_r" name="index_r"></a>- r -</h3><ul> <li>remove_card() : <a class="el" href="classhand.html#aa466496b7ce0b58dbd63620535430439">hand</a></li> +<li>remove_player() : <a class="el" href="classgame__state.html#a734fc594d457aa4e6db5bc7467e6442d">game_state</a></li> </ul> @@ -152,9 +177,11 @@ $(function(){ initResizable(false); }); <li>set_nof_predicted() : <a class="el" href="classplayer.html#a1a3ce0ac69cad799641f4d732435c3f7">player</a></li> <li>set_nof_tricks() : <a class="el" href="classplayer.html#a61aa38ceff0c856b36642c4bc0081433">player</a></li> <li>set_scores() : <a class="el" href="classplayer.html#af1d7e67eee27af87c01e43508a731bd4">player</a></li> +<li>set_trick() : <a class="el" href="classgame__state.html#a745dd23945b6165470c494b036ac4667">game_state</a></li> <li>set_trick_color() : <a class="el" href="classtrick.html#a0f8c45882691509564ec42efed0d1aaa">trick</a></li> <li>set_up_round() : <a class="el" href="classtrick.html#ae5b769ed0fc2933c1a44b5e481c18b00">trick</a></li> -<li>setup_round() : <a class="el" href="classdeck.html#a77851e5cb8297849e91a885ed7959de1">deck</a>, <a class="el" href="classplayer.html#a8cc6464ca3284140c92c6983ee62a299">player</a></li> +<li>setup_round() : <a class="el" href="classdeck.html#a77851e5cb8297849e91a885ed7959de1">deck</a>, <a class="el" href="classgame__state.html#ab520d4076c53f70a68bc19f355243a4d">game_state</a>, <a class="el" href="classplayer.html#a8cc6464ca3284140c92c6983ee62a299">player</a></li> +<li>start_game() : <a class="el" href="classgame__state.html#a6ca6536eaec3404ff9b1ab39b8df4e67">game_state</a></li> </ul> @@ -164,16 +191,22 @@ $(function(){ initResizable(false); }); </ul> +<h3><a id="index_u" name="index_u"></a>- u -</h3><ul> +<li>update_current_player() : <a class="el" href="classgame__state.html#a49851709fcec061d36478ed2fdcc3d9d">game_state</a></li> +</ul> + + <h3><a id="index_w" name="index_w"></a>- w -</h3><ul> -<li>wrap_up_round() : <a class="el" href="classplayer.html#a193bcc63da13e5bc98eb46ed99381302">player</a></li> +<li>wrap_up_round() : <a class="el" href="classgame__state.html#ad2e967638043670ebae93dd6ec32e91e">game_state</a>, <a class="el" href="classplayer.html#a193bcc63da13e5bc98eb46ed99381302">player</a></li> <li>wrap_up_trick() : <a class="el" href="classtrick.html#a384560623ffaf776797948cf35197c73">trick</a></li> -<li>write_into_json() : <a class="el" href="classcard.html#a7f900b843e44fb18364f32dbe6cdbc7a">card</a>, <a class="el" href="classdeck.html#a8d226fe699a36bf462010ba1f744fbeb">deck</a>, <a class="el" href="classhand.html#a505a82447d0ae305dadcc9c4aa54071e">hand</a>, <a class="el" href="classplayer.html#a0cf13abfdb6b837faa88eda064bf51dc">player</a>, <a class="el" href="classtrick.html#a97176df194eae794691356cd83292b04">trick</a></li> +<li>write_into_json() : <a class="el" href="classcard.html#a7f900b843e44fb18364f32dbe6cdbc7a">card</a>, <a class="el" href="classdeck.html#a8d226fe699a36bf462010ba1f744fbeb">deck</a>, <a class="el" href="classgame__state.html#a54873cd18b46555915d150a6d8dd6f83">game_state</a>, <a class="el" href="classhand.html#a505a82447d0ae305dadcc9c4aa54071e">hand</a>, <a class="el" href="classplayer.html#a0cf13abfdb6b837faa88eda064bf51dc">player</a>, <a class="el" href="classtrick.html#a97176df194eae794691356cd83292b04">trick</a></li> </ul> <h3><a id="index__7E" name="index__7E"></a>- ~ -</h3><ul> <li>~card() : <a class="el" href="classcard.html#ac7a5d8d53e8cc33f5c5a03d8ccb806c4">card</a></li> <li>~deck() : <a class="el" href="classdeck.html#a63a688bda08bfef8d2c37d53523b7b12">deck</a></li> +<li>~game_state() : <a class="el" href="classgame__state.html#a2fbc370f93617298719f61514afdb5bc">game_state</a></li> <li>~hand() : <a class="el" href="classhand.html#af3ffc5e5b46f04b14f12a9fc130b220a">hand</a></li> <li>~player() : <a class="el" href="classplayer.html#a0a62c0208584465db2daa1ac6e15b1ad">player</a></li> <li>~trick() : <a class="el" href="classtrick.html#a22c0b586f1d6c3baeb7bb0e22eb7dfe2">trick</a></li> diff --git a/html/functions_func.html b/html/functions_func.html index 5928e9a..6c33cf9 100644 --- a/html/functions_func.html +++ b/html/functions_func.html @@ -89,6 +89,7 @@ $(function(){ initResizable(false); }); <h3><a id="index_a" name="index_a"></a>- a -</h3><ul> <li>add_card() : <a class="el" href="classhand.html#ad4749893f36ff1d6dcda3bb18eaedffb">hand</a>, <a class="el" href="classplayer.html#ab3b087d03dd2c81d893b2ffad459a26f">player</a>, <a class="el" href="classtrick.html#a2d3b5aa88a1469dc3d58f30885752f5d">trick</a></li> +<li>add_player() : <a class="el" href="classgame__state.html#a4a4fde0700a05c589a6b9c4dbcffac18">game_state</a></li> </ul> @@ -104,25 +105,42 @@ $(function(){ initResizable(false); }); </ul> +<h3><a id="index_e" name="index_e"></a>- e -</h3><ul> +<li>estimate_tricks() : <a class="el" href="classgame__state.html#ac4ebff625d83c633c124890537d60354">game_state</a></li> +</ul> + + <h3><a id="index_f" name="index_f"></a>- f -</h3><ul> -<li>from_json() : <a class="el" href="classcard.html#a48593187c9bff442d61f197991954011">card</a>, <a class="el" href="classdeck.html#abe8dbe828189696c22f35ac3ed4fd296">deck</a>, <a class="el" href="classhand.html#aa9cffdf932d80c7304a335074403e785">hand</a>, <a class="el" href="classplayer.html#a5955c5f26db6a08862ccfb443fbe99c5">player</a>, <a class="el" href="classtrick.html#a1a3d94f638672d3d60d596190ae59dfb">trick</a></li> +<li>finish_game() : <a class="el" href="classgame__state.html#a67fdd4b5682715cd2d848031a9911b17">game_state</a></li> +<li>from_json() : <a class="el" href="classcard.html#a48593187c9bff442d61f197991954011">card</a>, <a class="el" href="classdeck.html#abe8dbe828189696c22f35ac3ed4fd296">deck</a>, <a class="el" href="classgame__state.html#a794d484961c92b5b737586ec5599963f">game_state</a>, <a class="el" href="classhand.html#aa9cffdf932d80c7304a335074403e785">hand</a>, <a class="el" href="classplayer.html#a5955c5f26db6a08862ccfb443fbe99c5">player</a>, <a class="el" href="classtrick.html#a1a3d94f638672d3d60d596190ae59dfb">trick</a></li> </ul> <h3><a id="index_g" name="index_g"></a>- g -</h3><ul> +<li>game_state() : <a class="el" href="classgame__state.html#a0c10b830e222d726557c3c33685c595a">game_state</a></li> <li>get_cards() : <a class="el" href="classhand.html#ad104b0376b1a13d987f349dd524ca47f">hand</a></li> <li>get_cards_and_players() : <a class="el" href="classtrick.html#a1d75f9e8fc94fd122adfc39a20089268">trick</a></li> <li>get_color() : <a class="el" href="classcard.html#ab033bc0e71b09d3cf3ac28c2f1fbde18">card</a></li> +<li>get_current_player() : <a class="el" href="classgame__state.html#a2d16f420a8aa651685461a5efb8bb600">game_state</a></li> <li>get_game_id() : <a class="el" href="classplayer.html#afeb6c5483a59042fcc4a3a2aed6a6a2c">player</a></li> <li>get_hand() : <a class="el" href="classplayer.html#af333dcbf7123726c9bda3ab94ba9ee6d">player</a></li> +<li>get_last_trick() : <a class="el" href="classgame__state.html#a4327f753f1f5341f9fe3774ea3fbc99b">game_state</a></li> +<li>get_max_round_number() : <a class="el" href="classgame__state.html#aa75c4da6c0056e48e5040be8127d7473">game_state</a></li> <li>get_nof_cards() : <a class="el" href="classhand.html#adc90d109b7b564a0dbca0b0798c99641">hand</a>, <a class="el" href="classplayer.html#a457c5ab90b0ecd610eead66b41c8333a">player</a></li> <li>get_nof_predicted() : <a class="el" href="classplayer.html#a40333c302ff51707749c544930fb80aa">player</a></li> <li>get_nof_tricks() : <a class="el" href="classplayer.html#a5e3d1374aee685b08a29d0ac7cec3df4">player</a></li> <li>get_number_of_remaining_cards() : <a class="el" href="classdeck.html#ae1c7a4174108a14cb1180de1afdcb6d6">deck</a></li> <li>get_player_name() : <a class="el" href="classplayer.html#a42d01dcf4cdbd452fc5dcaf5e6f21773">player</a></li> +<li>get_players() : <a class="el" href="classgame__state.html#abcaccd551f938f961d12266e34c037d2">game_state</a></li> +<li>get_round_number() : <a class="el" href="classgame__state.html#ab3ef836a1b3a1e2bc9e429a018c72eca">game_state</a></li> <li>get_scores() : <a class="el" href="classplayer.html#aef5c25a02a2fdbdb4d8270582faf5dac">player</a></li> +<li>get_starting_player() : <a class="el" href="classgame__state.html#af4c553229260e307ff1f78dd0c74506d">game_state</a></li> +<li>get_trick() : <a class="el" href="classgame__state.html#a472fd1721c7cc9e3689394f18c767bf9">game_state</a></li> <li>get_trick_color() : <a class="el" href="classtrick.html#a41f315804ac73454c8e41438da20a9c3">trick</a></li> -<li>get_trump_color() : <a class="el" href="classtrick.html#a69c49e2968abb235a6c7148cb05b0e64">trick</a></li> +<li>get_trick_estimate_sum() : <a class="el" href="classgame__state.html#aa5263d03c85bce1e9d252e9017cbe282">game_state</a></li> +<li>get_trick_number() : <a class="el" href="classgame__state.html#a3fce12f31ad0aab82b0d2da90e3e8e15">game_state</a></li> +<li>get_trick_starting_player() : <a class="el" href="classgame__state.html#aa40554d105939c5dce934daaa858c242">game_state</a></li> +<li>get_trump_color() : <a class="el" href="classgame__state.html#abdf6c5116ed643773d676c90a05e6fe4">game_state</a>, <a class="el" href="classtrick.html#a69c49e2968abb235a6c7148cb05b0e64">trick</a></li> <li>get_value() : <a class="el" href="classcard.html#a2baf8dfef09ac8c1a67b34c2e67186c3">card</a></li> </ul> @@ -134,16 +152,23 @@ $(function(){ initResizable(false); }); <h3><a id="index_i" name="index_i"></a>- i -</h3><ul> <li>is_empty() : <a class="el" href="classdeck.html#a6aef528ff7b9c608863cc77c19b7882d">deck</a></li> +<li>is_estimation_phase() : <a class="el" href="classgame__state.html#a88d19342ee76acc4660b3e56e8c126eb">game_state</a></li> +<li>is_finished() : <a class="el" href="classgame__state.html#a9b83de8a89e3bb506184492d22c3cf45">game_state</a></li> +<li>is_full() : <a class="el" href="classgame__state.html#ae161c283e275a57d71834754d11e9e40">game_state</a></li> +<li>is_player_in_game() : <a class="el" href="classgame__state.html#a371d6a6d84395b90c15d84549b05d553">game_state</a></li> +<li>is_started() : <a class="el" href="classgame__state.html#aa0092c41779f38eba5e921e43b38559c">game_state</a></li> </ul> <h3><a id="index_p" name="index_p"></a>- p -</h3><ul> +<li>play_card() : <a class="el" href="classgame__state.html#a6c65d95086a88b8d111de5553e1210ec">game_state</a></li> <li>player() : <a class="el" href="classplayer.html#a1f0916939a8caa2e7140d5c89a6aa718">player</a></li> </ul> <h3><a id="index_r" name="index_r"></a>- r -</h3><ul> <li>remove_card() : <a class="el" href="classhand.html#aa466496b7ce0b58dbd63620535430439">hand</a></li> +<li>remove_player() : <a class="el" href="classgame__state.html#a734fc594d457aa4e6db5bc7467e6442d">game_state</a></li> </ul> @@ -152,9 +177,11 @@ $(function(){ initResizable(false); }); <li>set_nof_predicted() : <a class="el" href="classplayer.html#a1a3ce0ac69cad799641f4d732435c3f7">player</a></li> <li>set_nof_tricks() : <a class="el" href="classplayer.html#a61aa38ceff0c856b36642c4bc0081433">player</a></li> <li>set_scores() : <a class="el" href="classplayer.html#af1d7e67eee27af87c01e43508a731bd4">player</a></li> +<li>set_trick() : <a class="el" href="classgame__state.html#a745dd23945b6165470c494b036ac4667">game_state</a></li> <li>set_trick_color() : <a class="el" href="classtrick.html#a0f8c45882691509564ec42efed0d1aaa">trick</a></li> <li>set_up_round() : <a class="el" href="classtrick.html#ae5b769ed0fc2933c1a44b5e481c18b00">trick</a></li> -<li>setup_round() : <a class="el" href="classdeck.html#a77851e5cb8297849e91a885ed7959de1">deck</a>, <a class="el" href="classplayer.html#a8cc6464ca3284140c92c6983ee62a299">player</a></li> +<li>setup_round() : <a class="el" href="classdeck.html#a77851e5cb8297849e91a885ed7959de1">deck</a>, <a class="el" href="classgame__state.html#ab520d4076c53f70a68bc19f355243a4d">game_state</a>, <a class="el" href="classplayer.html#a8cc6464ca3284140c92c6983ee62a299">player</a></li> +<li>start_game() : <a class="el" href="classgame__state.html#a6ca6536eaec3404ff9b1ab39b8df4e67">game_state</a></li> </ul> @@ -164,16 +191,22 @@ $(function(){ initResizable(false); }); </ul> +<h3><a id="index_u" name="index_u"></a>- u -</h3><ul> +<li>update_current_player() : <a class="el" href="classgame__state.html#a49851709fcec061d36478ed2fdcc3d9d">game_state</a></li> +</ul> + + <h3><a id="index_w" name="index_w"></a>- w -</h3><ul> -<li>wrap_up_round() : <a class="el" href="classplayer.html#a193bcc63da13e5bc98eb46ed99381302">player</a></li> +<li>wrap_up_round() : <a class="el" href="classgame__state.html#ad2e967638043670ebae93dd6ec32e91e">game_state</a>, <a class="el" href="classplayer.html#a193bcc63da13e5bc98eb46ed99381302">player</a></li> <li>wrap_up_trick() : <a class="el" href="classtrick.html#a384560623ffaf776797948cf35197c73">trick</a></li> -<li>write_into_json() : <a class="el" href="classcard.html#a7f900b843e44fb18364f32dbe6cdbc7a">card</a>, <a class="el" href="classdeck.html#a8d226fe699a36bf462010ba1f744fbeb">deck</a>, <a class="el" href="classhand.html#a505a82447d0ae305dadcc9c4aa54071e">hand</a>, <a class="el" href="classplayer.html#a0cf13abfdb6b837faa88eda064bf51dc">player</a>, <a class="el" href="classtrick.html#a97176df194eae794691356cd83292b04">trick</a></li> +<li>write_into_json() : <a class="el" href="classcard.html#a7f900b843e44fb18364f32dbe6cdbc7a">card</a>, <a class="el" href="classdeck.html#a8d226fe699a36bf462010ba1f744fbeb">deck</a>, <a class="el" href="classgame__state.html#a54873cd18b46555915d150a6d8dd6f83">game_state</a>, <a class="el" href="classhand.html#a505a82447d0ae305dadcc9c4aa54071e">hand</a>, <a class="el" href="classplayer.html#a0cf13abfdb6b837faa88eda064bf51dc">player</a>, <a class="el" href="classtrick.html#a97176df194eae794691356cd83292b04">trick</a></li> </ul> <h3><a id="index__7E" name="index__7E"></a>- ~ -</h3><ul> <li>~card() : <a class="el" href="classcard.html#ac7a5d8d53e8cc33f5c5a03d8ccb806c4">card</a></li> <li>~deck() : <a class="el" href="classdeck.html#a63a688bda08bfef8d2c37d53523b7b12">deck</a></li> +<li>~game_state() : <a class="el" href="classgame__state.html#a2fbc370f93617298719f61514afdb5bc">game_state</a></li> <li>~hand() : <a class="el" href="classhand.html#af3ffc5e5b46f04b14f12a9fc130b220a">hand</a></li> <li>~player() : <a class="el" href="classplayer.html#a0a62c0208584465db2daa1ac6e15b1ad">player</a></li> <li>~trick() : <a class="el" href="classtrick.html#a22c0b586f1d6c3baeb7bb0e22eb7dfe2">trick</a></li> diff --git a/html/game__instance_8h_source.html b/html/game__instance_8h_source.html index 384cd65..aab81c2 100644 --- a/html/game__instance_8h_source.html +++ b/html/game__instance_8h_source.html @@ -145,7 +145,7 @@ $(function(){ initResizable(false); }); <div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span><span class="preprocessor">#endif </span><span class="comment">//WIZARD_GAME_H</span></div> <div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> </div> <div class="ttc" id="aclassgame__instance_html"><div class="ttname"><a href="classgame__instance.html">game_instance</a></div><div class="ttdef"><b>Definition</b> game_instance.h:17</div></div> -<div class="ttc" id="aclassgame__state_html"><div class="ttname"><a href="classgame__state.html">game_state</a></div><div class="ttdef"><b>Definition</b> game_state.h:18</div></div> +<div class="ttc" id="aclassgame__state_html"><div class="ttname"><a href="classgame__state.html">game_state</a></div><div class="ttdoc">Represents the state of the game.</div><div class="ttdef"><b>Definition</b> game_state.h:27</div></div> <div class="ttc" id="aclassplayer_html"><div class="ttname"><a href="classplayer.html">player</a></div><div class="ttdoc">Represents a player in the game.</div><div class="ttdef"><b>Definition</b> player.h:18</div></div> </div><!-- fragment --></div><!-- contents --> <!-- start footer part --> diff --git a/html/game__state_8h_source.html b/html/game__state_8h_source.html index dfb478c..2a10b41 100644 --- a/html/game__state_8h_source.html +++ b/html/game__state_8h_source.html @@ -92,129 +92,181 @@ $(function(){ initResizable(false); }); <div class="headertitle"><div class="title">game_state.h</div></div> </div><!--header--> <div class="contents"> -<div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span><span class="comment">// all in this block is only included if wizard_game_state_h hasnt already been included to prevent to include twice</span></div> -<div class="line"><a id="l00002" name="l00002"></a><span class="lineno"> 2</span><span class="preprocessor">#ifndef WIZARD_GAME_STATE_H</span></div> -<div class="line"><a id="l00003" name="l00003"></a><span class="lineno"> 3</span><span class="preprocessor">#define WIZARD_GAME_STATE_H</span></div> -<div class="line"><a id="l00004" name="l00004"></a><span class="lineno"> 4</span> </div> -<div class="line"><a id="l00005" name="l00005"></a><span class="lineno"> 5</span><span class="preprocessor">#include <vector></span></div> -<div class="line"><a id="l00006" name="l00006"></a><span class="lineno"> 6</span><span class="preprocessor">#include <algorithm></span></div> -<div class="line"><a id="l00007" name="l00007"></a><span class="lineno"> 7</span><span class="preprocessor">#include <ranges></span></div> -<div class="line"><a id="l00008" name="l00008"></a><span class="lineno"> 8</span><span class="preprocessor">#include <string></span></div> -<div class="line"><a id="l00009" name="l00009"></a><span class="lineno"> 9</span><span class="preprocessor">#include "../../rapidjson/include/rapidjson/document.h"</span></div> -<div class="line"><a id="l00010" name="l00010"></a><span class="lineno"> 10</span><span class="preprocessor">#include "player/player.h"</span></div> -<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span><span class="preprocessor">#include "cards/deck.h"</span></div> -<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span><span class="preprocessor">#include "cards/card.h"</span></div> -<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span><span class="preprocessor">#include "cards/trick.h"</span></div> -<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span><span class="preprocessor">#include "../serialization/serializable.h"</span></div> -<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span><span class="preprocessor">#include "../serialization/serializable_value.h"</span></div> -<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span><span class="preprocessor">#include "../serialization/unique_serializable.h"</span></div> -<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span> </div> -<div class="foldopen" id="foldopen00018" data-start="{" data-end="};"> -<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"><a class="line" href="classgame__state.html"> 18</a></span><span class="keyword">class </span><a class="code hl_class" href="classgame__state.html">game_state</a> : <span class="keyword">public</span> <a class="code hl_class" href="classunique__serializable.html">unique_serializable</a> {</div> -<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span><span class="keyword">private</span>:</div> -<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span> </div> -<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> _max_nof_players = 6;</div> -<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> _min_nof_players = 3;</div> -<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> </div> -<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> std::vector<player*> _players;</div> -<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> <a class="code hl_class" href="classdeck.html">deck</a>* _deck;</div> -<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> <a class="code hl_class" href="classtrick.html">trick</a>* _trick; <span class="comment">// only save current trick, won tricks are saved with the players</span></div> -<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> </div> -<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<bool></a>* _is_started;</div> -<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<bool></a>* _is_finished;</div> -<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<bool></a>* _is_estimation_phase;</div> -<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> <span class="comment">//TODO: possibly add boolean _determine_trump_color that can be used to tell player to decide on a trump color</span></div> +<div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span><span class="preprocessor">#ifndef WIZARD_GAME_STATE_H</span></div> +<div class="line"><a id="l00002" name="l00002"></a><span class="lineno"> 2</span><span class="preprocessor">#define WIZARD_GAME_STATE_H</span></div> +<div class="line"><a id="l00003" name="l00003"></a><span class="lineno"> 3</span> </div> +<div class="line"><a id="l00004" name="l00004"></a><span class="lineno"> 4</span><span class="preprocessor">#include <vector></span></div> +<div class="line"><a id="l00005" name="l00005"></a><span class="lineno"> 5</span><span class="preprocessor">#include <ranges></span></div> +<div class="line"><a id="l00006" name="l00006"></a><span class="lineno"> 6</span><span class="preprocessor">#include "../../rapidjson/include/rapidjson/document.h"</span></div> +<div class="line"><a id="l00007" name="l00007"></a><span class="lineno"> 7</span><span class="preprocessor">#include "player/player.h"</span></div> +<div class="line"><a id="l00008" name="l00008"></a><span class="lineno"> 8</span><span class="preprocessor">#include "cards/deck.h"</span></div> +<div class="line"><a id="l00009" name="l00009"></a><span class="lineno"> 9</span><span class="preprocessor">#include "cards/card.h"</span></div> +<div class="line"><a id="l00010" name="l00010"></a><span class="lineno"> 10</span><span class="preprocessor">#include "cards/trick.h"</span></div> +<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span><span class="preprocessor">#include "../serialization/serializable_value.h"</span></div> +<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span><span class="preprocessor">#include "../serialization/unique_serializable.h"</span></div> +<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span> </div> +<div class="foldopen" id="foldopen00027" data-start="{" data-end="};"> +<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"><a class="line" href="classgame__state.html"> 27</a></span><span class="keyword">class </span><a class="code hl_class" href="classgame__state.html">game_state</a> : <span class="keyword">public</span> <a class="code hl_class" href="classunique__serializable.html">unique_serializable</a> {</div> +<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span><span class="keyword">private</span>:</div> +<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> </div> +<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> <span class="keyword">static</span> <span class="keyword">constexpr</span> <span class="keywordtype">int</span> _max_nof_players = 6; </div> +<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> <span class="keyword">static</span> <span class="keyword">constexpr</span> <span class="keywordtype">int</span> _min_nof_players = 3; </div> <div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> </div> -<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<int></a>* _round_number;</div> -<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<int></a>* _trick_number;</div> -<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<int></a>* _starting_player_idx;</div> -<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<int></a>* _trick_starting_player_idx;</div> -<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<int></a>* _current_player_idx;</div> -<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<int></a>* _trump_color;</div> -<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<int></a>* _trick_estimate_sum;</div> -<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> </div> -<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> </div> -<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> <span class="comment">// from_diff constructor, new game is constructed</span></div> -<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> <span class="keyword">explicit</span> <a class="code hl_class" href="classgame__state.html">game_state</a>(std::string <span class="keywordtype">id</span>);</div> -<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> </div> -<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> <span class="comment">// deserialization constructor</span></div> -<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> <a class="code hl_class" href="classgame__state.html">game_state</a>(</div> -<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> std::string <span class="keywordtype">id</span>,</div> -<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> std::vector<player*>& players,</div> -<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> <a class="code hl_class" href="classdeck.html">deck</a>* <a class="code hl_class" href="classdeck.html">deck</a>,</div> -<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> <a class="code hl_class" href="classtrick.html">trick</a>* <a class="code hl_class" href="classtrick.html">trick</a>,</div> -<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> </div> -<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<bool></a>* is_started,</div> -<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<bool></a>* is_finished,</div> -<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<bool></a>* is_estimation_phase,</div> -<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> </div> -<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<int></a>* round_number,</div> -<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<int></a>* trick_number,</div> -<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<int></a>* starting_player_idx,</div> -<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<int></a>* trick_starting_player_idx,</div> -<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<int></a>* current_player_idx,</div> -<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<int></a>* trump_color,</div> -<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<int></a>* trick_estimate_sum</div> -<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> );</div> -<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> </div> -<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> <span class="comment">// returns the index of 'player' in the '_players' vector</span></div> -<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> <span class="keywordtype">int</span> get_player_index(<a class="code hl_class" href="classplayer.html">player</a>* <a class="code hl_class" href="classplayer.html">player</a>) <span class="keyword">const</span>;</div> -<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> <span class="comment">// TODO: these two functions are in the server part in cpp, where do they belong?</span></div> -<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> <span class="keywordtype">int</span> get_number_of_turns();</div> -<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> <span class="keywordtype">void</span> determine_trump_color();</div> -<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> </div> -<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span><span class="keyword">public</span>:</div> -<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> <a class="code hl_class" href="classgame__state.html">game_state</a>();</div> -<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> <a class="code hl_class" href="classgame__state.html">~game_state</a>() <span class="keyword">override</span>;</div> -<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> </div> -<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span><span class="comment">// accessors</span></div> -<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> <span class="keywordtype">bool</span> is_full() <span class="keyword">const</span>;</div> -<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> <span class="keywordtype">bool</span> is_started() <span class="keyword">const</span>;</div> -<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> <span class="keywordtype">bool</span> is_finished() <span class="keyword">const</span>;</div> -<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> <span class="keywordtype">bool</span> is_estimation_phase() <span class="keyword">const</span>;</div> -<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> <span class="keywordtype">bool</span> is_player_in_game(<a class="code hl_class" href="classplayer.html">player</a>* <a class="code hl_class" href="classplayer.html">player</a>) <span class="keyword">const</span>;</div> -<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> <span class="keywordtype">int</span> get_round_number() <span class="keyword">const</span>;</div> -<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> <span class="keywordtype">int</span> get_trick_number() <span class="keyword">const</span>;</div> -<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span> <span class="keywordtype">int</span> get_trick_estimate_sum() <span class="keyword">const</span>;</div> -<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span> <span class="keywordtype">int</span> get_max_round_number() <span class="keyword">const</span>;</div> -<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span> <span class="keywordtype">int</span> get_trump_color() <span class="keyword">const</span>;</div> -<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span> <a class="code hl_class" href="classplayer.html">player</a>* get_current_player() <span class="keyword">const</span>;</div> -<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"> 87</span> <a class="code hl_class" href="classplayer.html">player</a>* get_trick_starting_player() <span class="keyword">const</span>;</div> -<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> <a class="code hl_class" href="classplayer.html">player</a>* get_starting_player() <span class="keyword">const</span>;</div> -<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> <a class="code hl_class" href="classtrick.html">trick</a>* get_trick() <span class="keyword">const</span>;</div> -<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> std::vector<player*>& get_players();</div> -<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> </div> -<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> </div> -<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span><span class="comment">// all in block behind ifdef is only included if wizard server is defined</span></div> -<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span><span class="comment">// TODO: remove // before ifdef and endif below (if it is still there otherwise ignore this)</span></div> -<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span><span class="preprocessor">#ifdef WIZARD_SERVER</span></div> -<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span><span class="comment">// server-side state update functions</span></div> -<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span> <span class="keywordtype">bool</span> remove_player(<a class="code hl_class" href="classplayer.html">player</a>* <a class="code hl_class" href="classplayer.html">player</a>, std::string& err);</div> -<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span> <span class="keywordtype">bool</span> add_player(<a class="code hl_class" href="classplayer.html">player</a>* <a class="code hl_class" href="classplayer.html">player</a>, std::string& err);</div> -<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span> <span class="keywordtype">bool</span> start_game(std::string& err);</div> -<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span> <span class="keywordtype">bool</span> finish_game(std::string& err);</div> -<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span> </div> -<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span> <span class="keywordtype">void</span> setup_round(std::string& err); <span class="comment">// server side initialization</span></div> -<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span> <span class="keywordtype">void</span> wrap_up_round(std::string& err);</div> -<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span> <span class="keywordtype">bool</span> estimate_tricks(<a class="code hl_class" href="classplayer.html">player</a> *<a class="code hl_class" href="classplayer.html">player</a>, std::string &err, <span class="keywordtype">int</span> trick_estimate);</div> -<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span> <span class="keywordtype">bool</span> can_be_played(<a class="code hl_class" href="classplayer.html">player</a>* <a class="code hl_class" href="classplayer.html">player</a>, <span class="keyword">const</span> <a class="code hl_class" href="classcard.html">card</a>* <a class="code hl_class" href="classcard.html">card</a>, std::string& err) <span class="keyword">const</span> <span class="keyword">noexcept</span>;</div> -<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> <span class="keywordtype">bool</span> play_card(<a class="code hl_class" href="classplayer.html">player</a>* <a class="code hl_class" href="classplayer.html">player</a>, <span class="keyword">const</span> std::string& card_id, std::string& err);</div> -<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span> <span class="keywordtype">bool</span> update_current_player(std::string& err);</div> -<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"> 108</span> </div> -<div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span><span class="preprocessor">#endif</span></div> -<div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span> </div> -<div class="line"><a id="l00111" name="l00111"></a><span class="lineno"> 111</span><span class="comment">// serializable interface</span></div> -<div class="line"><a id="l00112" name="l00112"></a><span class="lineno"> 112</span> <span class="keywordtype">void</span> write_into_json(rapidjson::Value& json, rapidjson::Document::AllocatorType& allocator) <span class="keyword">const override</span>;</div> -<div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span> <span class="keyword">static</span> <a class="code hl_class" href="classgame__state.html">game_state</a>* from_json(<span class="keyword">const</span> rapidjson::Value& json);</div> -<div class="line"><a id="l00114" name="l00114"></a><span class="lineno"> 114</span> </div> -<div class="line"><a id="l00115" name="l00115"></a><span class="lineno"> 115</span>};</div> +<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> std::vector<player*> _players; </div> +<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> <a class="code hl_class" href="classdeck.html">deck</a>* _deck; </div> +<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> <a class="code hl_class" href="classtrick.html">trick</a>* _trick; </div> +<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> <a class="code hl_class" href="classtrick.html">trick</a>* _last_trick; </div> +<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> </div> +<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<bool></a>* _is_started; </div> +<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<bool></a>* _is_finished; </div> +<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<bool></a>* _is_estimation_phase; </div> +<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> <span class="comment">//TODO: add boolean _determine_trump_color that can be used to tell player to decide on a trump color</span></div> +<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> </div> +<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<int></a>* _round_number; </div> +<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<int></a>* _trick_number; </div> +<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<int></a>* _starting_player_idx; </div> +<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<int></a>* _trick_starting_player_idx; </div> +<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<int></a>* _current_player_idx; </div> +<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<int></a>* _trump_color; </div> +<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<int></a>* _trick_estimate_sum; </div> +<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> </div> +<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span><span class="comment">// constructors</span></div> +<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> <span class="keyword">explicit</span> <a class="code hl_function" href="classgame__state.html#a0c10b830e222d726557c3c33685c595a">game_state</a>(<span class="keyword">const</span> std::string& <span class="keywordtype">id</span>);</div> +<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> </div> +<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> <a class="code hl_function" href="classgame__state.html#a0c10b830e222d726557c3c33685c595a">game_state</a>(</div> +<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> <span class="keyword">const</span> std::string& <span class="keywordtype">id</span>,</div> +<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> <span class="keyword">const</span> std::vector<player*>& players,</div> +<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> <a class="code hl_class" href="classdeck.html">deck</a>* <a class="code hl_class" href="classdeck.html">deck</a>,</div> +<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> <a class="code hl_class" href="classtrick.html">trick</a>* current_trick,</div> +<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> <a class="code hl_class" href="classtrick.html">trick</a>* last_trick,</div> +<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> </div> +<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<bool></a>* <a class="code hl_function" href="classgame__state.html#aa0092c41779f38eba5e921e43b38559c">is_started</a>,</div> +<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<bool></a>* <a class="code hl_function" href="classgame__state.html#a9b83de8a89e3bb506184492d22c3cf45">is_finished</a>,</div> +<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<bool></a>* <a class="code hl_function" href="classgame__state.html#a88d19342ee76acc4660b3e56e8c126eb">is_estimation_phase</a>,</div> +<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span> </div> +<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"> 87</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<int></a>* round_number,</div> +<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<int></a>* trick_number,</div> +<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<int></a>* starting_player_idx,</div> +<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<int></a>* trick_starting_player_idx,</div> +<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<int></a>* current_player_idx,</div> +<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<int></a>* trump_color,</div> +<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<int></a>* trick_estimate_sum</div> +<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> );</div> +<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span> </div> +<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span><span class="preprocessor">#ifdef WIZARD_SERVER</span></div> +<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span><span class="comment">// private functions (only used by game_state member functions)</span></div> +<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span> <span class="keywordtype">int</span> get_player_index(<a class="code hl_class" href="classplayer.html">player</a>* <a class="code hl_class" href="classplayer.html">player</a>) <span class="keyword">const</span>;</div> +<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span> </div> +<div class="line"><a id="l00114" name="l00114"></a><span class="lineno"> 114</span> [[nodiscard]] <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> get_number_of_turns() <span class="keyword">const</span>;</div> +<div class="line"><a id="l00115" name="l00115"></a><span class="lineno"> 115</span> </div> +<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"> 124</span> <span class="keywordtype">void</span> determine_trump_color() <span class="keyword">const</span>;</div> +<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span> </div> +<div class="line"><a id="l00142" name="l00142"></a><span class="lineno"> 142</span> <span class="keywordtype">bool</span> can_be_played(<a class="code hl_class" href="classplayer.html">player</a>* <a class="code hl_class" href="classplayer.html">player</a>, <span class="keyword">const</span> <a class="code hl_class" href="classcard.html">card</a>* <a class="code hl_class" href="classcard.html">card</a>, std::string& err) <span class="keyword">const</span> <span class="keyword">noexcept</span>;</div> +<div class="line"><a id="l00143" name="l00143"></a><span class="lineno"> 143</span><span class="preprocessor">#endif</span></div> +<div class="line"><a id="l00144" name="l00144"></a><span class="lineno"> 144</span> </div> +<div class="line"><a id="l00145" name="l00145"></a><span class="lineno"> 145</span><span class="keyword">public</span>:</div> +<div class="line"><a id="l00149" name="l00149"></a><span class="lineno"> 149</span> <a class="code hl_function" href="classgame__state.html#a0c10b830e222d726557c3c33685c595a">game_state</a>();</div> +<div class="line"><a id="l00150" name="l00150"></a><span class="lineno"> 150</span> </div> +<div class="line"><a id="l00154" name="l00154"></a><span class="lineno"> 154</span> <a class="code hl_function" href="classgame__state.html#a2fbc370f93617298719f61514afdb5bc">~game_state</a>() <span class="keyword">override</span>;</div> +<div class="line"><a id="l00155" name="l00155"></a><span class="lineno"> 155</span> </div> +<div class="line"><a id="l00156" name="l00156"></a><span class="lineno"> 156</span><span class="comment">// accessors</span></div> +<div class="line"><a id="l00161" name="l00161"></a><span class="lineno"> 161</span> [[nodiscard]] <span class="keywordtype">bool</span> <a class="code hl_function" href="classgame__state.html#ae161c283e275a57d71834754d11e9e40">is_full</a>() <span class="keyword">const</span>;</div> +<div class="line"><a id="l00162" name="l00162"></a><span class="lineno"> 162</span> </div> +<div class="line"><a id="l00167" name="l00167"></a><span class="lineno"> 167</span> [[nodiscard]] <span class="keywordtype">bool</span> <a class="code hl_function" href="classgame__state.html#aa0092c41779f38eba5e921e43b38559c">is_started</a>() <span class="keyword">const</span>;</div> +<div class="line"><a id="l00168" name="l00168"></a><span class="lineno"> 168</span> </div> +<div class="line"><a id="l00173" name="l00173"></a><span class="lineno"> 173</span> [[nodiscard]] <span class="keywordtype">bool</span> <a class="code hl_function" href="classgame__state.html#a9b83de8a89e3bb506184492d22c3cf45">is_finished</a>() <span class="keyword">const</span>;</div> +<div class="line"><a id="l00174" name="l00174"></a><span class="lineno"> 174</span> </div> +<div class="line"><a id="l00179" name="l00179"></a><span class="lineno"> 179</span> [[nodiscard]] <span class="keywordtype">bool</span> <a class="code hl_function" href="classgame__state.html#a88d19342ee76acc4660b3e56e8c126eb">is_estimation_phase</a>() <span class="keyword">const</span>;</div> +<div class="line"><a id="l00180" name="l00180"></a><span class="lineno"> 180</span> </div> +<div class="line"><a id="l00186" name="l00186"></a><span class="lineno"> 186</span> <span class="keywordtype">bool</span> <a class="code hl_function" href="classgame__state.html#a371d6a6d84395b90c15d84549b05d553">is_player_in_game</a>(<a class="code hl_class" href="classplayer.html">player</a>* <a class="code hl_class" href="classplayer.html">player</a>) <span class="keyword">const</span>;</div> +<div class="line"><a id="l00187" name="l00187"></a><span class="lineno"> 187</span> </div> +<div class="line"><a id="l00192" name="l00192"></a><span class="lineno"> 192</span> [[nodiscard]] <span class="keywordtype">int</span> <a class="code hl_function" href="classgame__state.html#ab3ef836a1b3a1e2bc9e429a018c72eca">get_round_number</a>() <span class="keyword">const</span>;</div> +<div class="line"><a id="l00193" name="l00193"></a><span class="lineno"> 193</span> </div> +<div class="line"><a id="l00198" name="l00198"></a><span class="lineno"> 198</span> [[nodiscard]] <span class="keywordtype">int</span> <a class="code hl_function" href="classgame__state.html#a3fce12f31ad0aab82b0d2da90e3e8e15">get_trick_number</a>() <span class="keyword">const</span>;</div> +<div class="line"><a id="l00199" name="l00199"></a><span class="lineno"> 199</span> </div> +<div class="line"><a id="l00204" name="l00204"></a><span class="lineno"> 204</span> [[nodiscard]] <span class="keywordtype">int</span> <a class="code hl_function" href="classgame__state.html#aa5263d03c85bce1e9d252e9017cbe282">get_trick_estimate_sum</a>() <span class="keyword">const</span>;</div> +<div class="line"><a id="l00205" name="l00205"></a><span class="lineno"> 205</span> </div> +<div class="line"><a id="l00213" name="l00213"></a><span class="lineno"> 213</span> [[nodiscard]] <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code hl_function" href="classgame__state.html#aa75c4da6c0056e48e5040be8127d7473">get_max_round_number</a>() <span class="keyword">const</span>;</div> +<div class="line"><a id="l00214" name="l00214"></a><span class="lineno"> 214</span> </div> +<div class="line"><a id="l00219" name="l00219"></a><span class="lineno"> 219</span> [[nodiscard]] <span class="keywordtype">int</span> <a class="code hl_function" href="classgame__state.html#abdf6c5116ed643773d676c90a05e6fe4">get_trump_color</a>() <span class="keyword">const</span>;</div> +<div class="line"><a id="l00220" name="l00220"></a><span class="lineno"> 220</span> </div> +<div class="line"><a id="l00225" name="l00225"></a><span class="lineno"> 225</span> [[nodiscard]] <a class="code hl_class" href="classplayer.html">player</a>* <a class="code hl_function" href="classgame__state.html#a2d16f420a8aa651685461a5efb8bb600">get_current_player</a>() <span class="keyword">const</span>;</div> +<div class="line"><a id="l00226" name="l00226"></a><span class="lineno"> 226</span> </div> +<div class="line"><a id="l00231" name="l00231"></a><span class="lineno"> 231</span> [[nodiscard]] <a class="code hl_class" href="classplayer.html">player</a>* <a class="code hl_function" href="classgame__state.html#aa40554d105939c5dce934daaa858c242">get_trick_starting_player</a>() <span class="keyword">const</span>;</div> +<div class="line"><a id="l00232" name="l00232"></a><span class="lineno"> 232</span> </div> +<div class="line"><a id="l00237" name="l00237"></a><span class="lineno"> 237</span> [[nodiscard]] <a class="code hl_class" href="classplayer.html">player</a>* <a class="code hl_function" href="classgame__state.html#af4c553229260e307ff1f78dd0c74506d">get_starting_player</a>() <span class="keyword">const</span>;</div> +<div class="line"><a id="l00238" name="l00238"></a><span class="lineno"> 238</span> </div> +<div class="line"><a id="l00243" name="l00243"></a><span class="lineno"> 243</span> [[nodiscard]] <a class="code hl_class" href="classtrick.html">trick</a>* <a class="code hl_function" href="classgame__state.html#a472fd1721c7cc9e3689394f18c767bf9">get_trick</a>() <span class="keyword">const</span>;</div> +<div class="line"><a id="l00244" name="l00244"></a><span class="lineno"> 244</span> </div> +<div class="line"><a id="l00249" name="l00249"></a><span class="lineno"> 249</span> [[nodiscard]] <a class="code hl_class" href="classtrick.html">trick</a>* <a class="code hl_function" href="classgame__state.html#a4327f753f1f5341f9fe3774ea3fbc99b">get_last_trick</a>() <span class="keyword">const</span>;</div> +<div class="line"><a id="l00250" name="l00250"></a><span class="lineno"> 250</span> </div> +<div class="line"><a id="l00255" name="l00255"></a><span class="lineno"> 255</span> std::vector<player*>& <a class="code hl_function" href="classgame__state.html#abcaccd551f938f961d12266e34c037d2">get_players</a>();</div> +<div class="line"><a id="l00256" name="l00256"></a><span class="lineno"> 256</span> </div> +<div class="line"><a id="l00261" name="l00261"></a><span class="lineno"> 261</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classgame__state.html#a745dd23945b6165470c494b036ac4667">set_trick</a>(<a class="code hl_class" href="classtrick.html">trick</a>* new_trick);</div> +<div class="line"><a id="l00262" name="l00262"></a><span class="lineno"> 262</span> </div> +<div class="line"><a id="l00263" name="l00263"></a><span class="lineno"> 263</span><span class="preprocessor">#ifdef WIZARD_SERVER</span></div> +<div class="line"><a id="l00264" name="l00264"></a><span class="lineno"> 264</span><span class="comment">// server-side state update functions</span></div> +<div class="line"><a id="l00274" name="l00274"></a><span class="lineno"> 274</span> <span class="keywordtype">bool</span> <a class="code hl_function" href="classgame__state.html#a734fc594d457aa4e6db5bc7467e6442d">remove_player</a>(<a class="code hl_class" href="classplayer.html">player</a>* <a class="code hl_class" href="classplayer.html">player</a>, std::string& err);</div> +<div class="line"><a id="l00275" name="l00275"></a><span class="lineno"> 275</span> </div> +<div class="line"><a id="l00285" name="l00285"></a><span class="lineno"> 285</span> <span class="keywordtype">bool</span> <a class="code hl_function" href="classgame__state.html#a4a4fde0700a05c589a6b9c4dbcffac18">add_player</a>(<a class="code hl_class" href="classplayer.html">player</a>* <a class="code hl_class" href="classplayer.html">player</a>, std::string& err);</div> +<div class="line"><a id="l00286" name="l00286"></a><span class="lineno"> 286</span> </div> +<div class="line"><a id="l00295" name="l00295"></a><span class="lineno"> 295</span> <span class="keywordtype">bool</span> <a class="code hl_function" href="classgame__state.html#a6ca6536eaec3404ff9b1ab39b8df4e67">start_game</a>(std::string& err);</div> +<div class="line"><a id="l00296" name="l00296"></a><span class="lineno"> 296</span> </div> +<div class="line"><a id="l00304" name="l00304"></a><span class="lineno"> 304</span> <span class="keywordtype">bool</span> <a class="code hl_function" href="classgame__state.html#a67fdd4b5682715cd2d848031a9911b17">finish_game</a>(std::string& err) <span class="keyword">const</span>;</div> +<div class="line"><a id="l00305" name="l00305"></a><span class="lineno"> 305</span> </div> +<div class="line"><a id="l00314" name="l00314"></a><span class="lineno"> 314</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classgame__state.html#ab520d4076c53f70a68bc19f355243a4d">setup_round</a>(std::string& err);</div> +<div class="line"><a id="l00315" name="l00315"></a><span class="lineno"> 315</span> </div> +<div class="line"><a id="l00324" name="l00324"></a><span class="lineno"> 324</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classgame__state.html#ad2e967638043670ebae93dd6ec32e91e">wrap_up_round</a>(std::string& err);</div> +<div class="line"><a id="l00325" name="l00325"></a><span class="lineno"> 325</span> </div> +<div class="line"><a id="l00339" name="l00339"></a><span class="lineno"> 339</span> <span class="keywordtype">bool</span> <a class="code hl_function" href="classgame__state.html#ac4ebff625d83c633c124890537d60354">estimate_tricks</a>(<span class="keyword">const</span> <a class="code hl_class" href="classplayer.html">player</a> *<a class="code hl_class" href="classplayer.html">player</a>, std::string &err, <span class="keywordtype">int</span> trick_estimate);</div> +<div class="line"><a id="l00340" name="l00340"></a><span class="lineno"> 340</span> </div> +<div class="line"><a id="l00352" name="l00352"></a><span class="lineno"> 352</span> <span class="keywordtype">bool</span> <a class="code hl_function" href="classgame__state.html#a6c65d95086a88b8d111de5553e1210ec">play_card</a>(<a class="code hl_class" href="classplayer.html">player</a>* <a class="code hl_class" href="classplayer.html">player</a>, <span class="keyword">const</span> std::string& card_id, std::string& err);</div> +<div class="line"><a id="l00353" name="l00353"></a><span class="lineno"> 353</span> </div> +<div class="line"><a id="l00365" name="l00365"></a><span class="lineno"> 365</span> <span class="keywordtype">bool</span> <a class="code hl_function" href="classgame__state.html#a49851709fcec061d36478ed2fdcc3d9d">update_current_player</a>(std::string& err);</div> +<div class="line"><a id="l00366" name="l00366"></a><span class="lineno"> 366</span><span class="preprocessor">#endif</span></div> +<div class="line"><a id="l00367" name="l00367"></a><span class="lineno"> 367</span> </div> +<div class="line"><a id="l00368" name="l00368"></a><span class="lineno"> 368</span><span class="comment">// serializable interface</span></div> +<div class="line"><a id="l00374" name="l00374"></a><span class="lineno"> 374</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classgame__state.html#a54873cd18b46555915d150a6d8dd6f83">write_into_json</a>(rapidjson::Value& json, rapidjson::Document::AllocatorType& allocator) <span class="keyword">const override</span>;</div> +<div class="line"><a id="l00375" name="l00375"></a><span class="lineno"> 375</span> </div> +<div class="line"><a id="l00381" name="l00381"></a><span class="lineno"> 381</span> <span class="keyword">static</span> <a class="code hl_class" href="classgame__state.html">game_state</a>* <a class="code hl_function" href="classgame__state.html#a794d484961c92b5b737586ec5599963f">from_json</a>(<span class="keyword">const</span> rapidjson::Value& json);</div> +<div class="line"><a id="l00382" name="l00382"></a><span class="lineno"> 382</span> </div> +<div class="line"><a id="l00383" name="l00383"></a><span class="lineno"> 383</span>};</div> </div> -<div class="line"><a id="l00116" name="l00116"></a><span class="lineno"> 116</span> </div> -<div class="line"><a id="l00117" name="l00117"></a><span class="lineno"> 117</span> </div> -<div class="line"><a id="l00118" name="l00118"></a><span class="lineno"> 118</span><span class="preprocessor">#endif </span><span class="comment">//WIZARD_GAME_STATE_H</span></div> +<div class="line"><a id="l00384" name="l00384"></a><span class="lineno"> 384</span> </div> +<div class="line"><a id="l00385" name="l00385"></a><span class="lineno"> 385</span><span class="preprocessor">#endif </span><span class="comment">//WIZARD_GAME_STATE_H</span></div> <div class="ttc" id="aclasscard_html"><div class="ttname"><a href="classcard.html">card</a></div><div class="ttdoc">Represents a card in the game.</div><div class="ttdef"><b>Definition</b> card.h:15</div></div> <div class="ttc" id="aclassdeck_html"><div class="ttname"><a href="classdeck.html">deck</a></div><div class="ttdoc">Represents the card deck in the game.</div><div class="ttdef"><b>Definition</b> deck.h:28</div></div> -<div class="ttc" id="aclassgame__state_html"><div class="ttname"><a href="classgame__state.html">game_state</a></div><div class="ttdef"><b>Definition</b> game_state.h:18</div></div> +<div class="ttc" id="aclassgame__state_html"><div class="ttname"><a href="classgame__state.html">game_state</a></div><div class="ttdoc">Represents the state of the game.</div><div class="ttdef"><b>Definition</b> game_state.h:27</div></div> +<div class="ttc" id="aclassgame__state_html_a0c10b830e222d726557c3c33685c595a"><div class="ttname"><a href="classgame__state.html#a0c10b830e222d726557c3c33685c595a">game_state::game_state</a></div><div class="ttdeci">game_state()</div><div class="ttdoc">Constructs a new game_state object.</div><div class="ttdef"><b>Definition</b> game_state.cpp:54</div></div> +<div class="ttc" id="aclassgame__state_html_a2d16f420a8aa651685461a5efb8bb600"><div class="ttname"><a href="classgame__state.html#a2d16f420a8aa651685461a5efb8bb600">game_state::get_current_player</a></div><div class="ttdeci">player * get_current_player() const</div><div class="ttdoc">Gets the current player.</div><div class="ttdef"><b>Definition</b> game_state.cpp:112</div></div> +<div class="ttc" id="aclassgame__state_html_a2fbc370f93617298719f61514afdb5bc"><div class="ttname"><a href="classgame__state.html#a2fbc370f93617298719f61514afdb5bc">game_state::~game_state</a></div><div class="ttdeci">~game_state() override</div><div class="ttdef"><b>Definition</b> game_state.cpp:75</div></div> +<div class="ttc" id="aclassgame__state_html_a371d6a6d84395b90c15d84549b05d553"><div class="ttname"><a href="classgame__state.html#a371d6a6d84395b90c15d84549b05d553">game_state::is_player_in_game</a></div><div class="ttdeci">bool is_player_in_game(player *player) const</div><div class="ttdoc">Checks if the given player is in the game.</div><div class="ttdef"><b>Definition</b> game_state.cpp:191</div></div> +<div class="ttc" id="aclassgame__state_html_a3fce12f31ad0aab82b0d2da90e3e8e15"><div class="ttname"><a href="classgame__state.html#a3fce12f31ad0aab82b0d2da90e3e8e15">game_state::get_trick_number</a></div><div class="ttdeci">int get_trick_number() const</div><div class="ttdoc">Gets the trick number.</div><div class="ttdef"><b>Definition</b> game_state.cpp:176</div></div> +<div class="ttc" id="aclassgame__state_html_a4327f753f1f5341f9fe3774ea3fbc99b"><div class="ttname"><a href="classgame__state.html#a4327f753f1f5341f9fe3774ea3fbc99b">game_state::get_last_trick</a></div><div class="ttdeci">trick * get_last_trick() const</div><div class="ttdoc">Gets the previous trick.</div><div class="ttdef"><b>Definition</b> game_state.cpp:151</div></div> +<div class="ttc" id="aclassgame__state_html_a472fd1721c7cc9e3689394f18c767bf9"><div class="ttname"><a href="classgame__state.html#a472fd1721c7cc9e3689394f18c767bf9">game_state::get_trick</a></div><div class="ttdeci">trick * get_trick() const</div><div class="ttdoc">Gets the current trick.</div><div class="ttdef"><b>Definition</b> game_state.cpp:146</div></div> +<div class="ttc" id="aclassgame__state_html_a49851709fcec061d36478ed2fdcc3d9d"><div class="ttname"><a href="classgame__state.html#a49851709fcec061d36478ed2fdcc3d9d">game_state::update_current_player</a></div><div class="ttdeci">bool update_current_player(std::string &err)</div><div class="ttdoc">Updates the current player after estimating tricks or playing cards.</div><div class="ttdef"><b>Definition</b> game_state.cpp:308</div></div> +<div class="ttc" id="aclassgame__state_html_a4a4fde0700a05c589a6b9c4dbcffac18"><div class="ttname"><a href="classgame__state.html#a4a4fde0700a05c589a6b9c4dbcffac18">game_state::add_player</a></div><div class="ttdeci">bool add_player(player *player, std::string &err)</div><div class="ttdoc">Adds a player to the game.</div><div class="ttdef"><b>Definition</b> game_state.cpp:451</div></div> +<div class="ttc" id="aclassgame__state_html_a54873cd18b46555915d150a6d8dd6f83"><div class="ttname"><a href="classgame__state.html#a54873cd18b46555915d150a6d8dd6f83">game_state::write_into_json</a></div><div class="ttdeci">void write_into_json(rapidjson::Value &json, rapidjson::Document::AllocatorType &allocator) const override</div><div class="ttdoc">Serializes a game_state object into a json object.</div><div class="ttdef"><b>Definition</b> game_state.cpp:483</div></div> +<div class="ttc" id="aclassgame__state_html_a67fdd4b5682715cd2d848031a9911b17"><div class="ttname"><a href="classgame__state.html#a67fdd4b5682715cd2d848031a9911b17">game_state::finish_game</a></div><div class="ttdeci">bool finish_game(std::string &err) const</div><div class="ttdoc">Finishes a game.</div><div class="ttdef"><b>Definition</b> game_state.cpp:474</div></div> +<div class="ttc" id="aclassgame__state_html_a6c65d95086a88b8d111de5553e1210ec"><div class="ttname"><a href="classgame__state.html#a6c65d95086a88b8d111de5553e1210ec">game_state::play_card</a></div><div class="ttdeci">bool play_card(player *player, const std::string &card_id, std::string &err)</div><div class="ttdoc">Plays a card.</div><div class="ttdef"><b>Definition</b> game_state.cpp:409</div></div> +<div class="ttc" id="aclassgame__state_html_a6ca6536eaec3404ff9b1ab39b8df4e67"><div class="ttname"><a href="classgame__state.html#a6ca6536eaec3404ff9b1ab39b8df4e67">game_state::start_game</a></div><div class="ttdeci">bool start_game(std::string &err)</div><div class="ttdoc">Starts the game.</div><div class="ttdef"><b>Definition</b> game_state.cpp:371</div></div> +<div class="ttc" id="aclassgame__state_html_a734fc594d457aa4e6db5bc7467e6442d"><div class="ttname"><a href="classgame__state.html#a734fc594d457aa4e6db5bc7467e6442d">game_state::remove_player</a></div><div class="ttdeci">bool remove_player(player *player, std::string &err)</div><div class="ttdoc">Removes a player from the game.</div><div class="ttdef"><b>Definition</b> game_state.cpp:430</div></div> +<div class="ttc" id="aclassgame__state_html_a745dd23945b6165470c494b036ac4667"><div class="ttname"><a href="classgame__state.html#a745dd23945b6165470c494b036ac4667">game_state::set_trick</a></div><div class="ttdeci">void set_trick(trick *new_trick)</div><div class="ttdoc">Sets the trick to the given trick.</div><div class="ttdef"><b>Definition</b> game_state.cpp:201</div></div> +<div class="ttc" id="aclassgame__state_html_a794d484961c92b5b737586ec5599963f"><div class="ttname"><a href="classgame__state.html#a794d484961c92b5b737586ec5599963f">game_state::from_json</a></div><div class="ttdeci">static game_state * from_json(const rapidjson::Value &json)</div><div class="ttdoc">Deserializes a game_state object from a json object.</div><div class="ttdef"><b>Definition</b> game_state.cpp:547</div></div> +<div class="ttc" id="aclassgame__state_html_a88d19342ee76acc4660b3e56e8c126eb"><div class="ttname"><a href="classgame__state.html#a88d19342ee76acc4660b3e56e8c126eb">game_state::is_estimation_phase</a></div><div class="ttdeci">bool is_estimation_phase() const</div><div class="ttdoc">Checks if the game is in estimation phase.</div><div class="ttdef"><b>Definition</b> game_state.cpp:120</div></div> +<div class="ttc" id="aclassgame__state_html_a9b83de8a89e3bb506184492d22c3cf45"><div class="ttname"><a href="classgame__state.html#a9b83de8a89e3bb506184492d22c3cf45">game_state::is_finished</a></div><div class="ttdeci">bool is_finished() const</div><div class="ttdoc">Checks if the game is finished.</div><div class="ttdef"><b>Definition</b> game_state.cpp:166</div></div> +<div class="ttc" id="aclassgame__state_html_aa0092c41779f38eba5e921e43b38559c"><div class="ttname"><a href="classgame__state.html#aa0092c41779f38eba5e921e43b38559c">game_state::is_started</a></div><div class="ttdeci">bool is_started() const</div><div class="ttdoc">Checks if the game is started.</div><div class="ttdef"><b>Definition</b> game_state.cpp:161</div></div> +<div class="ttc" id="aclassgame__state_html_aa40554d105939c5dce934daaa858c242"><div class="ttname"><a href="classgame__state.html#aa40554d105939c5dce934daaa858c242">game_state::get_trick_starting_player</a></div><div class="ttdeci">player * get_trick_starting_player() const</div><div class="ttdoc">Gets the starting player of the current trick.</div><div class="ttdef"><b>Definition</b> game_state.cpp:130</div></div> +<div class="ttc" id="aclassgame__state_html_aa5263d03c85bce1e9d252e9017cbe282"><div class="ttname"><a href="classgame__state.html#aa5263d03c85bce1e9d252e9017cbe282">game_state::get_trick_estimate_sum</a></div><div class="ttdeci">int get_trick_estimate_sum() const</div><div class="ttdoc">Gets the trick estimate sum.</div><div class="ttdef"><b>Definition</b> game_state.cpp:181</div></div> +<div class="ttc" id="aclassgame__state_html_aa75c4da6c0056e48e5040be8127d7473"><div class="ttname"><a href="classgame__state.html#aa75c4da6c0056e48e5040be8127d7473">game_state::get_max_round_number</a></div><div class="ttdeci">unsigned int get_max_round_number() const</div><div class="ttdoc">Gets the maximum round number.</div><div class="ttdef"><b>Definition</b> game_state.cpp:186</div></div> +<div class="ttc" id="aclassgame__state_html_ab3ef836a1b3a1e2bc9e429a018c72eca"><div class="ttname"><a href="classgame__state.html#ab3ef836a1b3a1e2bc9e429a018c72eca">game_state::get_round_number</a></div><div class="ttdeci">int get_round_number() const</div><div class="ttdoc">Gets the round number.</div><div class="ttdef"><b>Definition</b> game_state.cpp:171</div></div> +<div class="ttc" id="aclassgame__state_html_ab520d4076c53f70a68bc19f355243a4d"><div class="ttname"><a href="classgame__state.html#ab520d4076c53f70a68bc19f355243a4d">game_state::setup_round</a></div><div class="ttdeci">void setup_round(std::string &err)</div><div class="ttdoc">Sets up a round.</div><div class="ttdef"><b>Definition</b> game_state.cpp:349</div></div> +<div class="ttc" id="aclassgame__state_html_abcaccd551f938f961d12266e34c037d2"><div class="ttname"><a href="classgame__state.html#abcaccd551f938f961d12266e34c037d2">game_state::get_players</a></div><div class="ttdeci">std::vector< player * > & get_players()</div><div class="ttdoc">Gets the players that joined the game.</div><div class="ttdef"><b>Definition</b> game_state.cpp:196</div></div> +<div class="ttc" id="aclassgame__state_html_abdf6c5116ed643773d676c90a05e6fe4"><div class="ttname"><a href="classgame__state.html#abdf6c5116ed643773d676c90a05e6fe4">game_state::get_trump_color</a></div><div class="ttdeci">int get_trump_color() const</div><div class="ttdoc">Gets the trump color.</div><div class="ttdef"><b>Definition</b> game_state.cpp:125</div></div> +<div class="ttc" id="aclassgame__state_html_ac4ebff625d83c633c124890537d60354"><div class="ttname"><a href="classgame__state.html#ac4ebff625d83c633c124890537d60354">game_state::estimate_tricks</a></div><div class="ttdeci">bool estimate_tricks(const player *player, std::string &err, int trick_estimate)</div><div class="ttdoc">Sets the trick estimates for a player.</div><div class="ttdef"><b>Definition</b> game_state.cpp:387</div></div> +<div class="ttc" id="aclassgame__state_html_ad2e967638043670ebae93dd6ec32e91e"><div class="ttname"><a href="classgame__state.html#ad2e967638043670ebae93dd6ec32e91e">game_state::wrap_up_round</a></div><div class="ttdeci">void wrap_up_round(std::string &err)</div><div class="ttdoc">Wraps up a round.</div><div class="ttdef"><b>Definition</b> game_state.cpp:296</div></div> +<div class="ttc" id="aclassgame__state_html_ae161c283e275a57d71834754d11e9e40"><div class="ttname"><a href="classgame__state.html#ae161c283e275a57d71834754d11e9e40">game_state::is_full</a></div><div class="ttdeci">bool is_full() const</div><div class="ttdoc">Checks if the game is full.</div><div class="ttdef"><b>Definition</b> game_state.cpp:156</div></div> +<div class="ttc" id="aclassgame__state_html_af4c553229260e307ff1f78dd0c74506d"><div class="ttname"><a href="classgame__state.html#af4c553229260e307ff1f78dd0c74506d">game_state::get_starting_player</a></div><div class="ttdeci">player * get_starting_player() const</div><div class="ttdoc">Gets the starting player of the current round.</div><div class="ttdef"><b>Definition</b> game_state.cpp:138</div></div> <div class="ttc" id="aclassplayer_html"><div class="ttname"><a href="classplayer.html">player</a></div><div class="ttdoc">Represents a player in the game.</div><div class="ttdef"><b>Definition</b> player.h:18</div></div> <div class="ttc" id="aclassserializable__value_html"><div class="ttname"><a href="classserializable__value.html">serializable_value</a></div><div class="ttdef"><b>Definition</b> serializable_value.h:27</div></div> <div class="ttc" id="aclasstrick_html"><div class="ttname"><a href="classtrick.html">trick</a></div><div class="ttdoc">Represents the trick in the game.</div><div class="ttdef"><b>Definition</b> trick.h:28</div></div> diff --git a/html/hierarchy.html b/html/hierarchy.html index a8eacbc..0418f94 100644 --- a/html/hierarchy.html +++ b/html/hierarchy.html @@ -120,7 +120,7 @@ $(function(){ initResizable(false); }); <tr id="row_11_6_" class="odd"><td class="entry"><span style="width:16px;display:inline-block;"> </span><span id="arr_11_6_" class="arrow" onclick="dynsection.toggleFolder('11_6_')">▼</span><span class="icona"><span class="icon">C</span></span><a class="el" href="classunique__serializable.html" target="_self">unique_serializable</a></td><td class="desc"></td></tr> <tr id="row_11_6_0_" class="even"><td class="entry"><span style="width:48px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="classcard.html" target="_self">card</a></td><td class="desc">Represents a card in the game </td></tr> <tr id="row_11_6_1_" class="odd"><td class="entry"><span style="width:48px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="classdeck.html" target="_self">deck</a></td><td class="desc">Represents the card deck in the game </td></tr> -<tr id="row_11_6_2_" class="even"><td class="entry"><span style="width:48px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="classgame__state.html" target="_self">game_state</a></td><td class="desc"></td></tr> +<tr id="row_11_6_2_" class="even"><td class="entry"><span style="width:48px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="classgame__state.html" target="_self">game_state</a></td><td class="desc">Represents the state of the game </td></tr> <tr id="row_11_6_3_" class="odd"><td class="entry"><span style="width:48px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="classhand.html" target="_self">hand</a></td><td class="desc">Represents a player's hand in the game </td></tr> <tr id="row_11_6_4_" class="even"><td class="entry"><span style="width:48px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="classplayer.html" target="_self">player</a></td><td class="desc">Represents a player in the game </td></tr> <tr id="row_11_6_5_" class="odd"><td class="entry"><span style="width:48px;display:inline-block;"> </span><span class="icona"><span class="icon">C</span></span><a class="el" href="classtrick.html" target="_self">trick</a></td><td class="desc">Represents the trick in the game </td></tr> diff --git a/html/index.html b/html/index.html index c1cd8ba..c8fc840 100644 --- a/html/index.html +++ b/html/index.html @@ -256,16 +256,16 @@ Client -> Server:</h3> <h3><a class="anchor" id="autotoc_md14"></a> Server -> Client:</h3> <p>All messages arriving at the server are being deserialized and then passed on to the <code>handle_request(client_request* req)</code> function of the <code><a class="el" href="classrequest__handler.html">request_handler</a></code> singleton class. This function returns a pointer to an object of type <code><a class="el" href="classrequest__response.html">request_response</a></code> (a subclass of <code><a class="el" href="classserver__response.html">server_response</a></code>), which is then automatically sent back to the requesting client. In your game implementation you should extend the <code>handle_request(client_request* req)</code> function of the <code><a class="el" href="classrequest__handler.html">request_handler</a></code>, such that it can handle the <code><a class="el" href="classclient__request.html">client_request</a></code> that you add to your game and return an object of type <code><a class="el" href="classrequest__response.html">request_response</a></code> with all parameters you want to send.</p> -<p>If the <code><a class="el" href="classclient__request.html">client_request</a></code> causes an update of the <a class="el" href="classgame__state.html">game_state</a> you should also update all other players of that game about the <a class="el" href="classgame__state.html">game_state</a> change. This happens in the <code><a class="el" href="classgame__instance.html">game_instance</a></code> class, here examplified at the case where a <code><a class="el" href="classstart__game__request.html">start_game_request</a></code> calls the <code>start_game(...)</code> function on the respective <code><a class="el" href="classgame__instance.html">game_instance</a></code> on the server side:</p> +<p>If the <code><a class="el" href="classclient__request.html">client_request</a></code> causes an update of the <a class="el" href="classgame__state.html" title="Represents the state of the game.">game_state</a> you should also update all other players of that game about the <a class="el" href="classgame__state.html" title="Represents the state of the game.">game_state</a> change. This happens in the <code><a class="el" href="classgame__instance.html">game_instance</a></code> class, here examplified at the case where a <code><a class="el" href="classstart__game__request.html">start_game_request</a></code> calls the <code>start_game(...)</code> function on the respective <code><a class="el" href="classgame__instance.html">game_instance</a></code> on the server side:</p> <div class="fragment"><div class="line"><span class="keywordtype">bool</span> game_instance::start_game(<a class="code hl_class" href="classplayer.html">player</a>* <a class="code hl_class" href="classplayer.html">player</a>, std::string &err) {</div> <div class="line"> modification_lock.lock(); <span class="comment">// make sure only one request can modify the game_state at a time</span></div> <div class="line"> </div> <div class="line"> <span class="comment">// Try to start the game</span></div> -<div class="line"> <span class="keywordflow">if</span> (_game_state->start_game(err)) { </div> +<div class="line"> <span class="keywordflow">if</span> (_game_state-><a class="code hl_function" href="classgame__state.html#a6ca6536eaec3404ff9b1ab39b8df4e67">start_game</a>(err)) { </div> <div class="line"> <span class="comment">// create a full_state_response (subclass of server_response) with the full game_state inside</span></div> <div class="line"> <a class="code hl_class" href="classfull__state__response.html">full_state_response</a> state_update_msg = <a class="code hl_class" href="classfull__state__response.html">full_state_response</a>(this->get_id(), *_game_state);</div> <div class="line"> <span class="comment">// BROADCAST new game_state to all other players</span></div> -<div class="line"> server_network_manager::broadcast_message(state_update_msg, _game_state->get_players(), <a class="code hl_class" href="classplayer.html">player</a>);</div> +<div class="line"> server_network_manager::broadcast_message(state_update_msg, _game_state-><a class="code hl_function" href="classgame__state.html#abcaccd551f938f961d12266e34c037d2">get_players</a>(), <a class="code hl_class" href="classplayer.html">player</a>);</div> <div class="line"> </div> <div class="line"> modification_lock.unlock(); <span class="comment">// allow other threads to modify the game_state</span></div> <div class="line"> <span class="keywordflow">return</span> <span class="keyword">true</span>;</div> @@ -274,6 +274,8 @@ Server -> Client:</h3> <div class="line"> <span class="keywordflow">return</span> <span class="keyword">false</span>;</div> <div class="line">}</div> <div class="ttc" id="aclassfull__state__response_html"><div class="ttname"><a href="classfull__state__response.html">full_state_response</a></div><div class="ttdef"><b>Definition</b> full_state_response.h:11</div></div> +<div class="ttc" id="aclassgame__state_html_a6ca6536eaec3404ff9b1ab39b8df4e67"><div class="ttname"><a href="classgame__state.html#a6ca6536eaec3404ff9b1ab39b8df4e67">game_state::start_game</a></div><div class="ttdeci">bool start_game(std::string &err)</div><div class="ttdoc">Starts the game.</div><div class="ttdef"><b>Definition</b> game_state.cpp:371</div></div> +<div class="ttc" id="aclassgame__state_html_abcaccd551f938f961d12266e34c037d2"><div class="ttname"><a href="classgame__state.html#abcaccd551f938f961d12266e34c037d2">game_state::get_players</a></div><div class="ttdeci">std::vector< player * > & get_players()</div><div class="ttdoc">Gets the players that joined the game.</div><div class="ttdef"><b>Definition</b> game_state.cpp:196</div></div> <div class="ttc" id="aclassplayer_html"><div class="ttname"><a href="classplayer.html">player</a></div><div class="ttdoc">Represents a player in the game.</div><div class="ttdef"><b>Definition</b> player.h:18</div></div> </div><!-- fragment --><h3><a class="anchor" id="autotoc_md15"></a> 4.2.3 Debugging Messages</h3> @@ -297,8 +299,8 @@ Server -> Client:</h3> <div class="ttc" id="aclassplayer_html_a42d01dcf4cdbd452fc5dcaf5e6f21773"><div class="ttname"><a href="classplayer.html#a42d01dcf4cdbd452fc5dcaf5e6f21773">player::get_player_name</a></div><div class="ttdeci">std::string get_player_name() const noexcept</div><div class="ttdoc">Gets the player's name.</div><div class="ttdef"><b>Definition</b> player.cpp:104</div></div> </div><!-- fragment --><h2><a class="anchor" id="autotoc_md16"></a> 4.3 Game State</h2> -<p>The <code><a class="el" href="classgame__state.html">game_state</a></code> class stores all parameters that are required to represent the game on the client (resp. server) side. In order to synchronize this <code><a class="el" href="classgame__state.html">game_state</a></code> among all players, the <code><a class="el" href="classgame__state.html">game_state</a></code> can also be <b>serialized</b> and <b>deserialized</b>. If a <code><a class="el" href="classclient__request.html">client_request</a></code> was successfully executed on the server, then the <code><a class="el" href="classrequest__response.html">request_response</a></code> that is sent back to the client contains a serialized version of the updated <code><a class="el" href="classgame__state.html">game_state</a></code>. All other players receive the updated <code><a class="el" href="classgame__state.html">game_state</a></code> at the same time through a <code><a class="el" href="classfull__state__response.html">full_state_response</a></code>.</p> -<p>To serialize the <code><a class="el" href="classgame__state.html">game_state</a></code>, the same <code>write_into_json(...)</code> function is used as for the <code><a class="el" href="classclient__request.html">client_request</a></code>.</p> +<p>The <code><a class="el" href="classgame__state.html" title="Represents the state of the game.">game_state</a></code> class stores all parameters that are required to represent the game on the client (resp. server) side. In order to synchronize this <code><a class="el" href="classgame__state.html" title="Represents the state of the game.">game_state</a></code> among all players, the <code><a class="el" href="classgame__state.html" title="Represents the state of the game.">game_state</a></code> can also be <b>serialized</b> and <b>deserialized</b>. If a <code><a class="el" href="classclient__request.html">client_request</a></code> was successfully executed on the server, then the <code><a class="el" href="classrequest__response.html">request_response</a></code> that is sent back to the client contains a serialized version of the updated <code><a class="el" href="classgame__state.html" title="Represents the state of the game.">game_state</a></code>. All other players receive the updated <code><a class="el" href="classgame__state.html" title="Represents the state of the game.">game_state</a></code> at the same time through a <code><a class="el" href="classfull__state__response.html">full_state_response</a></code>.</p> +<p>To serialize the <code><a class="el" href="classgame__state.html" title="Represents the state of the game.">game_state</a></code>, the same <code>write_into_json(...)</code> function is used as for the <code><a class="el" href="classclient__request.html">client_request</a></code>.</p> <div class="fragment"><div class="line"><span class="keyword">class </span><a class="code hl_class" href="classgame__state.html">game_state</a> : <span class="keyword">public</span> <a class="code hl_class" href="classunique__serializable.html">unique_serializable</a> {</div> <div class="line"><span class="keyword">private</span>:</div> <div class="line"> <span class="comment">// Properties</span></div> @@ -312,33 +314,38 @@ Server -> Client:</h3> <div class="line"> <a class="code hl_class" href="classserializable__value.html">serializable_value<int></a>* _starting_player_idx;</div> <div class="line"> </div> <div class="line"> <span class="comment">// deserialization constructor</span></div> -<div class="line"> <a class="code hl_class" href="classgame__state.html">game_state</a>(</div> +<div class="line"> <a class="code hl_function" href="classgame__state.html#a0c10b830e222d726557c3c33685c595a">game_state</a>(</div> <div class="line"> std::string <span class="keywordtype">id</span>,</div> <div class="line"> draw_pile* draw_pile,</div> <div class="line"> discard_pile* discard_pile,</div> <div class="line"> std::vector<player*>& players,</div> -<div class="line"> <a class="code hl_class" href="classserializable__value.html">serializable_value<bool></a>* is_started,</div> -<div class="line"> <a class="code hl_class" href="classserializable__value.html">serializable_value<bool></a>* is_finished,</div> +<div class="line"> <a class="code hl_class" href="classserializable__value.html">serializable_value<bool></a>* <a class="code hl_function" href="classgame__state.html#aa0092c41779f38eba5e921e43b38559c">is_started</a>,</div> +<div class="line"> <a class="code hl_class" href="classserializable__value.html">serializable_value<bool></a>* <a class="code hl_function" href="classgame__state.html#a9b83de8a89e3bb506184492d22c3cf45">is_finished</a>,</div> <div class="line"> <a class="code hl_class" href="classserializable__value.html">serializable_value<int></a>* current_player_idx,</div> <div class="line"> <a class="code hl_class" href="classserializable__value.html">serializable_value<int></a>* round_number,</div> <div class="line"> <a class="code hl_class" href="classserializable__value.html">serializable_value<int></a>* starting_player_idx);</div> <div class="line"> </div> <div class="line"><span class="keyword">public</span>:</div> -<div class="line"> <a class="code hl_class" href="classgame__state.html">game_state</a>();</div> +<div class="line"> <a class="code hl_function" href="classgame__state.html#a0c10b830e222d726557c3c33685c595a">game_state</a>();</div> <div class="line"> </div> <div class="line"> ...</div> <div class="line"> <span class="comment">// SERIALIZATION</span></div> -<div class="line"> <span class="keyword">virtual</span> <span class="keywordtype">void</span> write_into_json(rapidjson::Value& json, rapidjson::Document::AllocatorType& allocator) <span class="keyword">const override</span>;</div> +<div class="line"> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classgame__state.html#a54873cd18b46555915d150a6d8dd6f83">write_into_json</a>(rapidjson::Value& json, rapidjson::Document::AllocatorType& allocator) <span class="keyword">const override</span>;</div> <div class="line"> <span class="comment">// DESERIALIZATION</span></div> -<div class="line"> <span class="keyword">static</span> <a class="code hl_class" href="classgame__state.html">game_state</a>* from_json(<span class="keyword">const</span> rapidjson::Value& json);</div> +<div class="line"> <span class="keyword">static</span> <a class="code hl_class" href="classgame__state.html">game_state</a>* <a class="code hl_function" href="classgame__state.html#a794d484961c92b5b737586ec5599963f">from_json</a>(<span class="keyword">const</span> rapidjson::Value& json);</div> <div class="line">};</div> -<div class="ttc" id="aclassgame__state_html"><div class="ttname"><a href="classgame__state.html">game_state</a></div><div class="ttdef"><b>Definition</b> game_state.h:18</div></div> +<div class="ttc" id="aclassgame__state_html"><div class="ttname"><a href="classgame__state.html">game_state</a></div><div class="ttdoc">Represents the state of the game.</div><div class="ttdef"><b>Definition</b> game_state.h:27</div></div> +<div class="ttc" id="aclassgame__state_html_a0c10b830e222d726557c3c33685c595a"><div class="ttname"><a href="classgame__state.html#a0c10b830e222d726557c3c33685c595a">game_state::game_state</a></div><div class="ttdeci">game_state()</div><div class="ttdoc">Constructs a new game_state object.</div><div class="ttdef"><b>Definition</b> game_state.cpp:54</div></div> +<div class="ttc" id="aclassgame__state_html_a54873cd18b46555915d150a6d8dd6f83"><div class="ttname"><a href="classgame__state.html#a54873cd18b46555915d150a6d8dd6f83">game_state::write_into_json</a></div><div class="ttdeci">void write_into_json(rapidjson::Value &json, rapidjson::Document::AllocatorType &allocator) const override</div><div class="ttdoc">Serializes a game_state object into a json object.</div><div class="ttdef"><b>Definition</b> game_state.cpp:483</div></div> +<div class="ttc" id="aclassgame__state_html_a794d484961c92b5b737586ec5599963f"><div class="ttname"><a href="classgame__state.html#a794d484961c92b5b737586ec5599963f">game_state::from_json</a></div><div class="ttdeci">static game_state * from_json(const rapidjson::Value &json)</div><div class="ttdoc">Deserializes a game_state object from a json object.</div><div class="ttdef"><b>Definition</b> game_state.cpp:547</div></div> +<div class="ttc" id="aclassgame__state_html_a9b83de8a89e3bb506184492d22c3cf45"><div class="ttname"><a href="classgame__state.html#a9b83de8a89e3bb506184492d22c3cf45">game_state::is_finished</a></div><div class="ttdeci">bool is_finished() const</div><div class="ttdoc">Checks if the game is finished.</div><div class="ttdef"><b>Definition</b> game_state.cpp:166</div></div> +<div class="ttc" id="aclassgame__state_html_aa0092c41779f38eba5e921e43b38559c"><div class="ttname"><a href="classgame__state.html#aa0092c41779f38eba5e921e43b38559c">game_state::is_started</a></div><div class="ttdeci">bool is_started() const</div><div class="ttdoc">Checks if the game is started.</div><div class="ttdef"><b>Definition</b> game_state.cpp:161</div></div> <div class="ttc" id="aclassserializable__value_html"><div class="ttname"><a href="classserializable__value.html">serializable_value</a></div><div class="ttdef"><b>Definition</b> serializable_value.h:27</div></div> <div class="ttc" id="aclassunique__serializable_html"><div class="ttname"><a href="classunique__serializable.html">unique_serializable</a></div><div class="ttdef"><b>Definition</b> unique_serializable.h:12</div></div> -</div><!-- fragment --><p>The <code><a class="el" href="classgame__state.html">game_state</a></code> inherits from <code><a class="el" href="classunique__serializable.html">unique_serializable</a></code>, which essentially requires the <code>write_into_json()</code> function and adds a unique <code>id</code> to the object, such that it can be uniquely identified. Similarly, each parameter nested inside the <code><a class="el" href="classgame__state.html">game_state</a></code> (e.g. players, draw_pile, etc.) also inherit from <code><a class="el" href="classunique__serializable.html">unique_serializable</a></code> and therefore have their own <code>id</code> and serialization, resp. deserialization functions.</p> -<p>On the client side, the new <code><a class="el" href="classgame__state.html">game_state</a></code> is then passed to the <code>updateGameState(game_state*)</code> function of the <code><a class="el" href="class_game_controller.html">GameController</a></code> class, which performs a redraw of the GUI.</p> -<p>Since you will have to add your own properties to the <code><a class="el" href="classgame__state.html">game_state</a></code> class (and probably create other classes that inherit from <code><a class="el" href="classunique__serializable.html">unique_serializable</a></code> to add to your <a class="el" href="classgame__state.html">game_state</a>), we want to shortly elaborate how the serialization and deserialization works for subclasses of <code><a class="el" href="classunique__serializable.html">unique_serializable</a></code>. It's very similar to the <code><a class="el" href="classclient__request.html">client_request</a></code> class discussed earlier. Here is how the <code>write_into_json(...)</code> function is implemented in the <code><a class="el" href="classgame__state.html">game_state</a></code> class of <a class="el" href="class_wizard.html">Wizard</a>. <b>Don't be shocked by the lengthy code. It's only a lot of repetition for each class property</b> :</p> -<div class="fragment"><div class="line"><span class="keywordtype">void</span> game_state::write_into_json(rapidjson::Value &json,</div> +</div><!-- fragment --><p>The <code><a class="el" href="classgame__state.html" title="Represents the state of the game.">game_state</a></code> inherits from <code><a class="el" href="classunique__serializable.html">unique_serializable</a></code>, which essentially requires the <code>write_into_json()</code> function and adds a unique <code>id</code> to the object, such that it can be uniquely identified. Similarly, each parameter nested inside the <code><a class="el" href="classgame__state.html" title="Represents the state of the game.">game_state</a></code> (e.g. players, draw_pile, etc.) also inherit from <code><a class="el" href="classunique__serializable.html">unique_serializable</a></code> and therefore have their own <code>id</code> and serialization, resp. deserialization functions.</p> +<p>On the client side, the new <code><a class="el" href="classgame__state.html" title="Represents the state of the game.">game_state</a></code> is then passed to the <code>updateGameState(game_state*)</code> function of the <code><a class="el" href="class_game_controller.html">GameController</a></code> class, which performs a redraw of the GUI.</p> +<p>Since you will have to add your own properties to the <code><a class="el" href="classgame__state.html" title="Represents the state of the game.">game_state</a></code> class (and probably create other classes that inherit from <code><a class="el" href="classunique__serializable.html">unique_serializable</a></code> to add to your <a class="el" href="classgame__state.html" title="Represents the state of the game.">game_state</a>), we want to shortly elaborate how the serialization and deserialization works for subclasses of <code><a class="el" href="classunique__serializable.html">unique_serializable</a></code>. It's very similar to the <code><a class="el" href="classclient__request.html">client_request</a></code> class discussed earlier. Here is how the <code>write_into_json(...)</code> function is implemented in the <code><a class="el" href="classgame__state.html" title="Represents the state of the game.">game_state</a></code> class of <a class="el" href="class_wizard.html">Wizard</a>. <b>Don't be shocked by the lengthy code. It's only a lot of repetition for each class property</b> :</p> +<div class="fragment"><div class="line"><span class="keywordtype">void</span> <a class="code hl_function" href="classgame__state.html#a54873cd18b46555915d150a6d8dd6f83">game_state::write_into_json</a>(rapidjson::Value &json,</div> <div class="line"> rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> &allocator)<span class="keyword"> const </span>{</div> <div class="line"> <span class="comment">// call base-class to write id and object name into the json</span></div> <div class="line"> unique_serializable::write_into_json(json, allocator);</div> @@ -378,7 +385,7 @@ Server -> Client:</h3> <div class="line">}</div> </div><!-- fragment --><p>For <b>deserialization</b>, the <code>from_json(...)</code> function is used, which is implemented as follows:</p> <div class="fragment"><div class="line"><span class="comment">// DESERIALIZATION CONSTRUCTOR receives pointers for all its properties and stores them</span></div> -<div class="line">game_state::game_state(std::string <span class="keywordtype">id</span>, draw_pile *draw_pile, discard_pile *discard_pile,</div> +<div class="line"><a class="code hl_function" href="classgame__state.html#a0c10b830e222d726557c3c33685c595a">game_state::game_state</a>(std::string <span class="keywordtype">id</span>, draw_pile *draw_pile, discard_pile *discard_pile,</div> <div class="line"> std::vector<player *> &players, <a class="code hl_class" href="classserializable__value.html">serializable_value<bool></a> *is_started,</div> <div class="line"> <a class="code hl_class" href="classserializable__value.html">serializable_value<bool></a> *is_finished, <a class="code hl_class" href="classserializable__value.html">serializable_value<int></a> *current_player_idx,</div> <div class="line"> <a class="code hl_class" href="classserializable__value.html">serializable_value<int></a>* round_number, <a class="code hl_class" href="classserializable__value.html">serializable_value<int></a> *starting_player_idx)</div> @@ -395,7 +402,7 @@ Server -> Client:</h3> <div class="line"> </div> <div class="line"><span class="comment">// DESERIALIZATION </span></div> <div class="line"><span class="comment">// returns a pointer to the new game_state</span></div> -<div class="line"><a class="code hl_class" href="classgame__state.html">game_state</a>* game_state::from_json(<span class="keyword">const</span> rapidjson::Value &json) {</div> +<div class="line"><a class="code hl_class" href="classgame__state.html">game_state</a>* <a class="code hl_function" href="classgame__state.html#a794d484961c92b5b737586ec5599963f">game_state::from_json</a>(<span class="keyword">const</span> rapidjson::Value &json) {</div> <div class="line"> <span class="comment">// Make sure the json contains all required information</span></div> <div class="line"> <span class="keywordflow">if</span> (json.HasMember(<span class="stringliteral">"is_finished"</span>)</div> <div class="line"> && json.HasMember(<span class="stringliteral">"is_started"</span>)</div> @@ -412,7 +419,7 @@ Server -> Client:</h3> <div class="line"> deserialized_players.push_back(<a class="code hl_function" href="classplayer.html#a5955c5f26db6a08862ccfb443fbe99c5">player::from_json</a>(serialized_player.GetObject()));</div> <div class="line"> }</div> <div class="line"> <span class="comment">// Invoke deserialization constructor</span></div> -<div class="line"> <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code hl_class" href="classgame__state.html">game_state</a>(unique_serializable::extract_id(json), <span class="comment">// extract base_params from JSON</span></div> +<div class="line"> <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code hl_function" href="classgame__state.html#a0c10b830e222d726557c3c33685c595a">game_state</a>(unique_serializable::extract_id(json), <span class="comment">// extract base_params from JSON</span></div> <div class="line"> draw_pile::from_json(json[<span class="stringliteral">"draw_pile"</span>].GetObject()), <span class="comment">// deserialize the draw_pile</span></div> <div class="line"> discard_pile::from_json(json[<span class="stringliteral">"discard_pile"</span>].GetObject()),</div> <div class="line"> deserialized_players,</div> diff --git a/html/menudata.js b/html/menudata.js index aedd6cf..d226627 100644 --- a/html/menudata.js +++ b/html/menudata.js @@ -33,6 +33,7 @@ var menudata={children:[ {text:"a",url:"functions.html#index_a"}, {text:"c",url:"functions.html#index_c"}, {text:"d",url:"functions.html#index_d"}, +{text:"e",url:"functions.html#index_e"}, {text:"f",url:"functions.html#index_f"}, {text:"g",url:"functions.html#index_g"}, {text:"h",url:"functions.html#index_h"}, @@ -41,12 +42,14 @@ var menudata={children:[ {text:"r",url:"functions.html#index_r"}, {text:"s",url:"functions.html#index_s"}, {text:"t",url:"functions.html#index_t"}, +{text:"u",url:"functions.html#index_u"}, {text:"w",url:"functions.html#index_w"}, {text:"~",url:"functions.html#index__7E"}]}, {text:"Functions",url:"functions_func.html",children:[ {text:"a",url:"functions_func.html#index_a"}, {text:"c",url:"functions_func.html#index_c"}, {text:"d",url:"functions_func.html#index_d"}, +{text:"e",url:"functions_func.html#index_e"}, {text:"f",url:"functions_func.html#index_f"}, {text:"g",url:"functions_func.html#index_g"}, {text:"h",url:"functions_func.html#index_h"}, @@ -55,6 +58,7 @@ var menudata={children:[ {text:"r",url:"functions_func.html#index_r"}, {text:"s",url:"functions_func.html#index_s"}, {text:"t",url:"functions_func.html#index_t"}, +{text:"u",url:"functions_func.html#index_u"}, {text:"w",url:"functions_func.html#index_w"}, {text:"~",url:"functions_func.html#index__7E"}]}]}]}, {text:"Files",url:"files.html",children:[ diff --git a/html/search/all_12.js b/html/search/all_12.js index cbd7070..bea4e14 100644 --- a/html/search/all_12.js +++ b/html/search/all_12.js @@ -2,8 +2,9 @@ var searchData= [ ['panel_0',['4.1 Connection Panel',['../index.html#autotoc_md7',1,'']]], ['play_20the_20game_1',['4 Play the Game',['../index.html#autotoc_md6',1,'']]], - ['play_5fcard_5frequest_2',['play_card_request',['../classplay__card__request.html',1,'']]], - ['player_3',['player',['../classplayer.html',1,'player'],['../classplayer.html#a1f0916939a8caa2e7140d5c89a6aa718',1,'player::player(const std::string &name)'],['../classplayer.html#aa97dd36228b56912bc5dad63f64e1ccf',1,'player::player(const std::string &id, const std::string &name)']]], - ['player_5fmanager_4',['player_manager',['../classplayer__manager.html',1,'']]], - ['project_20wizard_5',['Software Engineering Project - Wizard',['../index.html',1,'']]] + ['play_5fcard_2',['play_card',['../classgame__state.html#a6c65d95086a88b8d111de5553e1210ec',1,'game_state']]], + ['play_5fcard_5frequest_3',['play_card_request',['../classplay__card__request.html',1,'']]], + ['player_4',['player',['../classplayer.html',1,'player'],['../classplayer.html#a1f0916939a8caa2e7140d5c89a6aa718',1,'player::player(const std::string &name)'],['../classplayer.html#aa97dd36228b56912bc5dad63f64e1ccf',1,'player::player(const std::string &id, const std::string &name)']]], + ['player_5fmanager_5',['player_manager',['../classplayer__manager.html',1,'']]], + ['project_20wizard_6',['Software Engineering Project - Wizard',['../index.html',1,'']]] ]; diff --git a/html/search/all_13.js b/html/search/all_13.js index 49acb1b..aaa3ecc 100644 --- a/html/search/all_13.js +++ b/html/search/all_13.js @@ -1,8 +1,9 @@ var searchData= [ ['remove_5fcard_0',['remove_card',['../classhand.html#aa466496b7ce0b58dbd63620535430439',1,'hand']]], - ['request_5fhandler_1',['request_handler',['../classrequest__handler.html',1,'']]], - ['request_5fresponse_2',['request_response',['../classrequest__response.html',1,'']]], - ['responselistenerthread_3',['ResponseListenerThread',['../class_response_listener_thread.html',1,'']]], - ['run_20the_20game_4',['3 Run the Game',['../index.html#autotoc_md5',1,'']]] + ['remove_5fplayer_1',['remove_player',['../classgame__state.html#a734fc594d457aa4e6db5bc7467e6442d',1,'game_state']]], + ['request_5fhandler_2',['request_handler',['../classrequest__handler.html',1,'']]], + ['request_5fresponse_3',['request_response',['../classrequest__response.html',1,'']]], + ['responselistenerthread_4',['ResponseListenerThread',['../class_response_listener_thread.html',1,'']]], + ['run_20the_20game_5',['3 Run the Game',['../index.html#autotoc_md5',1,'']]] ]; diff --git a/html/search/all_14.js b/html/search/all_14.js index eaa59e1..4b4768a 100644 --- a/html/search/all_14.js +++ b/html/search/all_14.js @@ -18,11 +18,13 @@ var searchData= ['set_5fnof_5fpredicted_15',['set_nof_predicted',['../classplayer.html#a1a3ce0ac69cad799641f4d732435c3f7',1,'player']]], ['set_5fnof_5ftricks_16',['set_nof_tricks',['../classplayer.html#a61aa38ceff0c856b36642c4bc0081433',1,'player']]], ['set_5fscores_17',['set_scores',['../classplayer.html#af1d7e67eee27af87c01e43508a731bd4',1,'player']]], - ['set_5ftrick_5fcolor_18',['set_trick_color',['../classtrick.html#a0f8c45882691509564ec42efed0d1aaa',1,'trick']]], - ['set_5fup_5fround_19',['set_up_round',['../classtrick.html#ae5b769ed0fc2933c1a44b5e481c18b00',1,'trick']]], - ['setup_5fround_20',['setup_round',['../classdeck.html#a77851e5cb8297849e91a885ed7959de1',1,'deck::setup_round()'],['../classplayer.html#a8cc6464ca3284140c92c6983ee62a299',1,'player::setup_round()']]], - ['software_20engineering_20project_20wizard_21',['Software Engineering Project - Wizard',['../index.html',1,'']]], - ['start_5fgame_5frequest_22',['start_game_request',['../classstart__game__request.html',1,'']]], - ['state_23',['4.3 Game State',['../index.html#autotoc_md16',1,'']]], - ['structure_20important_20classes_24',['4.4.1 Structure & Important Classes',['../index.html#autotoc_md18',1,'']]] + ['set_5ftrick_18',['set_trick',['../classgame__state.html#a745dd23945b6165470c494b036ac4667',1,'game_state']]], + ['set_5ftrick_5fcolor_19',['set_trick_color',['../classtrick.html#a0f8c45882691509564ec42efed0d1aaa',1,'trick']]], + ['set_5fup_5fround_20',['set_up_round',['../classtrick.html#ae5b769ed0fc2933c1a44b5e481c18b00',1,'trick']]], + ['setup_5fround_21',['setup_round',['../classdeck.html#a77851e5cb8297849e91a885ed7959de1',1,'deck::setup_round()'],['../classgame__state.html#ab520d4076c53f70a68bc19f355243a4d',1,'game_state::setup_round()'],['../classplayer.html#a8cc6464ca3284140c92c6983ee62a299',1,'player::setup_round()']]], + ['software_20engineering_20project_20wizard_22',['Software Engineering Project - Wizard',['../index.html',1,'']]], + ['start_5fgame_23',['start_game',['../classgame__state.html#a6ca6536eaec3404ff9b1ab39b8df4e67',1,'game_state']]], + ['start_5fgame_5frequest_24',['start_game_request',['../classstart__game__request.html',1,'']]], + ['state_25',['4.3 Game State',['../index.html#autotoc_md16',1,'']]], + ['structure_20important_20classes_26',['4.4.1 Structure & Important Classes',['../index.html#autotoc_md18',1,'']]] ]; diff --git a/html/search/all_15.js b/html/search/all_15.js index 6b2d037..f8e788d 100644 --- a/html/search/all_15.js +++ b/html/search/all_15.js @@ -1,7 +1,7 @@ var searchData= [ ['the_20game_0',['the Game',['../index.html#autotoc_md5',1,'3 Run the Game'],['../index.html#autotoc_md6',1,'4 Play the Game']]], - ['trick_1',['trick',['../classtrick.html',1,'trick'],['../classtrick.html#a3b0a12789b87d15d9cdc4e5b6f85b47d',1,'trick::trick()'],['../classtrick.html#abb172ad9a476e96a754eea0c33e1eda9',1,'trick::trick(const std::string &id)'],['../classtrick.html#ab756ba7a19c4bf98f0d8456ad0081fc3',1,'trick::trick(const std::string &id, const std::vector< std::pair< card *, player * > > &cards, serializable_value< int > *trick_color, serializable_value< int > *trump_color)'],['../classtrick.html#a3ecb1c5ebe84a300d7388e2846737fa4',1,'trick::trick(int trump)']]], + ['trick_1',['trick',['../classtrick.html',1,'trick'],['../classtrick.html#a3b0a12789b87d15d9cdc4e5b6f85b47d',1,'trick::trick()'],['../classtrick.html#ad55ad2f0462144ee39c0e6d392543a14',1,'trick::trick(const trick &other)'],['../classtrick.html#abb172ad9a476e96a754eea0c33e1eda9',1,'trick::trick(const std::string &id)'],['../classtrick.html#ab756ba7a19c4bf98f0d8456ad0081fc3',1,'trick::trick(const std::string &id, const std::vector< std::pair< card *, player * > > &cards, serializable_value< int > *trick_color, serializable_value< int > *trump_color)'],['../classtrick.html#a3ecb1c5ebe84a300d7388e2846737fa4',1,'trick::trick(int trump)']]], ['trickestimationpanel_2',['TrickEstimationPanel',['../class_trick_estimation_panel.html',1,'']]], ['try_5fget_5fcard_3',['try_get_card',['../classhand.html#a0a50cbbb167e6a1d633dd48bc4b695fe',1,'hand']]] ]; diff --git a/html/search/all_16.js b/html/search/all_16.js index ba096de..aec59b4 100644 --- a/html/search/all_16.js +++ b/html/search/all_16.js @@ -1,5 +1,6 @@ var searchData= [ ['unique_5fserializable_0',['unique_serializable',['../classunique__serializable.html',1,'']]], - ['uuid_5fgenerator_1',['uuid_generator',['../classuuid__generator.html',1,'']]] + ['update_5fcurrent_5fplayer_1',['update_current_player',['../classgame__state.html#a49851709fcec061d36478ed2fdcc3d9d',1,'game_state']]], + ['uuid_5fgenerator_2',['uuid_generator',['../classuuid__generator.html',1,'']]] ]; diff --git a/html/search/all_17.js b/html/search/all_17.js index 952171d..342ead7 100644 --- a/html/search/all_17.js +++ b/html/search/all_17.js @@ -3,8 +3,8 @@ var searchData= ['with_20wxwidgets_0',['4.4 GUI with wxWidgets',['../index.html#autotoc_md17',1,'']]], ['wizard_1',['Wizard',['../index.html',1,'Software Engineering Project - Wizard'],['../class_wizard.html',1,'Wizard']]], ['wizardexception_2',['WizardException',['../class_wizard_exception.html',1,'']]], - ['wrap_5fup_5fround_3',['wrap_up_round',['../classplayer.html#a193bcc63da13e5bc98eb46ed99381302',1,'player']]], + ['wrap_5fup_5fround_3',['wrap_up_round',['../classgame__state.html#ad2e967638043670ebae93dd6ec32e91e',1,'game_state::wrap_up_round()'],['../classplayer.html#a193bcc63da13e5bc98eb46ed99381302',1,'player::wrap_up_round()']]], ['wrap_5fup_5ftrick_4',['wrap_up_trick',['../classtrick.html#a384560623ffaf776797948cf35197c73',1,'trick']]], - ['write_5finto_5fjson_5',['write_into_json',['../classcard.html#a7f900b843e44fb18364f32dbe6cdbc7a',1,'card::write_into_json()'],['../classdeck.html#a8d226fe699a36bf462010ba1f744fbeb',1,'deck::write_into_json()'],['../classtrick.html#a97176df194eae794691356cd83292b04',1,'trick::write_into_json()'],['../classhand.html#a505a82447d0ae305dadcc9c4aa54071e',1,'hand::write_into_json()'],['../classplayer.html#a0cf13abfdb6b837faa88eda064bf51dc',1,'player::write_into_json()']]], + ['write_5finto_5fjson_5',['write_into_json',['../classcard.html#a7f900b843e44fb18364f32dbe6cdbc7a',1,'card::write_into_json()'],['../classdeck.html#a8d226fe699a36bf462010ba1f744fbeb',1,'deck::write_into_json()'],['../classtrick.html#a97176df194eae794691356cd83292b04',1,'trick::write_into_json()'],['../classgame__state.html#a54873cd18b46555915d150a6d8dd6f83',1,'game_state::write_into_json()'],['../classhand.html#a505a82447d0ae305dadcc9c4aa54071e',1,'hand::write_into_json()'],['../classplayer.html#a0cf13abfdb6b837faa88eda064bf51dc',1,'player::write_into_json()']]], ['wxwidgets_6',['4.4 GUI with wxWidgets',['../index.html#autotoc_md17',1,'']]] ]; diff --git a/html/search/all_18.js b/html/search/all_18.js index 81b756a..e493971 100644 --- a/html/search/all_18.js +++ b/html/search/all_18.js @@ -2,7 +2,8 @@ var searchData= [ ['_7ecard_0',['~card',['../classcard.html#ac7a5d8d53e8cc33f5c5a03d8ccb806c4',1,'card']]], ['_7edeck_1',['~deck',['../classdeck.html#a63a688bda08bfef8d2c37d53523b7b12',1,'deck']]], - ['_7ehand_2',['~hand',['../classhand.html#af3ffc5e5b46f04b14f12a9fc130b220a',1,'hand']]], - ['_7eplayer_3',['~player',['../classplayer.html#a0a62c0208584465db2daa1ac6e15b1ad',1,'player']]], - ['_7etrick_4',['~trick',['../classtrick.html#a22c0b586f1d6c3baeb7bb0e22eb7dfe2',1,'trick']]] + ['_7egame_5fstate_2',['~game_state',['../classgame__state.html#a2fbc370f93617298719f61514afdb5bc',1,'game_state']]], + ['_7ehand_3',['~hand',['../classhand.html#af3ffc5e5b46f04b14f12a9fc130b220a',1,'hand']]], + ['_7eplayer_4',['~player',['../classplayer.html#a0a62c0208584465db2daa1ac6e15b1ad',1,'player']]], + ['_7etrick_5',['~trick',['../classtrick.html#a22c0b586f1d6c3baeb7bb0e22eb7dfe2',1,'trick']]] ]; diff --git a/html/search/all_4.js b/html/search/all_4.js index 3d39bb6..0108da9 100644 --- a/html/search/all_4.js +++ b/html/search/all_4.js @@ -1,4 +1,5 @@ var searchData= [ - ['add_5fcard_0',['add_card',['../classtrick.html#a2d3b5aa88a1469dc3d58f30885752f5d',1,'trick::add_card()'],['../classhand.html#ad4749893f36ff1d6dcda3bb18eaedffb',1,'hand::add_card()'],['../classplayer.html#ab3b087d03dd2c81d893b2ffad459a26f',1,'player::add_card()']]] + ['add_5fcard_0',['add_card',['../classtrick.html#a2d3b5aa88a1469dc3d58f30885752f5d',1,'trick::add_card()'],['../classhand.html#ad4749893f36ff1d6dcda3bb18eaedffb',1,'hand::add_card()'],['../classplayer.html#ab3b087d03dd2c81d893b2ffad459a26f',1,'player::add_card()']]], + ['add_5fplayer_1',['add_player',['../classgame__state.html#a4a4fde0700a05c589a6b9c4dbcffac18',1,'game_state']]] ]; diff --git a/html/search/all_8.js b/html/search/all_8.js index 7129c2b..d83294d 100644 --- a/html/search/all_8.js +++ b/html/search/all_8.js @@ -2,6 +2,7 @@ var searchData= [ ['engineering_20project_20wizard_0',['Software Engineering Project - Wizard',['../index.html',1,'']]], ['errordialog_1',['ErrorDialog',['../class_error_dialog.html',1,'']]], - ['estimate_5ftricks_5frequest_2',['estimate_tricks_request',['../classestimate__tricks__request.html',1,'']]], - ['events_3',['4.4.2 Events',['../index.html#autotoc_md19',1,'']]] + ['estimate_5ftricks_2',['estimate_tricks',['../classgame__state.html#ac4ebff625d83c633c124890537d60354',1,'game_state']]], + ['estimate_5ftricks_5frequest_3',['estimate_tricks_request',['../classestimate__tricks__request.html',1,'']]], + ['events_4',['4.4.2 Events',['../index.html#autotoc_md19',1,'']]] ]; diff --git a/html/search/all_9.js b/html/search/all_9.js index ce6353d..1c20648 100644 --- a/html/search/all_9.js +++ b/html/search/all_9.js @@ -1,6 +1,7 @@ var searchData= [ ['features_0',['🚀 Features',['../index.html#autotoc_md1',1,'']]], - ['from_5fjson_1',['from_json',['../classcard.html#a48593187c9bff442d61f197991954011',1,'card::from_json()'],['../classdeck.html#abe8dbe828189696c22f35ac3ed4fd296',1,'deck::from_json()'],['../classtrick.html#a1a3d94f638672d3d60d596190ae59dfb',1,'trick::from_json()'],['../classhand.html#aa9cffdf932d80c7304a335074403e785',1,'hand::from_json()'],['../classplayer.html#a5955c5f26db6a08862ccfb443fbe99c5',1,'player::from_json()']]], - ['full_5fstate_5fresponse_2',['full_state_response',['../classfull__state__response.html',1,'']]] + ['finish_5fgame_1',['finish_game',['../classgame__state.html#a67fdd4b5682715cd2d848031a9911b17',1,'game_state']]], + ['from_5fjson_2',['from_json',['../classcard.html#a48593187c9bff442d61f197991954011',1,'card::from_json()'],['../classdeck.html#abe8dbe828189696c22f35ac3ed4fd296',1,'deck::from_json()'],['../classtrick.html#a1a3d94f638672d3d60d596190ae59dfb',1,'trick::from_json()'],['../classgame__state.html#a794d484961c92b5b737586ec5599963f',1,'game_state::from_json()'],['../classhand.html#aa9cffdf932d80c7304a335074403e785',1,'hand::from_json()'],['../classplayer.html#a5955c5f26db6a08862ccfb443fbe99c5',1,'player::from_json()']]], + ['full_5fstate_5fresponse_3',['full_state_response',['../classfull__state__response.html',1,'']]] ]; diff --git a/html/search/all_a.js b/html/search/all_a.js index 9ce3e72..242dd52 100644 --- a/html/search/all_a.js +++ b/html/search/all_a.js @@ -4,22 +4,32 @@ var searchData= ['game_20state_1',['4.3 Game State',['../index.html#autotoc_md16',1,'']]], ['game_5finstance_2',['game_instance',['../classgame__instance.html',1,'']]], ['game_5finstance_5fmanager_3',['game_instance_manager',['../classgame__instance__manager.html',1,'']]], - ['game_5fstate_4',['game_state',['../classgame__state.html',1,'']]], + ['game_5fstate_4',['game_state',['../classgame__state.html',1,'game_state'],['../classgame__state.html#a0c10b830e222d726557c3c33685c595a',1,'game_state::game_state()']]], ['gamecontroller_5',['GameController',['../class_game_controller.html',1,'']]], ['gamewindow_6',['GameWindow',['../class_game_window.html',1,'']]], ['get_5fcards_7',['get_cards',['../classhand.html#ad104b0376b1a13d987f349dd524ca47f',1,'hand']]], ['get_5fcards_5fand_5fplayers_8',['get_cards_and_players',['../classtrick.html#a1d75f9e8fc94fd122adfc39a20089268',1,'trick']]], ['get_5fcolor_9',['get_color',['../classcard.html#ab033bc0e71b09d3cf3ac28c2f1fbde18',1,'card']]], - ['get_5fgame_5fid_10',['get_game_id',['../classplayer.html#afeb6c5483a59042fcc4a3a2aed6a6a2c',1,'player']]], - ['get_5fhand_11',['get_hand',['../classplayer.html#af333dcbf7123726c9bda3ab94ba9ee6d',1,'player']]], - ['get_5fnof_5fcards_12',['get_nof_cards',['../classhand.html#adc90d109b7b564a0dbca0b0798c99641',1,'hand::get_nof_cards()'],['../classplayer.html#a457c5ab90b0ecd610eead66b41c8333a',1,'player::get_nof_cards() const noexcept']]], - ['get_5fnof_5fpredicted_13',['get_nof_predicted',['../classplayer.html#a40333c302ff51707749c544930fb80aa',1,'player']]], - ['get_5fnof_5ftricks_14',['get_nof_tricks',['../classplayer.html#a5e3d1374aee685b08a29d0ac7cec3df4',1,'player']]], - ['get_5fnumber_5fof_5fremaining_5fcards_15',['get_number_of_remaining_cards',['../classdeck.html#ae1c7a4174108a14cb1180de1afdcb6d6',1,'deck']]], - ['get_5fplayer_5fname_16',['get_player_name',['../classplayer.html#a42d01dcf4cdbd452fc5dcaf5e6f21773',1,'player']]], - ['get_5fscores_17',['get_scores',['../classplayer.html#aef5c25a02a2fdbdb4d8270582faf5dac',1,'player']]], - ['get_5ftrick_5fcolor_18',['get_trick_color',['../classtrick.html#a41f315804ac73454c8e41438da20a9c3',1,'trick']]], - ['get_5ftrump_5fcolor_19',['get_trump_color',['../classtrick.html#a69c49e2968abb235a6c7148cb05b0e64',1,'trick']]], - ['get_5fvalue_20',['get_value',['../classcard.html#a2baf8dfef09ac8c1a67b34c2e67186c3',1,'card']]], - ['gui_20with_20wxwidgets_21',['4.4 GUI with wxWidgets',['../index.html#autotoc_md17',1,'']]] + ['get_5fcurrent_5fplayer_10',['get_current_player',['../classgame__state.html#a2d16f420a8aa651685461a5efb8bb600',1,'game_state']]], + ['get_5fgame_5fid_11',['get_game_id',['../classplayer.html#afeb6c5483a59042fcc4a3a2aed6a6a2c',1,'player']]], + ['get_5fhand_12',['get_hand',['../classplayer.html#af333dcbf7123726c9bda3ab94ba9ee6d',1,'player']]], + ['get_5flast_5ftrick_13',['get_last_trick',['../classgame__state.html#a4327f753f1f5341f9fe3774ea3fbc99b',1,'game_state']]], + ['get_5fmax_5fround_5fnumber_14',['get_max_round_number',['../classgame__state.html#aa75c4da6c0056e48e5040be8127d7473',1,'game_state']]], + ['get_5fnof_5fcards_15',['get_nof_cards',['../classhand.html#adc90d109b7b564a0dbca0b0798c99641',1,'hand::get_nof_cards()'],['../classplayer.html#a457c5ab90b0ecd610eead66b41c8333a',1,'player::get_nof_cards() const noexcept']]], + ['get_5fnof_5fpredicted_16',['get_nof_predicted',['../classplayer.html#a40333c302ff51707749c544930fb80aa',1,'player']]], + ['get_5fnof_5ftricks_17',['get_nof_tricks',['../classplayer.html#a5e3d1374aee685b08a29d0ac7cec3df4',1,'player']]], + ['get_5fnumber_5fof_5fremaining_5fcards_18',['get_number_of_remaining_cards',['../classdeck.html#ae1c7a4174108a14cb1180de1afdcb6d6',1,'deck']]], + ['get_5fplayer_5fname_19',['get_player_name',['../classplayer.html#a42d01dcf4cdbd452fc5dcaf5e6f21773',1,'player']]], + ['get_5fplayers_20',['get_players',['../classgame__state.html#abcaccd551f938f961d12266e34c037d2',1,'game_state']]], + ['get_5fround_5fnumber_21',['get_round_number',['../classgame__state.html#ab3ef836a1b3a1e2bc9e429a018c72eca',1,'game_state']]], + ['get_5fscores_22',['get_scores',['../classplayer.html#aef5c25a02a2fdbdb4d8270582faf5dac',1,'player']]], + ['get_5fstarting_5fplayer_23',['get_starting_player',['../classgame__state.html#af4c553229260e307ff1f78dd0c74506d',1,'game_state']]], + ['get_5ftrick_24',['get_trick',['../classgame__state.html#a472fd1721c7cc9e3689394f18c767bf9',1,'game_state']]], + ['get_5ftrick_5fcolor_25',['get_trick_color',['../classtrick.html#a41f315804ac73454c8e41438da20a9c3',1,'trick']]], + ['get_5ftrick_5festimate_5fsum_26',['get_trick_estimate_sum',['../classgame__state.html#aa5263d03c85bce1e9d252e9017cbe282',1,'game_state']]], + ['get_5ftrick_5fnumber_27',['get_trick_number',['../classgame__state.html#a3fce12f31ad0aab82b0d2da90e3e8e15',1,'game_state']]], + ['get_5ftrick_5fstarting_5fplayer_28',['get_trick_starting_player',['../classgame__state.html#aa40554d105939c5dce934daaa858c242',1,'game_state']]], + ['get_5ftrump_5fcolor_29',['get_trump_color',['../classtrick.html#a69c49e2968abb235a6c7148cb05b0e64',1,'trick::get_trump_color()'],['../classgame__state.html#abdf6c5116ed643773d676c90a05e6fe4',1,'game_state::get_trump_color()']]], + ['get_5fvalue_30',['get_value',['../classcard.html#a2baf8dfef09ac8c1a67b34c2e67186c3',1,'card']]], + ['gui_20with_20wxwidgets_31',['4.4 GUI with wxWidgets',['../index.html#autotoc_md17',1,'']]] ]; diff --git a/html/search/all_c.js b/html/search/all_c.js index 8244359..98badb2 100644 --- a/html/search/all_c.js +++ b/html/search/all_c.js @@ -5,5 +5,10 @@ var searchData= ['inputfield_2',['InputField',['../class_input_field.html',1,'']]], ['instructions_3',['2 Compile Instructions',['../index.html#autotoc_md4',1,'']]], ['interface_4',['Network Interface',['../index.html#autotoc_md8',1,'']]], - ['is_5fempty_5',['is_empty',['../classdeck.html#a6aef528ff7b9c608863cc77c19b7882d',1,'deck']]] + ['is_5fempty_5',['is_empty',['../classdeck.html#a6aef528ff7b9c608863cc77c19b7882d',1,'deck']]], + ['is_5festimation_5fphase_6',['is_estimation_phase',['../classgame__state.html#a88d19342ee76acc4660b3e56e8c126eb',1,'game_state']]], + ['is_5ffinished_7',['is_finished',['../classgame__state.html#a9b83de8a89e3bb506184492d22c3cf45',1,'game_state']]], + ['is_5ffull_8',['is_full',['../classgame__state.html#ae161c283e275a57d71834754d11e9e40',1,'game_state']]], + ['is_5fplayer_5fin_5fgame_9',['is_player_in_game',['../classgame__state.html#a371d6a6d84395b90c15d84549b05d553',1,'game_state']]], + ['is_5fstarted_10',['is_started',['../classgame__state.html#aa0092c41779f38eba5e921e43b38559c',1,'game_state']]] ]; diff --git a/html/search/functions_0.js b/html/search/functions_0.js index 3d39bb6..0108da9 100644 --- a/html/search/functions_0.js +++ b/html/search/functions_0.js @@ -1,4 +1,5 @@ var searchData= [ - ['add_5fcard_0',['add_card',['../classtrick.html#a2d3b5aa88a1469dc3d58f30885752f5d',1,'trick::add_card()'],['../classhand.html#ad4749893f36ff1d6dcda3bb18eaedffb',1,'hand::add_card()'],['../classplayer.html#ab3b087d03dd2c81d893b2ffad459a26f',1,'player::add_card()']]] + ['add_5fcard_0',['add_card',['../classtrick.html#a2d3b5aa88a1469dc3d58f30885752f5d',1,'trick::add_card()'],['../classhand.html#ad4749893f36ff1d6dcda3bb18eaedffb',1,'hand::add_card()'],['../classplayer.html#ab3b087d03dd2c81d893b2ffad459a26f',1,'player::add_card()']]], + ['add_5fplayer_1',['add_player',['../classgame__state.html#a4a4fde0700a05c589a6b9c4dbcffac18',1,'game_state']]] ]; diff --git a/html/search/functions_3.js b/html/search/functions_3.js index daa0f77..d14237b 100644 --- a/html/search/functions_3.js +++ b/html/search/functions_3.js @@ -1,4 +1,4 @@ var searchData= [ - ['from_5fjson_0',['from_json',['../classcard.html#a48593187c9bff442d61f197991954011',1,'card::from_json()'],['../classdeck.html#abe8dbe828189696c22f35ac3ed4fd296',1,'deck::from_json()'],['../classtrick.html#a1a3d94f638672d3d60d596190ae59dfb',1,'trick::from_json()'],['../classhand.html#aa9cffdf932d80c7304a335074403e785',1,'hand::from_json()'],['../classplayer.html#a5955c5f26db6a08862ccfb443fbe99c5',1,'player::from_json()']]] + ['estimate_5ftricks_0',['estimate_tricks',['../classgame__state.html#ac4ebff625d83c633c124890537d60354',1,'game_state']]] ]; diff --git a/html/search/functions_4.js b/html/search/functions_4.js index 8e5311e..f2110a3 100644 --- a/html/search/functions_4.js +++ b/html/search/functions_4.js @@ -1,17 +1,5 @@ var searchData= [ - ['get_5fcards_0',['get_cards',['../classhand.html#ad104b0376b1a13d987f349dd524ca47f',1,'hand']]], - ['get_5fcards_5fand_5fplayers_1',['get_cards_and_players',['../classtrick.html#a1d75f9e8fc94fd122adfc39a20089268',1,'trick']]], - ['get_5fcolor_2',['get_color',['../classcard.html#ab033bc0e71b09d3cf3ac28c2f1fbde18',1,'card']]], - ['get_5fgame_5fid_3',['get_game_id',['../classplayer.html#afeb6c5483a59042fcc4a3a2aed6a6a2c',1,'player']]], - ['get_5fhand_4',['get_hand',['../classplayer.html#af333dcbf7123726c9bda3ab94ba9ee6d',1,'player']]], - ['get_5fnof_5fcards_5',['get_nof_cards',['../classhand.html#adc90d109b7b564a0dbca0b0798c99641',1,'hand::get_nof_cards()'],['../classplayer.html#a457c5ab90b0ecd610eead66b41c8333a',1,'player::get_nof_cards() const noexcept']]], - ['get_5fnof_5fpredicted_6',['get_nof_predicted',['../classplayer.html#a40333c302ff51707749c544930fb80aa',1,'player']]], - ['get_5fnof_5ftricks_7',['get_nof_tricks',['../classplayer.html#a5e3d1374aee685b08a29d0ac7cec3df4',1,'player']]], - ['get_5fnumber_5fof_5fremaining_5fcards_8',['get_number_of_remaining_cards',['../classdeck.html#ae1c7a4174108a14cb1180de1afdcb6d6',1,'deck']]], - ['get_5fplayer_5fname_9',['get_player_name',['../classplayer.html#a42d01dcf4cdbd452fc5dcaf5e6f21773',1,'player']]], - ['get_5fscores_10',['get_scores',['../classplayer.html#aef5c25a02a2fdbdb4d8270582faf5dac',1,'player']]], - ['get_5ftrick_5fcolor_11',['get_trick_color',['../classtrick.html#a41f315804ac73454c8e41438da20a9c3',1,'trick']]], - ['get_5ftrump_5fcolor_12',['get_trump_color',['../classtrick.html#a69c49e2968abb235a6c7148cb05b0e64',1,'trick']]], - ['get_5fvalue_13',['get_value',['../classcard.html#a2baf8dfef09ac8c1a67b34c2e67186c3',1,'card']]] + ['finish_5fgame_0',['finish_game',['../classgame__state.html#a67fdd4b5682715cd2d848031a9911b17',1,'game_state']]], + ['from_5fjson_1',['from_json',['../classcard.html#a48593187c9bff442d61f197991954011',1,'card::from_json()'],['../classdeck.html#abe8dbe828189696c22f35ac3ed4fd296',1,'deck::from_json()'],['../classtrick.html#a1a3d94f638672d3d60d596190ae59dfb',1,'trick::from_json()'],['../classgame__state.html#a794d484961c92b5b737586ec5599963f',1,'game_state::from_json()'],['../classhand.html#aa9cffdf932d80c7304a335074403e785',1,'hand::from_json()'],['../classplayer.html#a5955c5f26db6a08862ccfb443fbe99c5',1,'player::from_json()']]] ]; diff --git a/html/search/functions_5.js b/html/search/functions_5.js index 1f77831..3feebe2 100644 --- a/html/search/functions_5.js +++ b/html/search/functions_5.js @@ -1,4 +1,28 @@ var searchData= [ - ['hand_0',['hand',['../classhand.html#ae8d7de2589266f57271ac191dab8cd64',1,'hand::hand()'],['../classhand.html#afb908b5b24b92eec58c6d39739093a84',1,'hand::hand(const std::string &id, const std::vector< card * > &cards)'],['../classhand.html#a4820b774c5446b60f74c6458691d1de8',1,'hand::hand(const std::string &id)']]] + ['game_5fstate_0',['game_state',['../classgame__state.html#a0c10b830e222d726557c3c33685c595a',1,'game_state']]], + ['get_5fcards_1',['get_cards',['../classhand.html#ad104b0376b1a13d987f349dd524ca47f',1,'hand']]], + ['get_5fcards_5fand_5fplayers_2',['get_cards_and_players',['../classtrick.html#a1d75f9e8fc94fd122adfc39a20089268',1,'trick']]], + ['get_5fcolor_3',['get_color',['../classcard.html#ab033bc0e71b09d3cf3ac28c2f1fbde18',1,'card']]], + ['get_5fcurrent_5fplayer_4',['get_current_player',['../classgame__state.html#a2d16f420a8aa651685461a5efb8bb600',1,'game_state']]], + ['get_5fgame_5fid_5',['get_game_id',['../classplayer.html#afeb6c5483a59042fcc4a3a2aed6a6a2c',1,'player']]], + ['get_5fhand_6',['get_hand',['../classplayer.html#af333dcbf7123726c9bda3ab94ba9ee6d',1,'player']]], + ['get_5flast_5ftrick_7',['get_last_trick',['../classgame__state.html#a4327f753f1f5341f9fe3774ea3fbc99b',1,'game_state']]], + ['get_5fmax_5fround_5fnumber_8',['get_max_round_number',['../classgame__state.html#aa75c4da6c0056e48e5040be8127d7473',1,'game_state']]], + ['get_5fnof_5fcards_9',['get_nof_cards',['../classhand.html#adc90d109b7b564a0dbca0b0798c99641',1,'hand::get_nof_cards()'],['../classplayer.html#a457c5ab90b0ecd610eead66b41c8333a',1,'player::get_nof_cards() const noexcept']]], + ['get_5fnof_5fpredicted_10',['get_nof_predicted',['../classplayer.html#a40333c302ff51707749c544930fb80aa',1,'player']]], + ['get_5fnof_5ftricks_11',['get_nof_tricks',['../classplayer.html#a5e3d1374aee685b08a29d0ac7cec3df4',1,'player']]], + ['get_5fnumber_5fof_5fremaining_5fcards_12',['get_number_of_remaining_cards',['../classdeck.html#ae1c7a4174108a14cb1180de1afdcb6d6',1,'deck']]], + ['get_5fplayer_5fname_13',['get_player_name',['../classplayer.html#a42d01dcf4cdbd452fc5dcaf5e6f21773',1,'player']]], + ['get_5fplayers_14',['get_players',['../classgame__state.html#abcaccd551f938f961d12266e34c037d2',1,'game_state']]], + ['get_5fround_5fnumber_15',['get_round_number',['../classgame__state.html#ab3ef836a1b3a1e2bc9e429a018c72eca',1,'game_state']]], + ['get_5fscores_16',['get_scores',['../classplayer.html#aef5c25a02a2fdbdb4d8270582faf5dac',1,'player']]], + ['get_5fstarting_5fplayer_17',['get_starting_player',['../classgame__state.html#af4c553229260e307ff1f78dd0c74506d',1,'game_state']]], + ['get_5ftrick_18',['get_trick',['../classgame__state.html#a472fd1721c7cc9e3689394f18c767bf9',1,'game_state']]], + ['get_5ftrick_5fcolor_19',['get_trick_color',['../classtrick.html#a41f315804ac73454c8e41438da20a9c3',1,'trick']]], + ['get_5ftrick_5festimate_5fsum_20',['get_trick_estimate_sum',['../classgame__state.html#aa5263d03c85bce1e9d252e9017cbe282',1,'game_state']]], + ['get_5ftrick_5fnumber_21',['get_trick_number',['../classgame__state.html#a3fce12f31ad0aab82b0d2da90e3e8e15',1,'game_state']]], + ['get_5ftrick_5fstarting_5fplayer_22',['get_trick_starting_player',['../classgame__state.html#aa40554d105939c5dce934daaa858c242',1,'game_state']]], + ['get_5ftrump_5fcolor_23',['get_trump_color',['../classtrick.html#a69c49e2968abb235a6c7148cb05b0e64',1,'trick::get_trump_color()'],['../classgame__state.html#abdf6c5116ed643773d676c90a05e6fe4',1,'game_state::get_trump_color()']]], + ['get_5fvalue_24',['get_value',['../classcard.html#a2baf8dfef09ac8c1a67b34c2e67186c3',1,'card']]] ]; diff --git a/html/search/functions_6.js b/html/search/functions_6.js index 0b819aa..1f77831 100644 --- a/html/search/functions_6.js +++ b/html/search/functions_6.js @@ -1,4 +1,4 @@ var searchData= [ - ['is_5fempty_0',['is_empty',['../classdeck.html#a6aef528ff7b9c608863cc77c19b7882d',1,'deck']]] + ['hand_0',['hand',['../classhand.html#ae8d7de2589266f57271ac191dab8cd64',1,'hand::hand()'],['../classhand.html#afb908b5b24b92eec58c6d39739093a84',1,'hand::hand(const std::string &id, const std::vector< card * > &cards)'],['../classhand.html#a4820b774c5446b60f74c6458691d1de8',1,'hand::hand(const std::string &id)']]] ]; diff --git a/html/search/functions_7.js b/html/search/functions_7.js index 359e7cf..81a7bd1 100644 --- a/html/search/functions_7.js +++ b/html/search/functions_7.js @@ -1,4 +1,9 @@ var searchData= [ - ['player_0',['player',['../classplayer.html#a1f0916939a8caa2e7140d5c89a6aa718',1,'player::player(const std::string &name)'],['../classplayer.html#aa97dd36228b56912bc5dad63f64e1ccf',1,'player::player(const std::string &id, const std::string &name)']]] + ['is_5fempty_0',['is_empty',['../classdeck.html#a6aef528ff7b9c608863cc77c19b7882d',1,'deck']]], + ['is_5festimation_5fphase_1',['is_estimation_phase',['../classgame__state.html#a88d19342ee76acc4660b3e56e8c126eb',1,'game_state']]], + ['is_5ffinished_2',['is_finished',['../classgame__state.html#a9b83de8a89e3bb506184492d22c3cf45',1,'game_state']]], + ['is_5ffull_3',['is_full',['../classgame__state.html#ae161c283e275a57d71834754d11e9e40',1,'game_state']]], + ['is_5fplayer_5fin_5fgame_4',['is_player_in_game',['../classgame__state.html#a371d6a6d84395b90c15d84549b05d553',1,'game_state']]], + ['is_5fstarted_5',['is_started',['../classgame__state.html#aa0092c41779f38eba5e921e43b38559c',1,'game_state']]] ]; diff --git a/html/search/functions_8.js b/html/search/functions_8.js index e4b1cc6..29e7df5 100644 --- a/html/search/functions_8.js +++ b/html/search/functions_8.js @@ -1,4 +1,5 @@ var searchData= [ - ['remove_5fcard_0',['remove_card',['../classhand.html#aa466496b7ce0b58dbd63620535430439',1,'hand']]] + ['play_5fcard_0',['play_card',['../classgame__state.html#a6c65d95086a88b8d111de5553e1210ec',1,'game_state']]], + ['player_1',['player',['../classplayer.html#a1f0916939a8caa2e7140d5c89a6aa718',1,'player::player(const std::string &name)'],['../classplayer.html#aa97dd36228b56912bc5dad63f64e1ccf',1,'player::player(const std::string &id, const std::string &name)']]] ]; diff --git a/html/search/functions_9.js b/html/search/functions_9.js index 55acc59..6baee91 100644 --- a/html/search/functions_9.js +++ b/html/search/functions_9.js @@ -1,10 +1,5 @@ var searchData= [ - ['set_5fgame_5fid_0',['set_game_id',['../classplayer.html#aa916eeacf97f00507f412fd91bfe37d4',1,'player']]], - ['set_5fnof_5fpredicted_1',['set_nof_predicted',['../classplayer.html#a1a3ce0ac69cad799641f4d732435c3f7',1,'player']]], - ['set_5fnof_5ftricks_2',['set_nof_tricks',['../classplayer.html#a61aa38ceff0c856b36642c4bc0081433',1,'player']]], - ['set_5fscores_3',['set_scores',['../classplayer.html#af1d7e67eee27af87c01e43508a731bd4',1,'player']]], - ['set_5ftrick_5fcolor_4',['set_trick_color',['../classtrick.html#a0f8c45882691509564ec42efed0d1aaa',1,'trick']]], - ['set_5fup_5fround_5',['set_up_round',['../classtrick.html#ae5b769ed0fc2933c1a44b5e481c18b00',1,'trick']]], - ['setup_5fround_6',['setup_round',['../classdeck.html#a77851e5cb8297849e91a885ed7959de1',1,'deck::setup_round()'],['../classplayer.html#a8cc6464ca3284140c92c6983ee62a299',1,'player::setup_round()']]] + ['remove_5fcard_0',['remove_card',['../classhand.html#aa466496b7ce0b58dbd63620535430439',1,'hand']]], + ['remove_5fplayer_1',['remove_player',['../classgame__state.html#a734fc594d457aa4e6db5bc7467e6442d',1,'game_state']]] ]; diff --git a/html/search/functions_a.js b/html/search/functions_a.js index de9b1cb..fa50738 100644 --- a/html/search/functions_a.js +++ b/html/search/functions_a.js @@ -1,5 +1,12 @@ var searchData= [ - ['trick_0',['trick',['../classtrick.html#a3b0a12789b87d15d9cdc4e5b6f85b47d',1,'trick::trick()'],['../classtrick.html#abb172ad9a476e96a754eea0c33e1eda9',1,'trick::trick(const std::string &id)'],['../classtrick.html#ab756ba7a19c4bf98f0d8456ad0081fc3',1,'trick::trick(const std::string &id, const std::vector< std::pair< card *, player * > > &cards, serializable_value< int > *trick_color, serializable_value< int > *trump_color)'],['../classtrick.html#a3ecb1c5ebe84a300d7388e2846737fa4',1,'trick::trick(int trump)']]], - ['try_5fget_5fcard_1',['try_get_card',['../classhand.html#a0a50cbbb167e6a1d633dd48bc4b695fe',1,'hand']]] + ['set_5fgame_5fid_0',['set_game_id',['../classplayer.html#aa916eeacf97f00507f412fd91bfe37d4',1,'player']]], + ['set_5fnof_5fpredicted_1',['set_nof_predicted',['../classplayer.html#a1a3ce0ac69cad799641f4d732435c3f7',1,'player']]], + ['set_5fnof_5ftricks_2',['set_nof_tricks',['../classplayer.html#a61aa38ceff0c856b36642c4bc0081433',1,'player']]], + ['set_5fscores_3',['set_scores',['../classplayer.html#af1d7e67eee27af87c01e43508a731bd4',1,'player']]], + ['set_5ftrick_4',['set_trick',['../classgame__state.html#a745dd23945b6165470c494b036ac4667',1,'game_state']]], + ['set_5ftrick_5fcolor_5',['set_trick_color',['../classtrick.html#a0f8c45882691509564ec42efed0d1aaa',1,'trick']]], + ['set_5fup_5fround_6',['set_up_round',['../classtrick.html#ae5b769ed0fc2933c1a44b5e481c18b00',1,'trick']]], + ['setup_5fround_7',['setup_round',['../classdeck.html#a77851e5cb8297849e91a885ed7959de1',1,'deck::setup_round()'],['../classgame__state.html#ab520d4076c53f70a68bc19f355243a4d',1,'game_state::setup_round()'],['../classplayer.html#a8cc6464ca3284140c92c6983ee62a299',1,'player::setup_round()']]], + ['start_5fgame_8',['start_game',['../classgame__state.html#a6ca6536eaec3404ff9b1ab39b8df4e67',1,'game_state']]] ]; diff --git a/html/search/functions_b.js b/html/search/functions_b.js index 3c31f71..836aaee 100644 --- a/html/search/functions_b.js +++ b/html/search/functions_b.js @@ -1,6 +1,5 @@ var searchData= [ - ['wrap_5fup_5fround_0',['wrap_up_round',['../classplayer.html#a193bcc63da13e5bc98eb46ed99381302',1,'player']]], - ['wrap_5fup_5ftrick_1',['wrap_up_trick',['../classtrick.html#a384560623ffaf776797948cf35197c73',1,'trick']]], - ['write_5finto_5fjson_2',['write_into_json',['../classcard.html#a7f900b843e44fb18364f32dbe6cdbc7a',1,'card::write_into_json()'],['../classdeck.html#a8d226fe699a36bf462010ba1f744fbeb',1,'deck::write_into_json()'],['../classtrick.html#a97176df194eae794691356cd83292b04',1,'trick::write_into_json()'],['../classhand.html#a505a82447d0ae305dadcc9c4aa54071e',1,'hand::write_into_json()'],['../classplayer.html#a0cf13abfdb6b837faa88eda064bf51dc',1,'player::write_into_json()']]] + ['trick_0',['trick',['../classtrick.html#a3b0a12789b87d15d9cdc4e5b6f85b47d',1,'trick::trick()'],['../classtrick.html#ad55ad2f0462144ee39c0e6d392543a14',1,'trick::trick(const trick &other)'],['../classtrick.html#abb172ad9a476e96a754eea0c33e1eda9',1,'trick::trick(const std::string &id)'],['../classtrick.html#ab756ba7a19c4bf98f0d8456ad0081fc3',1,'trick::trick(const std::string &id, const std::vector< std::pair< card *, player * > > &cards, serializable_value< int > *trick_color, serializable_value< int > *trump_color)'],['../classtrick.html#a3ecb1c5ebe84a300d7388e2846737fa4',1,'trick::trick(int trump)']]], + ['try_5fget_5fcard_1',['try_get_card',['../classhand.html#a0a50cbbb167e6a1d633dd48bc4b695fe',1,'hand']]] ]; diff --git a/html/search/functions_c.js b/html/search/functions_c.js index 81b756a..bbeeecf 100644 --- a/html/search/functions_c.js +++ b/html/search/functions_c.js @@ -1,8 +1,4 @@ var searchData= [ - ['_7ecard_0',['~card',['../classcard.html#ac7a5d8d53e8cc33f5c5a03d8ccb806c4',1,'card']]], - ['_7edeck_1',['~deck',['../classdeck.html#a63a688bda08bfef8d2c37d53523b7b12',1,'deck']]], - ['_7ehand_2',['~hand',['../classhand.html#af3ffc5e5b46f04b14f12a9fc130b220a',1,'hand']]], - ['_7eplayer_3',['~player',['../classplayer.html#a0a62c0208584465db2daa1ac6e15b1ad',1,'player']]], - ['_7etrick_4',['~trick',['../classtrick.html#a22c0b586f1d6c3baeb7bb0e22eb7dfe2',1,'trick']]] + ['update_5fcurrent_5fplayer_0',['update_current_player',['../classgame__state.html#a49851709fcec061d36478ed2fdcc3d9d',1,'game_state']]] ]; diff --git a/html/search/functions_d.js b/html/search/functions_d.js index c588062..86ce831 100644 --- a/html/search/functions_d.js +++ b/html/search/functions_d.js @@ -1,6 +1,6 @@ var searchData= [ - ['normalize_0',['normalize',['../namespacegtest__json__test__utils.html#ada57e0a99abb228db0fae7702c1d9bd8',1,'gtest_json_test_utils']]], - ['normalizeerrormarker_1',['NormalizeErrorMarker',['../namespacegmock__output__test.html#aeeb22f52d3bf1ba7dbda8f8847faa103',1,'gmock_output_test']]], - ['normalizexml_2',['NormalizeXml',['../classgtest__xml__test__utils_1_1_g_test_x_m_l_test_case.html#a2b8aed90eb732e3cc3f0cc333e19a2f0',1,'gtest_xml_test_utils::GTestXMLTestCase']]] + ['wrap_5fup_5fround_0',['wrap_up_round',['../classgame__state.html#ad2e967638043670ebae93dd6ec32e91e',1,'game_state::wrap_up_round()'],['../classplayer.html#a193bcc63da13e5bc98eb46ed99381302',1,'player::wrap_up_round()']]], + ['wrap_5fup_5ftrick_1',['wrap_up_trick',['../classtrick.html#a384560623ffaf776797948cf35197c73',1,'trick']]], + ['write_5finto_5fjson_2',['write_into_json',['../classcard.html#a7f900b843e44fb18364f32dbe6cdbc7a',1,'card::write_into_json()'],['../classdeck.html#a8d226fe699a36bf462010ba1f744fbeb',1,'deck::write_into_json()'],['../classtrick.html#a97176df194eae794691356cd83292b04',1,'trick::write_into_json()'],['../classgame__state.html#a54873cd18b46555915d150a6d8dd6f83',1,'game_state::write_into_json()'],['../classhand.html#a505a82447d0ae305dadcc9c4aa54071e',1,'hand::write_into_json()'],['../classplayer.html#a0cf13abfdb6b837faa88eda064bf51dc',1,'player::write_into_json()']]] ]; diff --git a/html/search/functions_e.js b/html/search/functions_e.js index 5beda73..e493971 100644 --- a/html/search/functions_e.js +++ b/html/search/functions_e.js @@ -1,18 +1,9 @@ var searchData= [ - ['offset_0',['Offset',['../struct_parse_result.html#afbe762766ac21b2aae266105f1dfa643',1,'ParseResult']]], - ['oneto_1',['OneTo',['../namespacegen__gtest__pred__impl.html#ae5bdeaf46789198017dd17875da8b2fe',1,'gen_gtest_pred_impl']]], - ['open_2',['open',['../classsockpp_1_1acceptor.html#a2845e40535435ec835d5d6a3d3f8244e',1,'sockpp::acceptor::open()'],['../classsockpp_1_1acceptor__tmpl.html#af617212c4a2f7d86278397089436d304',1,'sockpp::acceptor_tmpl::open(const addr_t &addr, int queSize=DFLT_QUE_SIZE)'],['../classsockpp_1_1acceptor__tmpl.html#aee9dd4f86b936739c9112a89b5a129d5',1,'sockpp::acceptor_tmpl::open(in_port_t port, int queSize=DFLT_QUE_SIZE)'],['../classsockpp_1_1unix__acceptor.html#a51809079b78eaabe4410ef94a10319e1',1,'sockpp::unix_acceptor::open(const unix_address &addr, int queSize=DFLT_QUE_SIZE)'],['../classsockpp_1_1unix__acceptor.html#a2845e40535435ec835d5d6a3d3f8244e',1,'sockpp::unix_acceptor::open(const sock_address &addr, int queSize=DFLT_QUE_SIZE, bool reuseSock=true)']]], - ['operator_20bool_3',['operator bool',['../classsockpp_1_1socket.html#ab090fd6f825356e4e825ded2e54aa25c',1,'sockpp::socket']]], - ['operator_20booleantype_4',['operator BooleanType',['../struct_parse_result.html#abcd534680e4067ab797b1c6e930ac91c',1,'ParseResult']]], - ['operator_20const_20ch_20_2a_5',['operator const Ch *',['../struct_generic_string_ref.html#a4e652ee3a398d0eb8ece1835d15274d0',1,'GenericStringRef']]], - ['operator_20parseresult_6',['operator ParseResult',['../class_generic_document.html#af9bb8eade3eae0c039161378e8d2923a',1,'GenericDocument']]], - ['operator_21_7',['operator!',['../classsockpp_1_1socket.html#a1f17e96f82251352f49246d7c455d834',1,'sockpp::socket']]], - ['operator_21_3d_8',['operator!=',['../sock__address_8h.html#abb6e29f022d0c571c7b57713251e804d',1,'sockpp']]], - ['operator_2a_9',['operator*',['../structinternal_1_1_diy_fp.html#a9868841f824924cc385ad5163c9c85b3',1,'internal::DiyFp']]], - ['operator_2d_10',['operator-',['../class_generic_member_iterator.html#ae119ae8ed78dbd980f83d367f59a3c94',1,'GenericMemberIterator']]], - ['operator_3c_3c_11',['operator<<',['../inet6__address_8h.html#a07e6a852b6aac41fcb6ea9660c4811dd',1,'sockpp::operator<<(std::ostream &os, const inet6_address &addr)'],['../inet__address_8h.html#aee3525ccc1b208bbc9ead201fb999487',1,'sockpp::operator<<(std::ostream &os, const inet_address &addr)'],['../unix__address_8h.html#a89677ccf3208c4d51e4e6a736de96d6a',1,'sockpp::operator<<(std::ostream &os, const unix_address &addr)']]], - ['operator_3d_12',['operator=',['../class_generic_member.html#ad7b635007819683babe224004a54396a',1,'GenericMember::operator=()'],['../class_generic_value.html#ad7502bbfcd0c14f7ece07243d56e2b90',1,'GenericValue::operator=(GenericValue &rhs) RAPIDJSON_NOEXCEPT'],['../class_generic_value.html#a2b7837d3adb6c0ad184269826ea78e97',1,'GenericValue::operator=(StringRefType str) RAPIDJSON_NOEXCEPT'],['../class_generic_pointer.html#ae1b46fbcab2c8557825f7be842acbfe7',1,'GenericPointer::operator=()'],['../classsockpp_1_1acceptor.html#a531602eef6543f73ac8077428e036be7',1,'sockpp::acceptor::operator=()'],['../classsockpp_1_1acceptor__tmpl.html#ae7983e619f6637ad1d357351107033f9',1,'sockpp::acceptor_tmpl::operator=()'],['../classsockpp_1_1connector.html#ac6d5a60debdad987ae4975044ab6ed10',1,'sockpp::connector::operator=()'],['../classsockpp_1_1connector__tmpl.html#a8cdb8159fdba0ba6f2b4bb6e6c917813',1,'sockpp::connector_tmpl::operator=()'],['../classsockpp_1_1datagram__socket.html#a19c9e976d2ed63c8423255454a065a89',1,'sockpp::datagram_socket::operator=()'],['../classsockpp_1_1datagram__socket__tmpl.html#a1658ac60da38d6369a77944cf4bbea69',1,'sockpp::datagram_socket_tmpl::operator=()'],['../classsockpp_1_1socket.html#a78f523e7dee2703bff949b6665aff9a8',1,'sockpp::socket::operator=()'],['../classsockpp_1_1stream__socket.html#a1fd201c4664c96a2950d70f2c9e27cf0',1,'sockpp::stream_socket::operator=()'],['../classsockpp_1_1stream__socket__tmpl.html#afef397fb856c8a0535eaa3d5e6f90cd1',1,'sockpp::stream_socket_tmpl::operator=()']]], - ['operator_3d_3d_13',['operator==',['../sock__address_8h.html#a24233e1656d220569ef7fab5cd1fd24d',1,'sockpp']]], - ['operator_5b_5d_14',['operator[]',['../classsockpp_1_1inet6__address.html#adfe07e9d924b5c5896d39e5e89f883d5',1,'sockpp::inet6_address::operator[]()'],['../classsockpp_1_1inet__address.html#aa942effb35a0829bb699265685319189',1,'sockpp::inet_address::operator[]()']]] + ['_7ecard_0',['~card',['../classcard.html#ac7a5d8d53e8cc33f5c5a03d8ccb806c4',1,'card']]], + ['_7edeck_1',['~deck',['../classdeck.html#a63a688bda08bfef8d2c37d53523b7b12',1,'deck']]], + ['_7egame_5fstate_2',['~game_state',['../classgame__state.html#a2fbc370f93617298719f61514afdb5bc',1,'game_state']]], + ['_7ehand_3',['~hand',['../classhand.html#af3ffc5e5b46f04b14f12a9fc130b220a',1,'hand']]], + ['_7eplayer_4',['~player',['../classplayer.html#a0a62c0208584465db2daa1ac6e15b1ad',1,'player']]], + ['_7etrick_5',['~trick',['../classtrick.html#a22c0b586f1d6c3baeb7bb0e22eb7dfe2',1,'trick']]] ]; diff --git a/html/search/searchdata.js b/html/search/searchdata.js index 6dddf78..49b6a8e 100644 --- a/html/search/searchdata.js +++ b/html/search/searchdata.js @@ -2,7 +2,7 @@ var indexSectionsWithContent = { 0: "1234abcdefghijlmnoprstuw~🚀", 1: "bcdefghijlmprstuw", - 2: "acdfghiprstw~", + 2: "acdefghiprstuw~", 3: "epsw" }; diff --git a/html/trick_8h_source.html b/html/trick_8h_source.html index ce083f5..53b4f9e 100644 --- a/html/trick_8h_source.html +++ b/html/trick_8h_source.html @@ -118,60 +118,62 @@ $(function(){ initResizable(false); }); <div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span><span class="comment">// constructor and destructors</span></div> <div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> <a class="code hl_function" href="classtrick.html#a3b0a12789b87d15d9cdc4e5b6f85b47d">trick</a>();</div> <div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> </div> -<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> <span class="keyword">explicit</span> <a class="code hl_function" href="classtrick.html#a3b0a12789b87d15d9cdc4e5b6f85b47d">trick</a>(<span class="keyword">const</span> std::string& <span class="keywordtype">id</span>);</div> +<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> <a class="code hl_function" href="classtrick.html#a3b0a12789b87d15d9cdc4e5b6f85b47d">trick</a>(<span class="keyword">const</span> <a class="code hl_class" href="classtrick.html">trick</a> &other);</div> <div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> </div> -<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> <a class="code hl_function" href="classtrick.html#a3b0a12789b87d15d9cdc4e5b6f85b47d">trick</a>(<span class="keyword">const</span> std::string& <span class="keywordtype">id</span>,</div> -<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> <span class="keyword">const</span> std::vector<std::pair<card*, player*>> &cards,</div> -<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<int></a>* trick_color,</div> -<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<int></a>* trump_color);</div> -<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> </div> -<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> <span class="keyword">explicit</span> <a class="code hl_function" href="classtrick.html#a3b0a12789b87d15d9cdc4e5b6f85b47d">trick</a>(<span class="keywordtype">int</span> trump);</div> +<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> <span class="keyword">explicit</span> <a class="code hl_function" href="classtrick.html#a3b0a12789b87d15d9cdc4e5b6f85b47d">trick</a>(<span class="keyword">const</span> std::string& <span class="keywordtype">id</span>);</div> +<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> </div> +<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> <a class="code hl_function" href="classtrick.html#a3b0a12789b87d15d9cdc4e5b6f85b47d">trick</a>(<span class="keyword">const</span> std::string& <span class="keywordtype">id</span>,</div> +<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> <span class="keyword">const</span> std::vector<std::pair<card*, player*>> &cards,</div> +<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<int></a>* trick_color,</div> +<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> <a class="code hl_class" href="classserializable__value.html">serializable_value<int></a>* trump_color);</div> <div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> </div> -<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> <a class="code hl_function" href="classtrick.html#a22c0b586f1d6c3baeb7bb0e22eb7dfe2">~trick</a>() <span class="keyword">override</span>;</div> -<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> </div> -<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span><span class="comment">// accessors</span></div> -<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> [[nodiscard]] <span class="keywordtype">int</span> <a class="code hl_function" href="classtrick.html#a41f315804ac73454c8e41438da20a9c3">get_trick_color</a>() <span class="keyword">const</span>;</div> -<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> </div> -<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> [[nodiscard]] std::vector<std::pair<card*, player*>> <a class="code hl_function" href="classtrick.html#a1d75f9e8fc94fd122adfc39a20089268">get_cards_and_players</a>() <span class="keyword">const</span>;</div> +<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> <span class="keyword">explicit</span> <a class="code hl_function" href="classtrick.html#a3b0a12789b87d15d9cdc4e5b6f85b47d">trick</a>(<span class="keywordtype">int</span> trump);</div> +<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> </div> +<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> <a class="code hl_function" href="classtrick.html#a22c0b586f1d6c3baeb7bb0e22eb7dfe2">~trick</a>() <span class="keyword">override</span>;</div> +<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> </div> +<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span><span class="comment">// accessors</span></div> +<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> [[nodiscard]] <span class="keywordtype">int</span> <a class="code hl_function" href="classtrick.html#a41f315804ac73454c8e41438da20a9c3">get_trick_color</a>() <span class="keyword">const</span>;</div> <div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span> </div> -<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> [[nodiscard]] <span class="keywordtype">int</span> <a class="code hl_function" href="classtrick.html#a69c49e2968abb235a6c7148cb05b0e64">get_trump_color</a>() <span class="keyword">const</span>;</div> +<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> [[nodiscard]] std::vector<std::pair<card*, player*>> <a class="code hl_function" href="classtrick.html#a1d75f9e8fc94fd122adfc39a20089268">get_cards_and_players</a>() <span class="keyword">const</span>;</div> <div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> </div> -<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span><span class="preprocessor">#ifdef WIZARD_SERVER</span></div> -<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span><span class="comment">// state update functions</span></div> -<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classtrick.html#ae5b769ed0fc2933c1a44b5e481c18b00">set_up_round</a>(<span class="keywordtype">int</span> trump, std::string& err);</div> -<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span> </div> -<div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span> <a class="code hl_class" href="classplayer.html">player</a>* <a class="code hl_function" href="classtrick.html#a384560623ffaf776797948cf35197c73">wrap_up_trick</a>(std::string& err) <span class="keyword">const</span>;</div> -<div class="line"><a id="l00114" name="l00114"></a><span class="lineno"> 114</span> </div> -<div class="line"><a id="l00126" name="l00126"></a><span class="lineno"> 126</span> <span class="keywordtype">bool</span> <a class="code hl_function" href="classtrick.html#a2d3b5aa88a1469dc3d58f30885752f5d">add_card</a>(<a class="code hl_class" href="classcard.html">card</a>* played_card, <a class="code hl_class" href="classplayer.html">player</a>* current_player, std::string& err);</div> -<div class="line"><a id="l00127" name="l00127"></a><span class="lineno"> 127</span> </div> -<div class="line"><a id="l00128" name="l00128"></a><span class="lineno"> 128</span><span class="comment">// server setter</span></div> -<div class="line"><a id="l00133" name="l00133"></a><span class="lineno"> 133</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classtrick.html#a0f8c45882691509564ec42efed0d1aaa">set_trick_color</a>(<span class="keywordtype">int</span> color) <span class="keyword">const</span>;</div> -<div class="line"><a id="l00134" name="l00134"></a><span class="lineno"> 134</span><span class="preprocessor">#endif</span></div> -<div class="line"><a id="l00135" name="l00135"></a><span class="lineno"> 135</span> </div> -<div class="line"><a id="l00136" name="l00136"></a><span class="lineno"> 136</span><span class="comment">// serializable interface</span></div> -<div class="line"><a id="l00142" name="l00142"></a><span class="lineno"> 142</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classtrick.html#a97176df194eae794691356cd83292b04">write_into_json</a>(rapidjson::Value& json, rapidjson::Document::AllocatorType& allocator) <span class="keyword">const override</span>;</div> -<div class="line"><a id="l00143" name="l00143"></a><span class="lineno"> 143</span> </div> -<div class="line"><a id="l00149" name="l00149"></a><span class="lineno"> 149</span> <span class="keyword">static</span> <a class="code hl_class" href="classtrick.html">trick</a>* <a class="code hl_function" href="classtrick.html#a1a3d94f638672d3d60d596190ae59dfb">from_json</a>(<span class="keyword">const</span> rapidjson::Value& json);</div> -<div class="line"><a id="l00150" name="l00150"></a><span class="lineno"> 150</span> </div> -<div class="line"><a id="l00151" name="l00151"></a><span class="lineno"> 151</span>};</div> +<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> [[nodiscard]] <span class="keywordtype">int</span> <a class="code hl_function" href="classtrick.html#a69c49e2968abb235a6c7148cb05b0e64">get_trump_color</a>() <span class="keyword">const</span>;</div> +<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span> </div> +<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span><span class="preprocessor">#ifdef WIZARD_SERVER</span></div> +<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span><span class="comment">// state update functions</span></div> +<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classtrick.html#ae5b769ed0fc2933c1a44b5e481c18b00">set_up_round</a>(<span class="keywordtype">int</span> trump, std::string& err);</div> +<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span> </div> +<div class="line"><a id="l00119" name="l00119"></a><span class="lineno"> 119</span> <a class="code hl_class" href="classplayer.html">player</a>* <a class="code hl_function" href="classtrick.html#a384560623ffaf776797948cf35197c73">wrap_up_trick</a>(std::string& err) <span class="keyword">const</span>;</div> +<div class="line"><a id="l00120" name="l00120"></a><span class="lineno"> 120</span> </div> +<div class="line"><a id="l00132" name="l00132"></a><span class="lineno"> 132</span> <span class="keywordtype">bool</span> <a class="code hl_function" href="classtrick.html#a2d3b5aa88a1469dc3d58f30885752f5d">add_card</a>(<a class="code hl_class" href="classcard.html">card</a>* played_card, <a class="code hl_class" href="classplayer.html">player</a>* current_player, std::string& err);</div> +<div class="line"><a id="l00133" name="l00133"></a><span class="lineno"> 133</span> </div> +<div class="line"><a id="l00134" name="l00134"></a><span class="lineno"> 134</span><span class="comment">// server setter</span></div> +<div class="line"><a id="l00139" name="l00139"></a><span class="lineno"> 139</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classtrick.html#a0f8c45882691509564ec42efed0d1aaa">set_trick_color</a>(<span class="keywordtype">int</span> color) <span class="keyword">const</span>;</div> +<div class="line"><a id="l00140" name="l00140"></a><span class="lineno"> 140</span><span class="preprocessor">#endif</span></div> +<div class="line"><a id="l00141" name="l00141"></a><span class="lineno"> 141</span> </div> +<div class="line"><a id="l00142" name="l00142"></a><span class="lineno"> 142</span><span class="comment">// serializable interface</span></div> +<div class="line"><a id="l00148" name="l00148"></a><span class="lineno"> 148</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classtrick.html#a97176df194eae794691356cd83292b04">write_into_json</a>(rapidjson::Value& json, rapidjson::Document::AllocatorType& allocator) <span class="keyword">const override</span>;</div> +<div class="line"><a id="l00149" name="l00149"></a><span class="lineno"> 149</span> </div> +<div class="line"><a id="l00155" name="l00155"></a><span class="lineno"> 155</span> <span class="keyword">static</span> <a class="code hl_class" href="classtrick.html">trick</a>* <a class="code hl_function" href="classtrick.html#a1a3d94f638672d3d60d596190ae59dfb">from_json</a>(<span class="keyword">const</span> rapidjson::Value& json);</div> +<div class="line"><a id="l00156" name="l00156"></a><span class="lineno"> 156</span> </div> +<div class="line"><a id="l00157" name="l00157"></a><span class="lineno"> 157</span>};</div> </div> -<div class="line"><a id="l00152" name="l00152"></a><span class="lineno"> 152</span> </div> -<div class="line"><a id="l00153" name="l00153"></a><span class="lineno"> 153</span><span class="preprocessor">#endif </span><span class="comment">//WIZARD_TRICK_H</span></div> +<div class="line"><a id="l00158" name="l00158"></a><span class="lineno"> 158</span> </div> +<div class="line"><a id="l00159" name="l00159"></a><span class="lineno"> 159</span><span class="preprocessor">#endif </span><span class="comment">//WIZARD_TRICK_H</span></div> <div class="ttc" id="aclasscard_html"><div class="ttname"><a href="classcard.html">card</a></div><div class="ttdoc">Represents a card in the game.</div><div class="ttdef"><b>Definition</b> card.h:15</div></div> <div class="ttc" id="aclassplayer_html"><div class="ttname"><a href="classplayer.html">player</a></div><div class="ttdoc">Represents a player in the game.</div><div class="ttdef"><b>Definition</b> player.h:18</div></div> <div class="ttc" id="aclassserializable__value_html"><div class="ttname"><a href="classserializable__value.html">serializable_value</a></div><div class="ttdef"><b>Definition</b> serializable_value.h:27</div></div> <div class="ttc" id="aclasstrick_html"><div class="ttname"><a href="classtrick.html">trick</a></div><div class="ttdoc">Represents the trick in the game.</div><div class="ttdef"><b>Definition</b> trick.h:28</div></div> -<div class="ttc" id="aclasstrick_html_a0f8c45882691509564ec42efed0d1aaa"><div class="ttname"><a href="classtrick.html#a0f8c45882691509564ec42efed0d1aaa">trick::set_trick_color</a></div><div class="ttdeci">void set_trick_color(int color) const</div><div class="ttdoc">Sets the trick color.</div><div class="ttdef"><b>Definition</b> trick.cpp:142</div></div> -<div class="ttc" id="aclasstrick_html_a1a3d94f638672d3d60d596190ae59dfb"><div class="ttname"><a href="classtrick.html#a1a3d94f638672d3d60d596190ae59dfb">trick::from_json</a></div><div class="ttdeci">static trick * from_json(const rapidjson::Value &json)</div><div class="ttdoc">Deserializes a trick object from a json object.</div><div class="ttdef"><b>Definition</b> trick.cpp:149</div></div> -<div class="ttc" id="aclasstrick_html_a1d75f9e8fc94fd122adfc39a20089268"><div class="ttname"><a href="classtrick.html#a1d75f9e8fc94fd122adfc39a20089268">trick::get_cards_and_players</a></div><div class="ttdeci">std::vector< std::pair< card *, player * > > get_cards_and_players() const</div><div class="ttdoc">Gets the played cards and players who played them as pairs.</div><div class="ttdef"><b>Definition</b> trick.cpp:56</div></div> -<div class="ttc" id="aclasstrick_html_a22c0b586f1d6c3baeb7bb0e22eb7dfe2"><div class="ttname"><a href="classtrick.html#a22c0b586f1d6c3baeb7bb0e22eb7dfe2">trick::~trick</a></div><div class="ttdeci">~trick() override</div><div class="ttdoc">Destructs a trick object.</div><div class="ttdef"><b>Definition</b> trick.cpp:37</div></div> -<div class="ttc" id="aclasstrick_html_a2d3b5aa88a1469dc3d58f30885752f5d"><div class="ttname"><a href="classtrick.html#a2d3b5aa88a1469dc3d58f30885752f5d">trick::add_card</a></div><div class="ttdeci">bool add_card(card *played_card, player *current_player, std::string &err)</div><div class="ttdoc">Adds a card to the trick.</div><div class="ttdef"><b>Definition</b> trick.cpp:124</div></div> -<div class="ttc" id="aclasstrick_html_a384560623ffaf776797948cf35197c73"><div class="ttname"><a href="classtrick.html#a384560623ffaf776797948cf35197c73">trick::wrap_up_trick</a></div><div class="ttdeci">player * wrap_up_trick(std::string &err) const</div><div class="ttdoc">Wraps up a trick at the end of a trick or round.</div><div class="ttdef"><b>Definition</b> trick.cpp:72</div></div> +<div class="ttc" id="aclasstrick_html_a0f8c45882691509564ec42efed0d1aaa"><div class="ttname"><a href="classtrick.html#a0f8c45882691509564ec42efed0d1aaa">trick::set_trick_color</a></div><div class="ttdeci">void set_trick_color(int color) const</div><div class="ttdoc">Sets the trick color.</div><div class="ttdef"><b>Definition</b> trick.cpp:152</div></div> +<div class="ttc" id="aclasstrick_html_a1a3d94f638672d3d60d596190ae59dfb"><div class="ttname"><a href="classtrick.html#a1a3d94f638672d3d60d596190ae59dfb">trick::from_json</a></div><div class="ttdeci">static trick * from_json(const rapidjson::Value &json)</div><div class="ttdoc">Deserializes a trick object from a json object.</div><div class="ttdef"><b>Definition</b> trick.cpp:159</div></div> +<div class="ttc" id="aclasstrick_html_a1d75f9e8fc94fd122adfc39a20089268"><div class="ttname"><a href="classtrick.html#a1d75f9e8fc94fd122adfc39a20089268">trick::get_cards_and_players</a></div><div class="ttdeci">std::vector< std::pair< card *, player * > > get_cards_and_players() const</div><div class="ttdoc">Gets the played cards and players who played them as pairs.</div><div class="ttdef"><b>Definition</b> trick.cpp:66</div></div> +<div class="ttc" id="aclasstrick_html_a22c0b586f1d6c3baeb7bb0e22eb7dfe2"><div class="ttname"><a href="classtrick.html#a22c0b586f1d6c3baeb7bb0e22eb7dfe2">trick::~trick</a></div><div class="ttdeci">~trick() override</div><div class="ttdoc">Destructs a trick object.</div><div class="ttdef"><b>Definition</b> trick.cpp:47</div></div> +<div class="ttc" id="aclasstrick_html_a2d3b5aa88a1469dc3d58f30885752f5d"><div class="ttname"><a href="classtrick.html#a2d3b5aa88a1469dc3d58f30885752f5d">trick::add_card</a></div><div class="ttdeci">bool add_card(card *played_card, player *current_player, std::string &err)</div><div class="ttdoc">Adds a card to the trick.</div><div class="ttdef"><b>Definition</b> trick.cpp:134</div></div> +<div class="ttc" id="aclasstrick_html_a384560623ffaf776797948cf35197c73"><div class="ttname"><a href="classtrick.html#a384560623ffaf776797948cf35197c73">trick::wrap_up_trick</a></div><div class="ttdeci">player * wrap_up_trick(std::string &err) const</div><div class="ttdoc">Wraps up a trick at the end of a trick or round.</div><div class="ttdef"><b>Definition</b> trick.cpp:82</div></div> <div class="ttc" id="aclasstrick_html_a3b0a12789b87d15d9cdc4e5b6f85b47d"><div class="ttname"><a href="classtrick.html#a3b0a12789b87d15d9cdc4e5b6f85b47d">trick::trick</a></div><div class="ttdeci">trick()</div><div class="ttdoc">Constructs a new trick object.</div><div class="ttdef"><b>Definition</b> trick.cpp:10</div></div> -<div class="ttc" id="aclasstrick_html_a41f315804ac73454c8e41438da20a9c3"><div class="ttname"><a href="classtrick.html#a41f315804ac73454c8e41438da20a9c3">trick::get_trick_color</a></div><div class="ttdeci">int get_trick_color() const</div><div class="ttdoc">Gets the trick color.</div><div class="ttdef"><b>Definition</b> trick.cpp:46</div></div> -<div class="ttc" id="aclasstrick_html_a69c49e2968abb235a6c7148cb05b0e64"><div class="ttname"><a href="classtrick.html#a69c49e2968abb235a6c7148cb05b0e64">trick::get_trump_color</a></div><div class="ttdeci">int get_trump_color() const</div><div class="ttdoc">Gets the trump color.</div><div class="ttdef"><b>Definition</b> trick.cpp:51</div></div> -<div class="ttc" id="aclasstrick_html_a97176df194eae794691356cd83292b04"><div class="ttname"><a href="classtrick.html#a97176df194eae794691356cd83292b04">trick::write_into_json</a></div><div class="ttdeci">void write_into_json(rapidjson::Value &json, rapidjson::Document::AllocatorType &allocator) const override</div><div class="ttdoc">Serializes a trick object into a json object.</div><div class="ttdef"><b>Definition</b> trick.cpp:175</div></div> -<div class="ttc" id="aclasstrick_html_ae5b769ed0fc2933c1a44b5e481c18b00"><div class="ttname"><a href="classtrick.html#ae5b769ed0fc2933c1a44b5e481c18b00">trick::set_up_round</a></div><div class="ttdeci">void set_up_round(int trump, std::string &err)</div><div class="ttdoc">Sets up a trick.</div><div class="ttdef"><b>Definition</b> trick.cpp:64</div></div> +<div class="ttc" id="aclasstrick_html_a41f315804ac73454c8e41438da20a9c3"><div class="ttname"><a href="classtrick.html#a41f315804ac73454c8e41438da20a9c3">trick::get_trick_color</a></div><div class="ttdeci">int get_trick_color() const</div><div class="ttdoc">Gets the trick color.</div><div class="ttdef"><b>Definition</b> trick.cpp:56</div></div> +<div class="ttc" id="aclasstrick_html_a69c49e2968abb235a6c7148cb05b0e64"><div class="ttname"><a href="classtrick.html#a69c49e2968abb235a6c7148cb05b0e64">trick::get_trump_color</a></div><div class="ttdeci">int get_trump_color() const</div><div class="ttdoc">Gets the trump color.</div><div class="ttdef"><b>Definition</b> trick.cpp:61</div></div> +<div class="ttc" id="aclasstrick_html_a97176df194eae794691356cd83292b04"><div class="ttname"><a href="classtrick.html#a97176df194eae794691356cd83292b04">trick::write_into_json</a></div><div class="ttdeci">void write_into_json(rapidjson::Value &json, rapidjson::Document::AllocatorType &allocator) const override</div><div class="ttdoc">Serializes a trick object into a json object.</div><div class="ttdef"><b>Definition</b> trick.cpp:185</div></div> +<div class="ttc" id="aclasstrick_html_ae5b769ed0fc2933c1a44b5e481c18b00"><div class="ttname"><a href="classtrick.html#ae5b769ed0fc2933c1a44b5e481c18b00">trick::set_up_round</a></div><div class="ttdeci">void set_up_round(int trump, std::string &err)</div><div class="ttdoc">Sets up a trick.</div><div class="ttdef"><b>Definition</b> trick.cpp:74</div></div> <div class="ttc" id="aclassunique__serializable_html"><div class="ttname"><a href="classunique__serializable.html">unique_serializable</a></div><div class="ttdef"><b>Definition</b> unique_serializable.h:12</div></div> </div><!-- fragment --></div><!-- contents --> <!-- start footer part --> diff --git a/src/common/game_state/game_state.cpp b/src/common/game_state/game_state.cpp index f77a0a2..484cc97 100644 --- a/src/common/game_state/game_state.cpp +++ b/src/common/game_state/game_state.cpp @@ -1,12 +1,11 @@ #include "game_state.h" - #include <vector> #include "../exceptions/WizardException.h" #include "../serialization/vector_utils.h" // from_diff constructor -game_state::game_state(std::string id) : unique_serializable(id) { +game_state::game_state(const std::string& id) : unique_serializable(id) { _players = std::vector<player*>(); _deck = new deck(); _trick = new trick(); @@ -26,8 +25,8 @@ game_state::game_state(std::string id) : unique_serializable(id) { } // deserialization constructor -game_state::game_state(std::string id, std::vector<player*>& players, deck* deck, trick* current_trick, trick* last_trick, - serializable_value<bool>* is_started, serializable_value<bool>* is_finished, +game_state::game_state(const std::string& id, const std::vector<player*>& players, deck* deck, trick* current_trick, + trick* last_trick, serializable_value<bool>* is_started, serializable_value<bool>* is_finished, serializable_value<bool>* is_estimation_phase, serializable_value<int>* round_number, serializable_value<int>* trick_number, serializable_value<int>* starting_player_idx, serializable_value<int>* trick_starting_player_idx, serializable_value<int>* current_player_idx, @@ -52,7 +51,8 @@ game_state::game_state(std::string id, std::vector<player*>& players, deck* deck { } // public constructor -game_state::game_state() : unique_serializable() { +game_state::game_state() : unique_serializable() +{ _players = std::vector<player*>(); _deck = new deck(); _trick = new trick(); @@ -72,15 +72,13 @@ game_state::game_state() : unique_serializable() { } // destructor -game_state::~game_state() { +game_state::~game_state() +{ + _players.clear(); delete _deck; - if(_trick != nullptr) - { - delete _trick; - } - if (_last_trick != nullptr){ - delete _last_trick; - } + delete _trick; + delete _last_trick; + delete _is_started; delete _is_finished; delete _is_estimation_phase; @@ -111,7 +109,8 @@ game_state::~game_state() { } // accessors -player* game_state::get_current_player() const { +player* game_state::get_current_player() const +{ if(_current_player_idx == nullptr || _players.empty()) { return nullptr; } @@ -154,21 +153,23 @@ trick* game_state::get_last_trick() const return _last_trick; } - -bool game_state::is_full() const { +bool game_state::is_full() const +{ return _players.size() == _max_nof_players; } -bool game_state::is_started() const { +bool game_state::is_started() const +{ return _is_started->get_value(); } -bool game_state::is_finished() const { +bool game_state::is_finished() const +{ return _is_finished->get_value(); } - -int game_state::get_round_number() const { +int game_state::get_round_number() const +{ return _round_number->get_value(); } @@ -182,296 +183,303 @@ int game_state::get_trick_estimate_sum() const return _trick_estimate_sum->get_value(); } -int game_state::get_max_round_number() const { +unsigned int game_state::get_max_round_number() const +{ return 60 / _players.size(); } -int game_state::get_player_index(player *player) const { - auto it = std::ranges::find(_players, player); - if (it == _players.end()) { - return -1; - } else { - return it - _players.begin(); - } -} - -bool game_state::is_player_in_game(player *player) const { +bool game_state::is_player_in_game(player *player) const +{ return std::ranges::find(_players, player) < _players.end(); } -std::vector<player*>& game_state::get_players() { +std::vector<player*>& game_state::get_players() +{ return _players; } -void game_state::set_trick(trick* new_trick) { +void game_state::set_trick(trick* new_trick) +{ if(new_trick != nullptr){ delete _trick; _trick = new_trick; } } - - - -//TODO: remove // before ifdef and endif below (if it is still there otherwise ignore this) #ifdef WIZARD_SERVER +// private functions used on server side +int game_state::get_player_index(player *player) const +{ + if (const auto it = std::ranges::find(_players, player); it == _players.end()) { + return -1; + } else { + return it - _players.begin(); + } +} -// state modification functions without diff - - void game_state::wrap_up_round(std::string& err){ - _starting_player_idx->set_value((_starting_player_idx->get_value() + 1) % _players.size()); - - for (auto & player : _players) { - player->wrap_up_round(); +void game_state::determine_trump_color() const +{ + if(_round_number->get_value() * _players.size() == 60) { + _trump_color->set_value(0); // there is no trump since it is the last round + } else { + card* trump_card = _deck->draw_trump(); + if (trump_card->get_color() != 0){ + _trump_color->set_value(trump_card->get_color()); + } + else if (trump_card->get_value() == 0) { //jester + _trump_color->set_value(0); } - if (_round_number->get_value() == get_max_round_number() - 1) { - finish_game(err); + else if (trump_card->get_value() == 14){ //wizard + // for now: just randomly generates number + std::random_device rd; + std::mt19937 gen(rd()); + std::uniform_int_distribution<> distrib(1, 4); + _trump_color->set_value(distrib(gen)); + // TODO: include get trump_color_request() } } +} - bool game_state::update_current_player(std::string& err){ - _current_player_idx->set_value((_current_player_idx->get_value() + 1) % _players.size()); +// return true if this card can be played according to the game rules (checked in that order): +// if there is no trick color yet (trick color is 0) or a wizard has set the trick color (-1), then the card can be played +// if the card is a jester or wizard, then it can be played +// it the card has the same color as the trick color, it can be played +// if the card does not have the same color as the trick color, it can only be played if no other card +// on the players hand has the same color as the trick color +bool game_state::can_be_played(player* player, const card* card, std::string& err) const noexcept +{ + // get trick color -> if 0, card can be played + int trick_color = _trick->get_trick_color(); + int card_value = card->get_value(); + int card_color = card->get_color(); - //if current player is last player of round, switch from estimation to playing or end round and send callback to game_state - if (_current_player_idx->get_value() == _trick_starting_player_idx->get_value()) { - if (_is_estimation_phase->get_value() == true) { - _is_estimation_phase->set_value(false); - } else { - //determine trick winner - player* winner = _trick->wrap_up_trick(err); - winner->set_nof_tricks(winner->get_nof_tricks() + 1); - - // round has not ended yet - if (_trick_number->get_value() < _round_number->get_value()){ - _trick_number->set_value(_trick_number->get_value() + 1); - if (_trick != nullptr) { - delete _last_trick; - _last_trick = new trick(*_trick); - } - _trick->set_up_round(_trump_color->get_value(), err); - - // winner of trick is starting player of next trick - int winner_index = get_player_index(winner); - if(winner_index == -1){ - err = "Player is not part of the game!"; - return false; - } else { - _trick_starting_player_idx->set_value(winner_index); - _current_player_idx->set_value(winner_index); - } - } else { - wrap_up_round(err); - _round_number->set_value(_round_number->get_value() + 1); - setup_round(err); - } - } - } + // everything can be played if no trick color yet or a wizard has set the trick color + if (trick_color == 0 || trick_color == -1) { return true; } - void game_state::determine_trump_color() { - if(_round_number->get_value() * _players.size() == 60) { - _trump_color->set_value(0); // there is no trump since it is the last round - } else { - card* trump_card = _deck->draw_trump(); - if (trump_card->get_color() != 0){ - _trump_color->set_value(trump_card->get_color()); - } - else if (trump_card->get_value() == 0) { //jester - _trump_color->set_value(0); - } - else if (trump_card->get_value() == 14){ //wizard - // for now: just randomly generates number - std::random_device rd; - std::mt19937 gen(rd()); - std::uniform_int_distribution<> distrib(1, 4); - _trump_color->set_value(distrib(gen)); - // TODO: include get trump_color_request() - } - } + // check if card is wizard or jester -> if yes, card can be played + if (card_value == 0 || card_value == 14) { + return true; } - void game_state::setup_round(std::string &err) { - - _trick_estimate_sum->set_value(0); - _is_estimation_phase->set_value(true); - _trick_number->set_value(0); //tricks numbers start by 0 - _trick_starting_player_idx->set_value(_starting_player_idx->get_value()); - _current_player_idx->set_value(_starting_player_idx->get_value()); - - _deck->setup_round(); - for (auto & player : _players) { - player->setup_round(); - _deck->draw_cards(player, _round_number->get_value() + 1, err); - } - determine_trump_color(); - if (_trick != nullptr) { - delete _last_trick; - _last_trick = new trick(*_trick); - } - _trick->set_up_round(_trump_color->get_value(), err); + // compare card color with trick color -> if same, can be played + if (card_color == trick_color) { + return true; } - bool game_state::start_game(std::string &err) { - if (_players.size() < _min_nof_players) { - err = "You need at least " + std::to_string(_min_nof_players) + " players to start the game."; - return false; - } - if (!_is_started->get_value()) { - _is_started->set_value(true); - setup_round(err); - return true; - } else { - err = "Could not start game, as the game was already started"; + // if card does not have trick color, check other cards on hand + auto cards = player->get_hand()->get_cards(); + for (const auto & c : cards) { + if (c->get_color() == trick_color && c->get_value() != card_value) { + err = "You can't play this card because you have another card which fits the trick color"; return false; } } - int game_state::get_number_of_turns(){ - int nof_players = this->_players.size(); + return true; +} + +unsigned int game_state::get_number_of_turns() const +{ + const unsigned int nof_players = this->_players.size(); - if (this->_current_player_idx->get_value() >= this->_starting_player_idx->get_value()) { + if (this->_current_player_idx->get_value() >= this->_starting_player_idx->get_value()) { return (this->_current_player_idx->get_value() - this->_starting_player_idx->get_value() + 1); //in first round 0 - } - else{ + } + else{ return (this->_current_player_idx->get_value() - this->_starting_player_idx->get_value() + nof_players) % nof_players + 1; - } } +} - bool game_state::estimate_tricks(player *player, std::string &err, int trick_estimate){ - - if (trick_estimate > get_round_number() + 1) { - err = "Trick estimate is too big. You can't win more tricks than cards in your hand."; - return false; - } - if (trick_estimate < 0) { - err = "Trick estimate is too small. You can't win less than 0 tricks."; - return false; - } - if(get_number_of_turns() == this->_players.size() && - trick_estimate + _trick_estimate_sum->get_value() == _round_number->get_value() + 1) { - err = "The tricks can't add up to the exact number of cards in the round. Please either choose a higher or lower number of tricks."; - return false; - } +// state modification functions without diff +void game_state::wrap_up_round(std::string& err) +{ + _starting_player_idx->set_value((_starting_player_idx->get_value() + 1) % _players.size()); - player->set_nof_predicted(trick_estimate); - _trick_estimate_sum->set_value(trick_estimate + _trick_estimate_sum->get_value()); - return update_current_player(err); //handles logic to switch from estimation to playing round etc. + for (const auto & player : _players) { + player->wrap_up_round(); } + if (_round_number->get_value() == get_max_round_number() - 1) { + finish_game(err); + } +} - // return true if this card can be played according to the game rules (checked in that order): - // if there is no trick color yet (trick color is 0) or a wizard has set the trick color (-1), then the card can be played - // if the card is a jester or wizard, then it can be played - // it the card has the same color as the trick color, it can be played - // if the card does not have the same color as the trick color, it can only be played if no other card - // on the players hand has the same color as the trick color - bool game_state::can_be_played(player* player, const card* card, std::string& err) const noexcept { - - // get trick color -> if 0, card can be played - int trick_color = _trick->get_trick_color(); - int card_value = card->get_value(); - int card_color = card->get_color(); - - // everything can be played if no trick color yet or a wizard has set the trick color - if (trick_color == 0 || trick_color == -1) { - return true; - } +bool game_state::update_current_player(std::string& err) +{ + _current_player_idx->set_value((_current_player_idx->get_value() + 1) % _players.size()); - // check if card is wizard or jester -> if yes, card can be played - if (card_value == 0 || card_value == 14) { - return true; - } + //if current player is last player of round, switch from estimation to playing or end round and send callback to game_state + if (_current_player_idx->get_value() == _trick_starting_player_idx->get_value()) { + if (_is_estimation_phase->get_value() == true) { + _is_estimation_phase->set_value(false); + } else { + //determine trick winner + player* winner = _trick->wrap_up_trick(err); + winner->set_nof_tricks(winner->get_nof_tricks() + 1); + + // round has not ended yet + if (_trick_number->get_value() < _round_number->get_value()){ + _trick_number->set_value(_trick_number->get_value() + 1); + if (_trick != nullptr) { + delete _last_trick; + _last_trick = new trick(*_trick); + } + _trick->set_up_round(_trump_color->get_value(), err); - // compare card color with trick color -> if same, can be played - if (card_color == trick_color) { - return true; + // winner of trick is starting player of next trick + if(const int winner_index = get_player_index(winner); winner_index == -1){ + err = "Player is not part of the game!"; + return false; + } else { + _trick_starting_player_idx->set_value(winner_index); + _current_player_idx->set_value(winner_index); + } + } else { + wrap_up_round(err); + _round_number->set_value(_round_number->get_value() + 1); + setup_round(err); + } } + } + return true; +} - // if card does not have trick color, check other cards on hand - auto cards = player->get_hand()->get_cards(); - for (const auto & c : cards) { - if (c->get_color() == trick_color && c->get_value() != card_value) { - err = "You can't play this card because you have another card which fits the trick color"; - return false; - } - } +void game_state::setup_round(std::string &err) +{ + + _trick_estimate_sum->set_value(0); + _is_estimation_phase->set_value(true); + _trick_number->set_value(0); //tricks numbers start by 0 + _trick_starting_player_idx->set_value(_starting_player_idx->get_value()); + _current_player_idx->set_value(_starting_player_idx->get_value()); + + _deck->setup_round(); + for (auto & player : _players) { + player->setup_round(); + _deck->draw_cards(player, _round_number->get_value() + 1, err); + } + determine_trump_color(); + if (_trick != nullptr) { + delete _last_trick; + _last_trick = new trick(*_trick); + } + _trick->set_up_round(_trump_color->get_value(), err); +} + +bool game_state::start_game(std::string &err) +{ + if (_players.size() < _min_nof_players) { + err = "You need at least " + std::to_string(_min_nof_players) + " players to start the game."; + return false; + } + if (!_is_started->get_value()) { + _is_started->set_value(true); + setup_round(err); return true; + } else { + err = "Could not start game, as the game was already started"; + return false; } +} - bool game_state::play_card(player* player, const std::string& card_id, std::string& err){ - card* card = nullptr; - if (player->get_hand()->try_get_card(card_id, card) == false) { //also gives us card pointer - err = "This card is not in your hand."; - return false; - } - if (!can_be_played(player, card, err)){ - return false; - } +bool game_state::estimate_tricks(const player *player, std::string &err, const int trick_estimate) +{ + if (trick_estimate > get_round_number() + 1) { + err = "Trick estimate is too big. You can't win more tricks than cards in your hand."; + return false; + } + if (trick_estimate < 0) { + err = "Trick estimate is too small. You can't win less than 0 tricks."; + return false; + } + if(get_number_of_turns() == this->_players.size() && + trick_estimate + _trick_estimate_sum->get_value() == _round_number->get_value() + 1) { + err = "The tricks can't add up to the exact number of cards in the round. Please either choose a higher or lower number of tricks."; + return false; + } - // play card - _trick->add_card(card, player, err); //also sets trick color + player->set_nof_predicted(trick_estimate); + _trick_estimate_sum->set_value(trick_estimate + _trick_estimate_sum->get_value()); + return update_current_player(err); //handles logic to switch from estimation to playing round etc. +} - // adapted remove_card function in hand (doesnt need to save removed card anymore) - player->get_hand()->remove_card(card_id, err); - update_current_player(err); - return true; +bool game_state::play_card(player* player, const std::string& card_id, std::string& err) +{ + card* card = nullptr; + if (player->get_hand()->try_get_card(card_id, card) == false) { //also gives us card pointer + err = "This card is not in your hand."; + return false; + } + if (!can_be_played(player, card, err)){ + return false; } - bool game_state::remove_player(player *player_ptr, std::string &err) { - int idx = get_player_index(player_ptr); - if (idx != -1) { - if (_is_started->get_value() == false) { - if (idx < _current_player_idx->get_value()) { - // reduce current_player_idx if the player who left had a lower index - _current_player_idx->set_value(_current_player_idx->get_value() - 1); - } - _players.erase(_players.begin() + idx); - return true; - } else { - finish_game(err); - return true; + // play card + _trick->add_card(card, player, err); //also sets trick color + + // adapted remove_card function in hand (doesnt need to save removed card anymore) + player->get_hand()->remove_card(card_id, err); + + update_current_player(err); + return true; +} + +bool game_state::remove_player(player *player_ptr, std::string &err) +{ + if (const int idx = get_player_index(player_ptr); idx != -1) { + if (_is_started->get_value() == false) { + if (idx < _current_player_idx->get_value()) { + // reduce current_player_idx if the player who left had a lower index + _current_player_idx->set_value(_current_player_idx->get_value() - 1); } + _players.erase(_players.begin() + idx); + return true; } else { - err = "Could not leave game, as the requested player was not found in that game."; - return false; + finish_game(err); + return true; } + } else { + err = "Could not leave game, as the requested player was not found in that game."; return false; } + return false; +} - bool game_state::add_player(player* player, std::string& err) { - if (_is_started->get_value()) { - err = "Could not join game, because the requested game is already started."; - return false; - } - if (_is_finished->get_value()) { - err = "Could not join game, because the requested game is already finished."; - return false; - } - if (_players.size() >= _max_nof_players) { - err = "Could not join game, because the max number of players is already reached."; - return false; - } - if (std::ranges::find(_players, player) != _players.end()) { - err = "Could not join game, because this player is already subscribed to this game."; - return false; - } - - _players.push_back(player); - return true; +bool game_state::add_player(player* player, std::string& err) +{ + if (_is_started->get_value()) { + err = "Could not join game, because the requested game is already started."; + return false; } - - bool game_state::finish_game(std::string &err) { - _is_finished->set_value(true); - // TODO: part to determine winner of the game, it is done in game controller right now and could stay there. - return true; + if (_is_finished->get_value()) { + err = "Could not join game, because the requested game is already finished."; + return false; + } + if (_players.size() >= _max_nof_players) { + err = "Could not join game, because the max number of players is already reached."; + return false; + } + if (std::ranges::find(_players, player) != _players.end()) { + err = "Could not join game, because this player is already subscribed to this game."; + return false; } -#endif + _players.push_back(player); + return true; +} +bool game_state::finish_game(std::string &err) const +{ + _is_finished->set_value(true); + // TODO: part to determine winner of the game, it is done in game controller right now and could stay there. + return true; +} +#endif -// Serializable interface +// serializable interface void game_state::write_into_json(rapidjson::Value &json, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> &allocator) const { unique_serializable::write_into_json(json, allocator); diff --git a/src/common/game_state/game_state.h b/src/common/game_state/game_state.h index 776370e..2669091 100644 --- a/src/common/game_state/game_state.h +++ b/src/common/game_state/game_state.h @@ -1,52 +1,81 @@ -// all in this block is only included if wizard_game_state_h hasnt already been included to prevent to include twice #ifndef WIZARD_GAME_STATE_H #define WIZARD_GAME_STATE_H #include <vector> -#include <algorithm> #include <ranges> -#include <string> #include "../../rapidjson/include/rapidjson/document.h" #include "player/player.h" #include "cards/deck.h" #include "cards/card.h" #include "cards/trick.h" -#include "../serialization/serializable.h" #include "../serialization/serializable_value.h" #include "../serialization/unique_serializable.h" +/** + * @class game_state + * @brief Represents the state of the game. + * + * This class encapsulates all information about a game, including the players, the deck, the trick, and some other + * variables. + * + * The game_state class contains most of the game logic and also holds all the other common classes as members + * (or as members of members, e.g., game_state has players and players have hands). It also contains information + * about the progress and current state of the game, e.g., if the game has already started, is finished, or which + * phase the game is in (estimation phase or play phase). Moreover, it also keeps track of who is currently able to + * make predictions or play cards, and changes the state of the game according to the players' actions. + */ class game_state : public unique_serializable { private: - static const int _max_nof_players = 6; - static const int _min_nof_players = 3; + static constexpr int _max_nof_players = 6; ///< The maximum number of players that can join a game. + static constexpr int _min_nof_players = 3; ///< The minimum number of players needed to start a game. - std::vector<player*> _players; - deck* _deck; - trick* _trick; // only save current trick, won tricks are saved with the players - trick* _last_trick; + std::vector<player*> _players; ///< The players that joined the game + deck* _deck; ///< The game's deck. + trick* _trick; ///< The current trick of the game. + trick* _last_trick; ///< The previous trick. - serializable_value<bool>* _is_started; - serializable_value<bool>* _is_finished; - serializable_value<bool>* _is_estimation_phase; - //TODO: possibly add boolean _determine_trump_color that can be used to tell player to decide on a trump color + serializable_value<bool>* _is_started; ///< A boolean indicating whether the game is started. + serializable_value<bool>* _is_finished; ///< A boolean indicating whether the game is finished. + serializable_value<bool>* _is_estimation_phase; ///< A boolean indicating whether the game is in estimation phase. + //TODO: add boolean _determine_trump_color that can be used to tell player to decide on a trump color - serializable_value<int>* _round_number; - serializable_value<int>* _trick_number; - serializable_value<int>* _starting_player_idx; - serializable_value<int>* _trick_starting_player_idx; - serializable_value<int>* _current_player_idx; - serializable_value<int>* _trump_color; - serializable_value<int>* _trick_estimate_sum; + serializable_value<int>* _round_number; ///< The current round number. + serializable_value<int>* _trick_number; ///< The current trick number. + serializable_value<int>* _starting_player_idx; ///< The index of the player that started the current round. + serializable_value<int>* _trick_starting_player_idx; ///< The index of the player that started the current trick. + serializable_value<int>* _current_player_idx; ///< The index of the player that is currently playing. + serializable_value<int>* _trump_color; ///< The trump color of the current round. + serializable_value<int>* _trick_estimate_sum; ///< The sum of trick estimates. +// constructors + /** + * @brief Constructs a new game_state object (from_diff). + * @param id The game state's id. + */ + explicit game_state(const std::string& id); - // from_diff constructor, new game is constructed - explicit game_state(std::string id); - - // deserialization constructor + /** + * @brief Constructs a new game_state object during deserialization. + * @param id The game state's id. + * @param players The game state's players. + * @param deck The game state's deck. + * @param current_trick The game state's current trick. + * @param last_trick The game state's previous trick. + * @param is_started A boolean indicating whether the game is started. + * @param is_finished A boolean indicating whether the game is finished. + * @param is_estimation_phase A boolean indicating whether the game is in estimation phase. + * @param round_number The round number. + * @param trick_number The trick number. + * @param starting_player_idx The round starting player's index. + * @param trick_starting_player_idx The trick starting player's index. + * @param current_player_idx The current player's index. + * @param trump_color The trump color. + * @param trick_estimate_sum The sum of trick estimates. + */ game_state( - std::string id, - std::vector<player*>& players, + const std::string& id, + const std::vector<player*>& players, deck* deck, trick* current_trick, trick* last_trick, @@ -64,60 +93,293 @@ private: serializable_value<int>* trick_estimate_sum ); - // returns the index of 'player' in the '_players' vector +#ifdef WIZARD_SERVER +// private functions (only used by game_state member functions) + /** + * @brief Gets the index of the input player in the players vector. + * @param player The player whose index is searched. + * @return The player's index in the players vector. + */ int get_player_index(player* player) const; - // TODO: these two functions are in the server part in cpp, where do they belong? - int get_number_of_turns(); - void determine_trump_color(); + + /** + * @brief Gets the number of turns already played. + * @return The number of turns already played. + * + * This function is used by the estimate_tricks method of the game state to check correct trick estimation of the + * last player to estimate tricks. This player's trick estimate cannot lead to a trick estimate sum that equals the + * round number, thus the last player must be treated differently and is determined by the number of turns already + * played. + */ + [[nodiscard]] unsigned int get_number_of_turns() const; + + /** + * @brief Determines the trump color. + * + * This function determines the trump color of a round by calling the draw_trump function from deck after the cards + * have been dealt. If the drawn card is a jester, the trump color is set to no color (0) for this round. If the + * drawn card is a wizard, in the real game the starting player can choose a trump color. This is not implemented + * yet in our game, in this case we randomly select one of the four colors so far. + */ + void determine_trump_color() const; + + /** + * @brief Checks if a given card can be played by a given player. + * @param player The player that tries to play the card. + * @param card The card that is played. + * @param err The error message updated in case something does not work. + * @return A boolean indicating whether the card can be played by the player. + * + * This function checks if a given card can be played by a given player according to the game rules. The following + * points are checked in the given order: + * If there is no trick color yet (trick color is 0) or a wizard has set the trick color (-1), then the card can be + * played. + * If the card is a jester or wizard, then it can be played. + * If the card has the same color as the trick color, it can be played. + * If the card does not have the same color as the trick color, it can only be played if no other card on the players + * hand has the same color as the trick color. + */ + bool can_be_played(player* player, const card* card, std::string& err) const noexcept; +#endif public: + /** + * @brief Constructs a new game_state object. + */ game_state(); + + /** + * Destructs a trick object. + */ ~game_state() override; // accessors - bool is_full() const; - bool is_started() const; - bool is_finished() const; - bool is_estimation_phase() const; + /** + * @brief Checks if the game is full. + * @return A boolean indicating whether the game is full + */ + [[nodiscard]] bool is_full() const; + + /** + * @brief Checks if the game is started. + * @return A boolean indicating whether the game is started. + */ + [[nodiscard]] bool is_started() const; + + /** + * @brief Checks if the game is finished. + * @return A boolean indicating whether the game is finished. + */ + [[nodiscard]] bool is_finished() const; + + /** + * @brief Checks if the game is in estimation phase. + * @return A boolean indicating whether the game is in estimation phase. + */ + [[nodiscard]] bool is_estimation_phase() const; + + /** + * @brief Checks if the given player is in the game. + * @param player The player that is checked. + * @return A boolean indicating whether the given player is in the game. + */ bool is_player_in_game(player* player) const; - int get_round_number() const; - int get_trick_number() const; - int get_trick_estimate_sum() const; - int get_max_round_number() const; - int get_trump_color() const; - player* get_current_player() const; - player* get_trick_starting_player() const; - player* get_starting_player() const; - trick* get_trick() const; - trick* get_last_trick() const; + + /** + * @brief Gets the round number. + * @return The round number. + */ + [[nodiscard]] int get_round_number() const; + + /** + * @brief Gets the trick number. + * @return The trick number. + */ + [[nodiscard]] int get_trick_number() const; + + /** + * @brief Gets the trick estimate sum. + * @return The trick estimate sum. + */ + [[nodiscard]] int get_trick_estimate_sum() const; + + /** + * @brief Gets the maximum round number. + * @return The maximum round number. + * + * The maximum number of rounds is determined by the number of players in the game. It is calculated by dividing + * 60 by the number of players. With 3 players, there are 20 rounds, while with 6 players, there are 10 rounds. + */ + [[nodiscard]] unsigned int get_max_round_number() const; + + /** + * @brief Gets the trump color. + * @return The trump color. + */ + [[nodiscard]] int get_trump_color() const; + + /** + * @brief Gets the current player. + * @return The current player. + */ + [[nodiscard]] player* get_current_player() const; + + /** + * @brief Gets the starting player of the current trick. + * @return The starting player of the current trick. + */ + [[nodiscard]] player* get_trick_starting_player() const; + + /** + * @brief Gets the starting player of the current round. + * @return The starting player of the current round. + */ + [[nodiscard]] player* get_starting_player() const; + + /** + * @brief Gets the current trick. + * @return The current trick. + */ + [[nodiscard]] trick* get_trick() const; + + /** + * @brief Gets the previous trick. + * @return The previous trick. + */ + [[nodiscard]] trick* get_last_trick() const; + + /** + * @brief Gets the players that joined the game. + * @return The players that joined the game. + */ std::vector<player*>& get_players(); + /** + * @brief Sets the trick to the given trick. + * @param new_trick The new trick. + */ void set_trick(trick* new_trick); - -// all in block behind ifdef is only included if wizard server is defined -// TODO: remove // before ifdef and endif below (if it is still there otherwise ignore this) #ifdef WIZARD_SERVER // server-side state update functions + /** + * @brief Removes a player from the game. + * @param player The player that is removed. + * @param err The error message updated in case something does not work. + * @return A boolean indicating whether removing the player worked or not. + * + * This function tries to remove a player from the game. While this is done, the players vector is updated so that + * the remaining players can start a new round. + */ bool remove_player(player* player, std::string& err); + + /** + * @brief Adds a player to the game. + * @param player The player that is added. + * @param err The error message updated in case something does not work. + * @return A boolean indicating whether adding the player worked or not. + * + * This function tries to add a player to a game. To do so, it checks several things including if the maximum number + * of players is already reached and if the game has already started. + */ bool add_player(player* player, std::string& err); + + /** + * @brief Starts the game. + * @param err The error message updated in case something does not work. + * @return A boolean indicating whether the game could be started or not. + * + * This function tries to start the game. To do so, it checks if the round is already started and if enough players + * have joint the game. + */ bool start_game(std::string& err); - bool finish_game(std::string& err); - void setup_round(std::string& err); // server side initialization + /** + * @brief Finishes a game. + * @param err The error message updated in case something does not work. + * @return A boolean indicating whether finishing the game worked or not. + * + * This function finishes the game by setting _is_finished to true. + */ + bool finish_game(std::string& err) const; + + /** + * @brief Sets up a round. + * @param err The error message updated in case something does not work. + * + * This function sets up a new round. To do so, it changes the phase to estimation phase, sets the trick estimate sum + * to zero, and updates the starting player indices. It also sets up the deck (which draws cards into players' hands), + * determines the trump, and sets up the trick. + */ + void setup_round(std::string& err); + + /** + * @brief Wraps up a round. + * @param err The error message updated in case something does not work. + * + * This function wraps up a round by moving the starting player index further to the next player, and by calling + * the wrap_up_round function of each player (this calculates the scores, see player class for more information). + * If the game is finished after the current round, the function also call finish_game to finish the game. + */ void wrap_up_round(std::string& err); - bool estimate_tricks(player *player, std::string &err, int trick_estimate); - bool can_be_played(player* player, const card* card, std::string& err) const noexcept; + + /** + * @brief Sets the trick estimates for a player. + * @param player The player that is estimating tricks. + * @param err The error message updated in case something does not work. + * @param trick_estimate The trick estimate. + * @return A boolean indicating whether the trick estimate was valid or not. + * + * This function is called whenever a player estimates their tricks (so predicts how many tricks they will win in + * the next round). To do so, the functions checks that the trick estimate is neither too low (smaller than zero), + * nor too high (greater than the round number), and for the last player, that the trick estimate sum of all players + * is not equal to the round number. If all of these checks pass, the players trick estimate is updated. Afterward, + * the game proceeds by calling update_current_player (see below). + */ + bool estimate_tricks(const player *player, std::string &err, int trick_estimate); + + /** + * @brief Plays a card. + * @param player The player that plays the card. + * @param card_id The id of the card that is played. + * @param err The error message updated in case something does not work. + * @return A boolean indicating whether the card could be played or not. + * + * This function is called whenever a player tries to play a card. If the card is in the player's hand, and it can + * be played (see can_be_played method of game_state), the card is added to the trick and removed from the player's + * hand. Afterward, the game proceeds by calling update_current_player (see below). + */ bool play_card(player* player, const std::string& card_id, std::string& err); - bool update_current_player(std::string& err); + /** + * @brief Updates the current player after estimating tricks or playing cards. + * @param err The error message updated in case something does not work. + * @return A boolean indicating whether the current player could be updated or not. + * + * This function is called whenever a trick estimation or playing of a card was successful, and it progresses the + * game after these actions. First, the function updates the current player to be the next player. If the updated + * current player still has to estimate their tricks or play their card in the current round or trick, the game just + * proceeds. However, if the updated current player is the same player that started the current trick or round, + * the current trick or round is wrapped up and a new one is set up. + */ + bool update_current_player(std::string& err); #endif // serializable interface + /** + * @brief Serializes a game_state object into a json object. + * @param json The json object for serializing the game_state. + * @param allocator The json allocator for serializing the game_state. + */ void write_into_json(rapidjson::Value& json, rapidjson::Document::AllocatorType& allocator) const override; + + /** + * @brief Deserializes a game_state object from a json object. + * @param json The json object containing the game_state information. + * @return A pointer to a new game_state object created from the given json object. + */ static game_state* from_json(const rapidjson::Value& json); }; - #endif //WIZARD_GAME_STATE_H diff --git a/unit-tests/game_state.cpp b/unit-tests/game_state.cpp index 8f45af8..6954e44 100644 --- a/unit-tests/game_state.cpp +++ b/unit-tests/game_state.cpp @@ -315,7 +315,7 @@ TEST_F(GameStatePlayCardTest, PlayCardRound1) // this function enables us to start from arbitrary points in the game and test from there void create_json(rapidjson::Value &json, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> &allocator, - std::vector<player*>& test_players, deck* test_deck, trick* test_trick, + std::vector<player*>& test_players, deck* test_deck, trick* test_trick, trick* test_last_trick, serializable_value<bool>* test_is_finished, serializable_value<bool>* test_is_started, serializable_value<bool>* test_is_estimation_phase, serializable_value<int>* test_round_number, serializable_value<int>* test_trick_number, serializable_value<int>* test_starting_player_idx, @@ -338,6 +338,11 @@ void create_json(rapidjson::Value &json, rapidjson::MemoryPoolAllocator<rapidjso test_trick->write_into_json(trick_val, allocator); json.AddMember("trick", trick_val, allocator); + // last trick + rapidjson::Value last_trick_val(rapidjson::kObjectType); + test_last_trick->write_into_json(last_trick_val, allocator); + json.AddMember("last_trick", last_trick_val, allocator); + // is finished rapidjson::Value is_finished_val(rapidjson::kObjectType); test_is_finished->write_into_json(is_finished_val, allocator); @@ -395,6 +400,7 @@ TEST(GameStateJson, CreateJson) std::vector test_players = { new player("player1"), new player("player2"), new player("player3") }; const auto test_deck = new deck(); const auto test_trick = new trick(); + const auto test_last_trick = new trick(); const auto test_is_finished = new serializable_value<bool>(false); const auto test_is_started = new serializable_value<bool>(false); const auto test_is_estimation_phase = new serializable_value<bool>(true); @@ -408,8 +414,8 @@ TEST(GameStateJson, CreateJson) auto* json = new rapidjson::Document(); json->SetObject(); - create_json(*json, json->GetAllocator(), test_players, test_deck, test_trick, test_is_finished, test_is_started, - test_is_estimation_phase, test_round_number, test_trick_number, test_starting_player_idx, + create_json(*json, json->GetAllocator(), test_players, test_deck, test_trick, test_last_trick, test_is_finished, + test_is_started, test_is_estimation_phase, test_round_number, test_trick_number, test_starting_player_idx, test_trick_starting_player_idx, test_current_player_idx, test_trump_color, test_trick_estimate_sum); const std::string message = json_utils::to_string(json); @@ -433,6 +439,7 @@ TEST(GameStateUpdateCurrentPlayerTest, UpatePLayerEstimation) new player("player3"), new player("player4") }; const auto test_deck = new deck(); const auto test_trick = new trick(); + const auto test_last_trick = new trick(); const auto test_is_finished = new serializable_value<bool>(false); const auto test_is_started = new serializable_value<bool>(true); const auto test_is_estimation_phase = new serializable_value<bool>(true); @@ -446,9 +453,10 @@ TEST(GameStateUpdateCurrentPlayerTest, UpatePLayerEstimation) auto* json = new rapidjson::Document(); json->SetObject(); - create_json(*json, json->GetAllocator(), test_players, test_deck, test_trick, test_is_finished, test_is_started, - test_is_estimation_phase, test_round_number, test_trick_number, test_starting_player_idx, - test_trick_starting_player_idx, test_current_player_idx, test_trump_color, test_trick_estimate_sum); + create_json(*json, json->GetAllocator(), test_players, test_deck, test_trick, test_last_trick, + test_is_finished, test_is_started, test_is_estimation_phase, test_round_number, test_trick_number, + test_starting_player_idx, test_trick_starting_player_idx, test_current_player_idx, test_trump_color, + test_trick_estimate_sum); const std::string message = json_utils::to_string(json); delete json; @@ -473,6 +481,7 @@ TEST(GameStateUpdateCurrentPlayerTest, UpatePLayerEstimationToPlaying) new player("player3"), new player("player4") }; const auto test_deck = new deck(); const auto test_trick = new trick(); + const auto test_last_trick = new trick(); const auto test_is_finished = new serializable_value<bool>(false); const auto test_is_started = new serializable_value<bool>(true); const auto test_is_estimation_phase = new serializable_value<bool>(true); @@ -486,9 +495,10 @@ TEST(GameStateUpdateCurrentPlayerTest, UpatePLayerEstimationToPlaying) auto* json = new rapidjson::Document(); json->SetObject(); - create_json(*json, json->GetAllocator(), test_players, test_deck, test_trick, test_is_finished, test_is_started, - test_is_estimation_phase, test_round_number, test_trick_number, test_starting_player_idx, - test_trick_starting_player_idx, test_current_player_idx, test_trump_color, test_trick_estimate_sum); + create_json(*json, json->GetAllocator(), test_players, test_deck, test_trick, test_last_trick, + test_is_finished, test_is_started, test_is_estimation_phase, test_round_number, test_trick_number, + test_starting_player_idx, test_trick_starting_player_idx, test_current_player_idx, test_trump_color, + test_trick_estimate_sum); const std::string message = json_utils::to_string(json); delete json; @@ -514,6 +524,7 @@ TEST(GameStateUpdateCurrentPlayerTest, UpatePLayerPlayingToNextRound) new player("player3"), new player("player4") }; const auto test_deck = new deck(); const auto test_trick = new trick(); + const auto test_last_trick = new trick(); const auto test_is_finished = new serializable_value<bool>(false); const auto test_is_started = new serializable_value<bool>(true); const auto test_is_estimation_phase = new serializable_value<bool>(false); @@ -527,9 +538,10 @@ TEST(GameStateUpdateCurrentPlayerTest, UpatePLayerPlayingToNextRound) auto* json = new rapidjson::Document(); json->SetObject(); - create_json(*json, json->GetAllocator(), test_players, test_deck, test_trick, test_is_finished, test_is_started, - test_is_estimation_phase, test_round_number, test_trick_number, test_starting_player_idx, - test_trick_starting_player_idx, test_current_player_idx, test_trump_color, test_trick_estimate_sum); + create_json(*json, json->GetAllocator(), test_players, test_deck, test_trick, test_last_trick, + test_is_finished, test_is_started, test_is_estimation_phase, test_round_number, test_trick_number, + test_starting_player_idx, test_trick_starting_player_idx, test_current_player_idx, test_trump_color, + test_trick_estimate_sum); const std::string message = json_utils::to_string(json); delete json; @@ -582,6 +594,7 @@ TEST(GameStateFinishGameTest, FinishGame) new player("player3"), new player("player4") }; const auto test_deck = new deck(); const auto test_trick = new trick(); + const auto test_last_trick = new trick(); const auto test_is_finished = new serializable_value<bool>(false); const auto test_is_started = new serializable_value<bool>(true); const auto test_is_estimation_phase = new serializable_value<bool>(false); @@ -595,9 +608,10 @@ TEST(GameStateFinishGameTest, FinishGame) auto* json = new rapidjson::Document(); json->SetObject(); - create_json(*json, json->GetAllocator(), test_players, test_deck, test_trick, test_is_finished, test_is_started, - test_is_estimation_phase, test_round_number, test_trick_number, test_starting_player_idx, - test_trick_starting_player_idx, test_current_player_idx, test_trump_color, test_trick_estimate_sum); + create_json(*json, json->GetAllocator(), test_players, test_deck, test_trick, test_last_trick, + test_is_finished, test_is_started, test_is_estimation_phase, test_round_number, test_trick_number, + test_starting_player_idx, test_trick_starting_player_idx, test_current_player_idx, test_trump_color, + test_trick_estimate_sum); const std::string message = json_utils::to_string(json); delete json; -- GitLab From 80ddab360ccade36f2cf7764731859f8fe54cc29 Mon Sep 17 00:00:00 2001 From: mtarnow <mtarnow@ethz.ch> Date: Thu, 12 Dec 2024 22:03:36 +0100 Subject: [PATCH 2/2] corrected showtrickover message to show the correct winner of the trick --- src/client/GameController.cpp | 7 ++-- src/client/GameController.h | 2 +- src/common/game_state/cards/trick.cpp | 52 +++++++++++++++++++++++++++ src/common/game_state/cards/trick.h | 9 +++++ 4 files changed, 65 insertions(+), 5 deletions(-) diff --git a/src/client/GameController.cpp b/src/client/GameController.cpp index d732d59..74cbdc1 100644 --- a/src/client/GameController.cpp +++ b/src/client/GameController.cpp @@ -112,7 +112,8 @@ void GameController::updateGameState(game_state* newGameState) { oldGameState->set_trick(trick_to_show); GameController::_gameWindow->showPanel(GameController::_mainGamePanelWizard); GameController::_mainGamePanelWizard->buildGameState(oldGameState, GameController::_me); - showTrickOverMessage(); + player* winner = oldGameState->get_trick()->get_winner(); + showTrickOverMessage(winner); } if(round_number != oldGameState->get_round_number()) @@ -251,12 +252,10 @@ void GameController::showNewRoundMessage(game_state* oldGameState, game_state* n dialog->ShowModal(); } -void GameController::showTrickOverMessage() +void GameController::showTrickOverMessage(const player* winner) { std::string title = "Trick Completed"; std::string message = " won the trick\n"; - - player* winner = _currentGameState->get_trick_starting_player(); message = winner->get_player_name() + message; auto dialog = new ScoreDialog(GameController::_gameWindow, title, message); diff --git a/src/client/GameController.h b/src/client/GameController.h index 43c81bf..27a4bcc 100644 --- a/src/client/GameController.h +++ b/src/client/GameController.h @@ -27,7 +27,7 @@ public: static void showError(const std::string& title, const std::string& message); static void showStatus(const std::string& message); static void showNewRoundMessage(game_state* oldGameState, game_state* newGameState); - static void showTrickOverMessage(); + static void showTrickOverMessage(const player* winner); static void showGameOverMessage(); private: diff --git a/src/common/game_state/cards/trick.cpp b/src/common/game_state/cards/trick.cpp index 7048c74..294233e 100644 --- a/src/common/game_state/cards/trick.cpp +++ b/src/common/game_state/cards/trick.cpp @@ -68,6 +68,58 @@ std::vector<std::pair<card*, player*>> trick::get_cards_and_players() const return this->_cards; } +player* trick::get_winner() const +{ + player* winner = _cards[0].second; // base winner is first player, in case of 4 jokers + + // Determine and return winner + // wizard check + for (auto & _card : _cards) { + if (_card.first->get_value() == 14) + { + return _card.second; + } + } + // all joker check + if (_trick_color->get_value() == 0) + { + return winner; // would be first joker player + } + // trump check + bool trump_present = false; + int highest_trump = 0; + for (auto & _card : _cards) { + if (_card.first->get_color() == _trump_color->get_value()) + { + trump_present = true; + if (_card.first->get_value() > highest_trump) + { + highest_trump = _card.first->get_value(); + winner = _card.second; + } + } + } + if (trump_present) { + return winner; + } + // highest card of trick color check + int winner_idx = -1; // use a non joker idx; + for (int i = 0; i < _cards.size(); i++) { + //check if played card color matches trick color + if (_cards[i].first->get_color() == _trick_color->get_value()) + if (winner_idx == -1 || + _cards[i].first->get_value() + > _cards[winner_idx].first->get_value()) { + winner_idx = i; + } + } + if (winner_idx != -1) { + winner = _cards[winner_idx].second; + } + + return winner; +} + #ifdef WIZARD_SERVER // state update functions diff --git a/src/common/game_state/cards/trick.h b/src/common/game_state/cards/trick.h index 710b275..4df17bd 100644 --- a/src/common/game_state/cards/trick.h +++ b/src/common/game_state/cards/trick.h @@ -93,6 +93,15 @@ public: */ [[nodiscard]] int get_trump_color() const; + /** + * @brief Gets the winner of the trick. + * @return The winner of the trick. + * + * This function is used by the client to determine the winner of a trick, and to display the winner after the trick. + * It uses the same logic as the wrap_up_round function on the server side. + */ + [[nodiscard]] player* get_winner() const; + #ifdef WIZARD_SERVER // state update functions /** -- GitLab