From d897b05c529c70e7222f57498f8224a6b585b4d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Teuli=C3=A8re?= Date: Sat, 30 Mar 2013 19:23:59 +0100 Subject: [PATCH] Hints: add missing logging --- game/hints.cpp | 14 ++++++++++++++ game/hints.h | 7 +++++++ 2 files changed, 21 insertions(+) diff --git a/game/hints.cpp b/game/hints.cpp index 4f67238..73ca141 100644 --- a/game/hints.cpp +++ b/game/hints.cpp @@ -37,6 +37,13 @@ INIT_LOGGER(game, AbstractHint); +INIT_LOGGER(game, ScoreHint); +INIT_LOGGER(game, OrientationHint); +INIT_LOGGER(game, PositionHint); +INIT_LOGGER(game, LengthHint); +INIT_LOGGER(game, BoardLettersHint); +INIT_LOGGER(game, WordLettersHint); +INIT_LOGGER(game, FirstLetterHint); AbstractHint::AbstractHint(const string &iName, const string &iDescription, int iCost) @@ -55,6 +62,7 @@ ScoreHint::ScoreHint() string ScoreHint::giveHint(const Move &iMove) const { + LOG_DEBUG("Getting hint for move: " << lfw(iMove.toString())); return str(boost::format(_("Score: %1%")) % iMove.getScore()); } @@ -69,6 +77,7 @@ OrientationHint::OrientationHint() string OrientationHint::giveHint(const Move &iMove) const { + LOG_DEBUG("Getting hint for move: " << lfw(iMove.toString())); ASSERT(iMove.isValid(), "Hints only make sense for valid moves"); const Coord &coord = iMove.getRound().getCoord(); boost::format fmt(_("Orientation: %1%")); @@ -90,6 +99,7 @@ PositionHint::PositionHint() string PositionHint::giveHint(const Move &iMove) const { + LOG_DEBUG("Getting hint for move: " << lfw(iMove.toString())); ASSERT(iMove.isValid(), "Hints only make sense for valid moves"); return str(boost::format(_("Position: %1%")) % lfw(iMove.getRound().getCoord().toString())); @@ -106,6 +116,7 @@ LengthHint::LengthHint() string LengthHint::giveHint(const Move &iMove) const { + LOG_DEBUG("Getting hint for move: " << lfw(iMove.toString())); ASSERT(iMove.isValid(), "Hints only make sense for valid moves"); return str(boost::format(_("Length: %1% letters")) % iMove.getRound().getWordLen()); @@ -122,6 +133,7 @@ BoardLettersHint::BoardLettersHint() string BoardLettersHint::giveHint(const Move &iMove) const { + LOG_DEBUG("Getting hint for move: " << lfw(iMove.toString())); ASSERT(iMove.isValid(), "Hints only make sense for valid moves"); // Retrieve the letters coming from the board wstring fromBoard; @@ -146,6 +158,7 @@ WordLettersHint::WordLettersHint() string WordLettersHint::giveHint(const Move &iMove) const { + LOG_DEBUG("Getting hint for move: " << lfw(iMove.toString())); ASSERT(iMove.isValid(), "Hints only make sense for valid moves"); vector tiles = iMove.getRound().getTiles(); // Sort the letters (we cannot sort directly the wstring from @@ -174,6 +187,7 @@ FirstLetterHint::FirstLetterHint() string FirstLetterHint::giveHint(const Move &iMove) const { + LOG_DEBUG("Getting hint for move: " << lfw(iMove.toString())); ASSERT(iMove.isValid(), "Hints only make sense for valid moves"); return str(boost::format(_("First letter: %1%")) % lfw(iMove.getRound().getTile(0).toChar())); diff --git a/game/hints.h b/game/hints.h index 4a2ca71..4fbfe3d 100644 --- a/game/hints.h +++ b/game/hints.h @@ -69,6 +69,7 @@ private: */ class ScoreHint : public AbstractHint { + DEFINE_LOGGER(); public: ScoreHint(); virtual string giveHint(const Move &iMove) const; @@ -80,6 +81,7 @@ public: */ class OrientationHint : public AbstractHint { + DEFINE_LOGGER(); public: OrientationHint(); virtual string giveHint(const Move &iMove) const; @@ -91,6 +93,7 @@ public: */ class PositionHint : public AbstractHint { + DEFINE_LOGGER(); public: PositionHint(); virtual string giveHint(const Move &iMove) const; @@ -102,6 +105,7 @@ public: */ class LengthHint : public AbstractHint { + DEFINE_LOGGER(); public: LengthHint(); virtual string giveHint(const Move &iMove) const; @@ -113,6 +117,7 @@ public: */ class BoardLettersHint : public AbstractHint { + DEFINE_LOGGER(); public: BoardLettersHint(); virtual string giveHint(const Move &iMove) const; @@ -124,6 +129,7 @@ public: */ class WordLettersHint : public AbstractHint { + DEFINE_LOGGER(); public: WordLettersHint(); virtual string giveHint(const Move &iMove) const; @@ -135,6 +141,7 @@ public: */ class FirstLetterHint : public AbstractHint { + DEFINE_LOGGER(); public: FirstLetterHint(); virtual string giveHint(const Move &iMove) const;