From fcb4be35278a3cc21b0e3c9cb0e76840f8a37a3e Mon Sep 17 00:00:00 2001 From: velnias75 Date: Fri, 28 Nov 2014 07:29:08 +0100 Subject: [PATCH] doc updates --- doc/client.dox.in | 6 +++--- src/engine/stdplayer.cpp | 17 +++++++++-------- src/include/abstractclient.h | 25 +++++++++++++++---------- src/include/cardtools.h | 13 +++++++++++++ src/include/icard.h | 2 +- 5 files changed, 41 insertions(+), 22 deletions(-) diff --git a/doc/client.dox.in b/doc/client.dox.in index 58ef8af..d0e1635 100644 --- a/doc/client.dox.in +++ b/doc/client.dox.in @@ -51,7 +51,7 @@ PROJECT_BRIEF = "Client API" # and the maximum width should not exceed 200 pixels. Doxygen will copy the logo # to the output directory. -PROJECT_LOGO = +#PROJECT_LOGO = @top_srcdir@/netmaumau.ico # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path # into which the generated documentation will be written. If a relative path is @@ -946,13 +946,13 @@ STRIP_CODE_COMMENTS = YES # function all documented functions referencing it will be listed. # The default value is: NO. -REFERENCED_BY_RELATION = NO +REFERENCED_BY_RELATION = YES # If the REFERENCES_RELATION tag is set to YES then for each documented function # all documented entities called/used by that function will be listed. # The default value is: NO. -REFERENCES_RELATION = NO +REFERENCES_RELATION = YES # If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set # to YES, then the hyperlinks from functions in REFERENCES_RELATION and diff --git a/src/engine/stdplayer.cpp b/src/engine/stdplayer.cpp index d5272ab..3407ac0 100644 --- a/src/engine/stdplayer.cpp +++ b/src/engine/stdplayer.cpp @@ -18,6 +18,7 @@ */ #include +#include #include "stdplayer.h" @@ -80,6 +81,13 @@ struct playedOutRank : std::binary_function { + std::size_t operator()(std::size_t i, const NetMauMau::Common::ICard *c) const { + return i + c->getPoints(); + } +}; + #pragma GCC diagnostic pop } @@ -461,14 +469,7 @@ std::size_t StdPlayer::getCardCount() const { } std::size_t StdPlayer::getPoints() const { - - std::size_t pts = 0; - - for(CARDS::const_iterator i(m_cards.begin()); i != m_cards.end(); ++i) { - pts += (*i)->getPoints(); - } - - return pts; + return std::accumulate(m_cards.begin(), m_cards.end(), 0, pointSum()); } const StdPlayer::CARDS &StdPlayer::getPlayerCards() const { diff --git a/src/include/abstractclient.h b/src/include/abstractclient.h index caec426..aa14081 100644 --- a/src/include/abstractclient.h +++ b/src/include/abstractclient.h @@ -28,8 +28,11 @@ * NetMauMau::Client::AbstractClient. @n Useful functions you'll find in NetMauMau::Common. * * Link your client against @c -lnetmaumauclient and @c -lnetmaumaucommon + * + * The rules and points you can find @ref rules "here". * - * You can grab the latest source code at https://github.com/velnias75/NetMauMau\n + * You can grab the latest source code from https://github.com/velnias75/NetMauMau or + * https://sourceforge.net/projects/netmaumau\n * A proof of concept Qt client can be found at https://github.com/velnias75/NetMauMau-Qt-Client * * @page rules Rules @@ -49,46 +52,49 @@ * can play out any card of either the same rank or the same suit. If a player cannot play out * any card the player has to take one from the pool and to suspend. Some cards trigger specific * actions as described below. + * + * If a player has lost the points of the player's cards are summed up. The higher that value + * the worse the game is lost. * * Specific card rules * ------------------- * * All rules apply also to the visible card at the beginning of the game for the first player. * - * * **Seven** + * * **Seven** (1 Point) * * if a *Seven* is played out than the next player has either to take two more cards or play * out another *Seven*. In that case the next player has either to take plus two (i.e. four) * cards or can also play out a *Seven* and so forth. At maximum one player has to take eight * cards if a sequence of four *Seven* are played out * - * * **Eight** + * * **Eight** (2 Points) * * if an *Eight* is played out, the next player has to suspend and the next player can play * a card. The player has **not** to take an extra card. An *Eight* played before takes * precedence, i.e. even if the next player has an *Eight*, the player has to suspend * - * * **Nine** + * * **Nine** (3 Points) * * there is no special rule for that rank * - * * **Ten** + * * **Ten** (4 Points) * * there is no special rule for that rank * - * * **Queen** + * * **Queen** (5 Points) * * there is no special rule for that rank * - * * **King** + * * **King** (6 Points) * * there is no special rule for that rank * - * * **Ace** + * * **Ace** (11 Points) * * there is no special rule for that rank * - * * **Jack** + * * **Jack** (20 Points) * * if a *Jack* of any suite is played out, the player can wish a new suit. A *Jack* can get * played over any card except another *Jack*. An *Eight* played before takes precedence, i.e. @@ -408,7 +414,6 @@ class _EXPORT AbstractClient { * taking card a is not possible * * @param enable @c true if it is possible to take a card, @c false otherwise - * @return void */ virtual void enableSuspend(bool enable) const = 0; diff --git a/src/include/cardtools.h b/src/include/cardtools.h index 2e69eef..e5a096e 100644 --- a/src/include/cardtools.h +++ b/src/include/cardtools.h @@ -277,6 +277,19 @@ _EXPORT NetMauMau::Common::ICard *getIllegalCard() _CONST; /** * @brief Gets the points of a @c RANK * + * Rank | Points + * ------: | :----- + * Seven | 1 + * Eight | 2 + * Nine | 3 + * Ten | 4 + * Queen | 5 + * King | 6 + * Ace | 11 + * Jack | 20 + * + * @see Common::ICard::getPoints + * * @param rank the @c RANK * @return std::size_t the points of a @c RANK */ diff --git a/src/include/icard.h b/src/include/icard.h index 21fb672..a4d9d08 100644 --- a/src/include/icard.h +++ b/src/include/icard.h @@ -83,7 +83,7 @@ class _EXPORT ICard { /** * @brief Gets the points of the card - * + * @see Common::getCardPoints * @return std::size_t the points of the card */ virtual std::size_t getPoints() const = 0;