initial commit, lordsawar source, slightly modified
[lordsawar] / src / NextTurnHotseat.h
1 // Copyright (C) 2003, 2004, 2005, 2006 Ulf Lorenz
2 // Copyright (C) 2007, 2008 Ben Asselstine
3 // Copyright (C) 2007, 2008 Ole Laursen
4 //
5 //  This program is free software; you can redistribute it and/or modify
6 //  it under the terms of the GNU General Public License as published by
7 //  the Free Software Foundation; either version 3 of the License, or
8 //  (at your option) any later version.
9 //
10 //  This program is distributed in the hope that it will be useful,
11 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 //  GNU Library General Public License for more details.
14 //
15 //  You should have received a copy of the GNU General Public License
16 //  along with this program; if not, write to the Free Software
17 //  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
18 //  02110-1301, USA.
19
20 #ifndef NEXT_TURN_HOTSEAT_H
21 #define NEXT_TURN_HOTSEAT_H
22
23 #include "NextTurn.h"
24
25 /**
26    \brief The class to pass turns around the players during a hotseat game.
27  
28    \note    This class takes care of calling the correct players in the correct
29             order. The problem is, no other class really has the scope of doing
30             this whole stuff. The playerlist and the game object aren't the
31             right candidates (they are busy with other things) and the former
32             algorithm of each player calling the next one produces a huge
33             stackload if two ai players fight each other. Plus, you want to do
34             several actions at the end or the beginning of each player's turn
35             or each round and therefore want a central place for this code.
36  */
37
38 class NextTurnHotseat: public NextTurn
39 {
40     public:
41         /**
42            \brief constructor
43
44            @param   turnmode    setting for the private variable d_turnmode
45            @param   random_turns change the order every round
46
47          */
48         NextTurnHotseat(bool turnmode, bool random_turns);
49
50         /**
51            \brief destructor
52          */
53         virtual ~NextTurnHotseat();
54         
55         /**
56            \brief start a new game
57           
58            This function starts with the currently active player, or the first
59            if there is none active. For starting a game. This should be the
60            lowest of all scenario-related functions in the stack.
61          */
62         void start();
63
64         /**
65            \brief go on to the next player
66            
67            This function starts the next to the active player's turn. Used when
68            a human player has pushed the next_turn button.
69          */
70         void endTurn();
71
72     private:
73         /**
74            \brief The function for all actions which are taken at the beginning
75            of a player's turn
76           */
77         void startTurn();
78         
79         /**
80            \brief The function for all actions which are taken at the end of a
81            player's turn
82          */
83         void finishTurn();
84
85         /**
86            \brief The function for all actions which are taken at the end of a
87            Game Turn.
88          */
89         void finishRound();
90 };
91
92 #endif //NEXT_TURN_HOTSEAT_H