/**********************************************************************
 *
 *   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_PARTY_HEADER
#define CLASS_PARTY_HEADER

#include "../basistypes.h"

#include "../player/player.h"
class Rule;
class GamePointsTable;

class Party {
  friend class Game;
  public:

  Party();
  ~Party();

  Game& game();
  unsigned gameno() const;
  Rule& rule();
  Rule const& rule() const;
  Player& player(unsigned const p);
  Player const& player(unsigned const p) const;
  Player const& player_set(Player* player, unsigned const n);
  unsigned playerno() const;
  // number of human players
  unsigned humanno() const;
  GamePointsTable const& gamepointstable() const;

  protected:
  GamePointsTable& gamepointstable();

  public:

  string const playername_set(unsigned const player_no, string const& new_name);
  Player::Type playertype_set(unsigned const player_no,
			      Player::Type const new_type);

  unsigned seed_first() const;
  unsigned seed_first_set(unsigned const seed_first_new);
  unsigned seed() const;
  unsigned seed_set(unsigned const seed_new);
  unsigned seed_set_random();
  unsigned seed_next();

  unsigned startplayer_first() const;
  void startplayer_first_set(unsigned const startplayer_first_new);
  void startplayer_first_set_random();
  unsigned startplayer() const;

  ostream& out(ostream& ostr) const;

  void play();
  private:
  void init();

  private:
  Game *game_p; // current game
  Rule *rule_p; // rules for the party

  unsigned gameno_p; // number of game

  vector<Player*> player_p; // players

  GamePointsTable* gamepointstable_p; // table of the gamepoints

  unsigned seed_first_p; // starting random seed
  unsigned startplayer_first_p; // starting startplayer
  unsigned seed_p; // random seed
  unsigned startplayer_p; // startplayer

  // set_ai_players
  // partie typ (tutorial...)
  // pflichtstsoli
  // punkte topf
  // tunier status

  private: // not to be used
  Party(Party const&);
  Party& operator=(Party const&);

}; // class Party

ostream& operator<<(ostream& ostr, Party const& p);

extern Party party;

#endif // #ifdef CLASS_PARTY_HEADER
