2
Copyright Russell Steffen <rsteffen@bayarea.net>
3
Copyright Stephan Zehetner <s.zehetner@nevox.org>
4
Copyright Dmitry Suzdalev <dimsuz@gmail.com>
5
Copyright <inge@lysator.liu.se>
6
Copyright <pinaraf@gmail.com>
8
This program is free software; you can redistribute it and/or modify
9
it under the terms of the GNU General Public License as published by
10
the Free Software Foundation; either version 2 of the License, or
11
(at your option) any later version.
13
This program is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
GNU General Public License for more details.
18
You should have received a copy of the GNU General Public License
19
along with this program; if not, write to the Free Software
20
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
34
//**************************************************************
36
//**************************************************************
41
Player( Map *map, const QString &newName, const QColor &color, int number );
44
bool operator==( const Player &otherPlayer ) const
45
{ return m_playerNum == otherPlayer.m_playerNum; }
47
enum { NEUTRAL_PLAYER_NUMBER = -1 };
49
// Getters for some fundamental properties.
50
QString name() const { return m_name; }
51
QString coloredName() const;
52
QColor& color() { return m_color; }
53
bool isNeutral() const { return m_playerNum == NEUTRAL_PLAYER_NUMBER; }
54
AttackFleetList &attackList() { return m_attackList; }
55
AttackFleetList &newAttacks() { return m_newAttacks; }
58
static Player *createPlayer( Map *map, const QString &name,
60
int playerNum, bool isAi );
61
static Player *createNeutralPlayer( Map *map );
63
bool NewAttack( Planet *sourcePlanet, Planet *destPlanet, int shipCount, int departureTurn );
65
bool isInPlay() const { return m_inPlay; }
66
void setInPlay( bool status ) { m_inPlay = status; }
67
virtual bool isAiPlayer() const { return false; }
70
// Statistics collection
71
void statShipsBuilt( int x ) { m_shipsBuilt += x; }
72
void statPlanetsConquered( int x ) { m_planetsConquered += x; }
73
void statFleetsLaunched( int x ) { m_fleetsLaunched += x; }
74
void statEnemyFleetsDestroyed( int x ) { m_enemyFleetsDestroyed += x; }
75
void statEnemyShipsDestroyed( int x ) { m_enemyShipsDestroyed += x; }
77
int shipsBuilt() const { return m_shipsBuilt; }
78
int planetsConquered() const { return m_planetsConquered; }
79
int fleetsLaunched() const { return m_fleetsLaunched; }
80
int enemyFleetsDestroyed() const { return m_enemyFleetsDestroyed; }
81
int enemyShipsDestroyed() const { return m_enemyShipsDestroyed; }
84
// Points to the Map we're playing on.
87
// Some fundamental properties.
93
// Attack fleets sent by this player that are still moving
94
AttackFleetList m_attackList;
95
// Fleets to send at the end of this turn
96
AttackFleetList m_newAttacks;
98
// statistics counters
100
int m_planetsConquered;
101
int m_fleetsLaunched;
102
int m_enemyFleetsDestroyed;
103
int m_enemyShipsDestroyed;
107
class AIPlayer : public Player
110
AIPlayer( Map *map, const QString &name, const QColor &color, int number );
113
virtual bool isAiPlayer() const { return true; }
115
void doMove( GameLogic *gameLogic);
117
int getAiLevel() { return m_AiLevel; }