/**********************************************************************
 *
 *   FreeDoko a Doppelkopf-Game
 *    
 *   Copyright (C) 2001-2004  by Diether Knof and Borg Enders
 *
 *   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 can find this license in the file 'gpl.txt'.
 *
 *   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., 59 Temple Place, Suite 330, Boston, 
 *   MA  02111-1307  USA
 *
 *  Contact:
 *    Diether Knof dknof@gmx.de
 *    Borg Enders  borg@borgsoft.de
 *
 **********************************************************************/

#ifndef CLASS_GAMEPOINTSTABLE_HEADER
#define CLASS_GAMEPOINTSTABLE_HEADER

#include "../basistypes.h"
#include "gamepoints.h"

namespace COUNTINGTYPE {
  enum CountingType {
    PLUS,
    MINUS,
    PLUSMINUS
  };
} // namespace COUNTINGTYPE 
using COUNTINGTYPE::CountingType;

extern CountingType counting_type;

namespace POINTSTABLESTYLE {
  enum PointsTableStyle {
    SUMING,
    SINGLEPOINTS
  };
} // namespace POINTSTABLESTYLE

using POINTSTABLESTYLE::PointsTableStyle;

extern PointsTableStyle pointstable_style;

class GamePointsTable {
  public:

    GamePointsTable(vector<string> names,int rp=-1, 
		    CountingType ct=COUNTINGTYPE::PLUS,
		    PointsTableStyle st=POINTSTABLESTYLE::SUMING);

    ~GamePointsTable();

    GamePointsTable& operator=(GamePointsTable const& g);

    GamePoints gamepoints(unsigned i) const;

    void add(GamePoints const& p);

    string const name(unsigned i) const;

    int remainingpoints() const;

    int SumOfPoints() const;

    unsigned gameno() const;

    int points(unsigned i) const;

    CountingType countingtype();

    PointsTableStyle style();

  private:
    vector<GamePoints> gamepoints_p;  // points of each played game
    vector<string>names_p;            // players names
    int remainingpoints_p;     // points to be still played
    vector<int>points_p;             // points of each player
    unsigned gameno_p;              // number of the actual game 
    CountingType countingtype_p; // how the points are calculated
    PointsTableStyle style_p;    // how the calculated points are shown
    int sum_p; //sum of played points till now
}; // class GamePointsTable

ostream& operator<<(ostream& ostr, GamePointsTable const& g);

#endif // #ifndef CLASS_GAMEPOINTSTABLE_HEADER
