Hints: add missing logging

This commit is contained in:
Olivier Teulière 2013-03-30 19:23:59 +01:00
parent 7c7e26cc16
commit d897b05c52
2 changed files with 21 additions and 0 deletions

View file

@ -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<Tile> 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()));

View file

@ -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;