| 1 |
// Copyright © 2001-2003 Rob Kaper <[email protected]>, |
| 2 |
// 2001 Erik Bourget <[email protected]> |
| 3 |
// 2010-2015 Sylvain Rochet <[email protected]> |
| 4 |
// |
| 5 |
// This program is free software; you can redistribute it and/or |
| 6 |
// modify it under the terms of the GNU General Public License |
| 7 |
// version 2 as published by the Free Software Foundation. |
| 8 |
// |
| 9 |
// This program is distributed in the hope that it will be useful, |
| 10 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 |
// General Public License for more details. |
| 13 |
// |
| 14 |
// You should have received a copy of the GNU General Public License |
| 15 |
// along with this program; see the file COPYING. If not, see |
| 16 |
// <http://www.gnu.org/licenses/>. |
| 17 |
|
| 18 |
#ifndef MONOP_PLAYER_H |
| 19 |
#define MONOP_PLAYER_H |
| 20 |
|
| 21 |
#include <vector> |
| 22 |
#include <string> |
| 23 |
|
| 24 |
#include "gameobject.h" |
| 25 |
|
| 26 |
class Card; |
| 27 |
class Client; |
| 28 |
class Display; |
| 29 |
class Estate; |
| 30 |
class Game; |
| 31 |
class Socket; |
| 32 |
|
| 33 |
class Player : public GameObject |
| 34 |
{ |
| 35 |
public: |
| 36 |
Player(Socket *socket); |
| 37 |
virtual ~Player(); |
| 38 |
|
| 39 |
void reset(bool removeProperties = true); |
| 40 |
void identify(int id); |
| 41 |
bool identified() { return m_identified; }; |
| 42 |
void ioWrite(const char *, ...); |
| 43 |
void ioWrite(std::string data); |
| 44 |
void ioInfo(const char *data, ...); |
| 45 |
void ioInfo(const std::string data); |
| 46 |
void ioError(const char *data, ...); |
| 47 |
void ioError(const std::string data); |
| 48 |
void ioNoSuchCmd(const std::string data = ""); |
| 49 |
|
| 50 |
void sendDisplayMsg(Display *display); |
| 51 |
void sendDisplayHistory(); |
| 52 |
void sendClientMsg(); |
| 53 |
void sendCardList(Player *pOut); |
| 54 |
|
| 55 |
void rollDice(); |
| 56 |
void endTurn(bool userRequest = false); |
| 57 |
void payJail(); |
| 58 |
void rollJail(); |
| 59 |
void useJailCard(); |
| 60 |
void buyEstate(); |
| 61 |
void sellEstate(int estateId); |
| 62 |
void mortgageEstate(int estateId); |
| 63 |
void payTax(const bool percentage = false); |
| 64 |
void buyHouse(int estateId); |
| 65 |
void sellHouse(int estateId); |
| 66 |
void updateTradeObject(char *data); |
| 67 |
void updateTradeMoney(char *data); |
| 68 |
|
| 69 |
void setTurn(const bool& turn); |
| 70 |
void setGame(Game *game); |
| 71 |
void setEstate(Estate *estate); |
| 72 |
Estate *estate(); |
| 73 |
void setDestination(Estate *estate); |
| 74 |
Estate *destination(); |
| 75 |
void setTokenLocation(Estate *estate); |
| 76 |
Estate *tokenLocation(); |
| 77 |
void addCard(Card *card); |
| 78 |
void takeCard(Card *card); |
| 79 |
Card *findCard(int cardId); |
| 80 |
Card *findOutOfJailCard(); |
| 81 |
Card *findFirstCard(); |
| 82 |
int assets(); |
| 83 |
|
| 84 |
void setSocket(Socket *socket); |
| 85 |
Socket *socket() { return m_socket; } |
| 86 |
|
| 87 |
void toJail(Estate *jailEstate); |
| 88 |
|
| 89 |
void advance(int pos, bool direct); |
| 90 |
void advanceTo(int pos, bool direct, bool passEstates = true); |
| 91 |
|
| 92 |
void addMoney(int); |
| 93 |
bool payMoney(int); |
| 94 |
|
| 95 |
private: |
| 96 |
void sendDisplay(Display *display); |
| 97 |
|
| 98 |
// Connection related |
| 99 |
Socket *m_socket; |
| 100 |
|
| 101 |
// Game related |
| 102 |
Estate *m_estate, *m_destination, *m_tokenLocation; |
| 103 |
std::vector<Card *> m_cards; |
| 104 |
std::vector<Display *> m_display; |
| 105 |
|
| 106 |
bool m_identified; |
| 107 |
}; |
| 108 |
|
| 109 |
#endif // MONOP_PLAYER_H |