File indexing completed on 2024-04-21 15:08:00

0001 // Copyright (c) 2002-2003 Rob Kaper <cap@capsi.com>
0002 //
0003 // This library is free software; you can redistribute it and/or
0004 // modify it under the terms of the GNU Lesser General Public
0005 // License version 2.1 as published by the Free Software Foundation.
0006 //
0007 // This library is distributed in the hope that it will be useful,
0008 // but WITHOUT ANY WARRANTY; without even the implied warranty of
0009 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0010 // Lesser General Public License for more details.
0011 //
0012 // You should have received a copy of the GNU Lesser General Public License
0013 // along with this library; see the file COPYING.LIB.  If not, write to
0014 // the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0015 // Boston, MA 02110-1301, USA.
0016 
0017 #ifndef LIBATLANTIC_PLAYER_H
0018 #define LIBATLANTIC_PLAYER_H
0019 
0020 #include <QObject>
0021 
0022 #include "libatlantic_export.h"
0023 
0024 class Estate;
0025 class Game;
0026 
0027 class LIBATLANTIC_EXPORT Player : public QObject
0028 {
0029 Q_OBJECT
0030 
0031 public:
0032     Player(int playerId);
0033 
0034     int id() const { return m_id; }
0035     void setGame(Game *game);
0036     Game *game() const;
0037     void setLocation(Estate *location);
0038     Estate *location() const { return m_location; }
0039     void setDestination(Estate *destination);
0040     Estate *destination() const { return m_destination; }
0041     void setIsSelf(bool isSelf) { m_isSelf = isSelf; }
0042     bool isSelf() const { return m_isSelf; }
0043     void setBankrupt(bool bankrupt);
0044     bool isBankrupt() const { return m_bankrupt; }
0045     void setHasDebt(bool hasDebt);
0046     bool hasDebt() const { return m_hasDebt; }
0047     void setHasTurn(bool hasTurn);
0048     bool hasTurn() const { return m_hasTurn; }
0049     void setCanRoll(bool canRoll);
0050     bool canRoll() const { return m_canRoll; }
0051     void setCanBuy(bool canBuy);
0052     bool canBuy() const { return m_canBuy; }
0053     void setCanAuction(bool canAuction);
0054     bool canAuction() const { return m_canAuction; }
0055     void setCanUseCard(bool canUseCard);
0056     bool canUseCard() const { return m_canUseCard; }
0057     void setInJail(bool inJail);
0058     bool inJail() const { return m_inJail; }
0059     void setName(const QString &_n);
0060     QString name() const { return m_name; }
0061     void setHost(const QString &host);
0062     QString host() const { return m_host; }
0063     void setImage(const QString &image);
0064     const QString image() const { return m_image; }
0065     void setMoney(unsigned int _m);
0066     unsigned int money() const { return m_money; }
0067     void setSpectator(bool spectator);
0068     bool isSpectator() const { return m_spectator; }
0069     void update(bool force = false);
0070 
0071 Q_SIGNALS:
0072     void changed(Player *player);
0073     void gainedTurn();
0074 
0075 private:
0076     int m_id;
0077     bool m_changed : 1, m_isSelf : 1;
0078     bool m_bankrupt : 1, m_hasDebt : 1, m_hasTurn : 1, m_canRoll : 1, m_canBuy : 1, m_canAuction : 1, m_canUseCard : 1, m_inJail : 1;
0079     bool m_spectator : 1;
0080     unsigned int m_money;
0081     QString m_name, m_host, m_image;
0082     Game *m_game;
0083     Estate *m_location, *m_destination;
0084 };
0085 
0086 #endif