2008-01-08 14:52:32 +01:00
|
|
|
/*****************************************************************************
|
|
|
|
* Eliot
|
|
|
|
* Copyright (C) 2005-2007 Antoine Fraboulet & Olivier Teulière
|
|
|
|
* Authors: Antoine Fraboulet <antoine.fraboulet @@ free.fr>
|
|
|
|
* Olivier Teulière <ipkiss @@ gmail.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*****************************************************************************/
|
2005-08-15 20:13:57 +02:00
|
|
|
|
2009-11-29 17:01:31 +01:00
|
|
|
#ifndef TURN_H_
|
|
|
|
#define TURN_H_
|
2005-08-15 20:13:57 +02:00
|
|
|
|
2008-01-08 14:52:32 +01:00
|
|
|
#include <string>
|
|
|
|
#include "pldrack.h"
|
|
|
|
#include "move.h"
|
2012-02-18 22:26:52 +01:00
|
|
|
#include "logging.h"
|
2008-01-08 14:52:32 +01:00
|
|
|
|
|
|
|
using std::wstring;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A Turn is the information about one 'move' done by a player.
|
|
|
|
* It consists of the player who played, the rack, and the actual move.
|
|
|
|
*
|
|
|
|
* This class has no logic, it is merely there to aggregate corresponding
|
|
|
|
* data.
|
|
|
|
*/
|
2005-08-15 20:13:57 +02:00
|
|
|
class Turn
|
|
|
|
{
|
2012-02-18 22:26:52 +01:00
|
|
|
DEFINE_LOGGER();
|
2005-11-06 00:22:41 +01:00
|
|
|
public:
|
2005-12-26 20:17:49 +01:00
|
|
|
Turn();
|
2008-11-23 09:18:03 +01:00
|
|
|
Turn(unsigned int iPlayerId,
|
2008-01-08 14:52:32 +01:00
|
|
|
const PlayedRack& iPldRack, const Move& iMove);
|
2005-11-06 00:22:41 +01:00
|
|
|
|
2008-01-08 14:52:32 +01:00
|
|
|
void setPlayer(unsigned int iPlayerId) { m_playerId = iPlayerId; }
|
2005-11-06 00:22:41 +01:00
|
|
|
void setPlayedRack(const PlayedRack& iPldRack) { m_pldrack = iPldRack; }
|
2008-01-08 14:52:32 +01:00
|
|
|
void setMove(const Move& iMove) { m_move = iMove; }
|
2012-03-23 07:41:16 +01:00
|
|
|
// Setters for warnings, penalties and solos
|
|
|
|
void addWarning(unsigned iNb = 1) { m_warningsNb += iNb; }
|
2012-04-30 08:31:34 +02:00
|
|
|
void addPenaltyPoints(int iPoints) { m_penaltyPoints += iPoints; }
|
|
|
|
void addSoloPoints(int iPoints) { m_soloPoints += iPoints; }
|
2005-11-06 00:22:41 +01:00
|
|
|
|
2008-01-08 14:52:32 +01:00
|
|
|
unsigned int getPlayer() const { return m_playerId; }
|
2005-11-06 00:22:41 +01:00
|
|
|
const PlayedRack& getPlayedRack() const { return m_pldrack; }
|
2008-01-08 14:52:32 +01:00
|
|
|
const Move& getMove() const { return m_move; }
|
2012-03-23 07:41:16 +01:00
|
|
|
// Getters for warnings, penalties and solos
|
|
|
|
unsigned getWarningsNb() const { return m_warningsNb; }
|
2012-04-30 08:31:34 +02:00
|
|
|
int getPenaltyPoints() const { return m_penaltyPoints; }
|
|
|
|
int getSoloPoints() const { return m_soloPoints; }
|
2005-11-06 00:22:41 +01:00
|
|
|
|
2012-03-23 07:41:16 +01:00
|
|
|
wstring toString() const;
|
2005-11-06 00:22:41 +01:00
|
|
|
|
|
|
|
private:
|
2008-01-08 14:52:32 +01:00
|
|
|
unsigned int m_playerId;
|
2012-03-23 07:41:16 +01:00
|
|
|
PlayedRack m_pldrack;
|
|
|
|
Move m_move;
|
|
|
|
int m_warningsNb;
|
|
|
|
int m_penaltyPoints;
|
|
|
|
int m_soloPoints;
|
2005-08-15 20:13:57 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|