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_ESTATE_H 0018 #define LIBATLANTIC_ESTATE_H 0019 0020 #include <QObject> 0021 #include <QColor> 0022 0023 #include "libatlantic_export.h" 0024 0025 class EstateGroup; 0026 class Player; 0027 0028 class LIBATLANTIC_EXPORT Estate : public QObject 0029 { 0030 Q_OBJECT 0031 0032 public: 0033 Estate(int estateId); 0034 int id() const { return m_id; } 0035 void setName(const QString& name); 0036 QString name() const; 0037 void setEstateGroup(EstateGroup *estateGroup); 0038 EstateGroup *estateGroup() const { return m_estateGroup; } 0039 void setOwner(Player *player); 0040 bool isOwned() const; 0041 bool isOwnedBySelf() const; 0042 Player *owner() const { return m_owner; } 0043 void setHouses(unsigned int houses); 0044 unsigned int houses() const { return m_houses; } 0045 void setCanBeOwned(bool canBeOwned); 0046 bool canBeOwned() const { return m_canBeOwned; } 0047 void setCanBuyHouses(bool canBuyHouses); 0048 bool canBuyHouses() const { return m_canBuyHouses; } 0049 void setCanSellHouses(bool canSellHouses); 0050 bool canSellHouses() const { return m_canSellHouses; } 0051 void setHousePrice(unsigned int housePrice); 0052 unsigned int housePrice() const { return m_housePrice; } 0053 void setHouseSellPrice(unsigned int houseSellPrice); 0054 unsigned int houseSellPrice() const { return m_houseSellPrice; } 0055 void setIsMortgaged(bool isMortgaged); 0056 bool isMortgaged() const { return m_isMortgaged; } 0057 void setCanToggleMortgage(bool canToggleMortgage); 0058 bool canToggleMortgage() const { return m_canToggleMortgage; } 0059 void setMortgagePrice(unsigned int mortgagePrice); 0060 unsigned int mortgagePrice() const { return m_mortgagePrice; } 0061 void setUnmortgagePrice(unsigned int unmortgagePrice); 0062 unsigned int unmortgagePrice() const { return m_unmortgagePrice; } 0063 void setColor(QColor color); 0064 QColor color() const { return m_color; } 0065 void setBgColor(QColor color); 0066 QColor bgColor() const { return m_bgColor; } 0067 void setPrice(unsigned int price); 0068 unsigned int price() const { return m_price; } 0069 void setMoney(int money); 0070 int money() const; 0071 void setIcon(const QString &icon); 0072 QString icon() const { return m_icon; } 0073 void update(bool force = false); 0074 0075 Q_SIGNALS: 0076 void changed(); 0077 void estateToggleMortgage(Estate *estate); 0078 void estateHouseBuy(Estate *estate); 0079 void estateHouseSell(Estate *estate); 0080 void estateSell(Estate *estate); 0081 void newTrade(Player *player); 0082 void LMBClicked(Estate *estate); 0083 0084 protected: 0085 bool m_changed; 0086 int m_id; 0087 0088 private: 0089 QString m_name, m_icon; 0090 Player *m_owner; 0091 EstateGroup *m_estateGroup; 0092 unsigned int m_houses, m_price, m_housePrice, m_houseSellPrice, m_mortgagePrice, m_unmortgagePrice; 0093 int m_money; 0094 bool m_canBeOwned : 1, m_canBuyHouses : 1, m_canSellHouses : 1, m_isMortgaged : 1, m_canToggleMortgage : 1; 0095 QColor m_bgColor, m_color; 0096 }; 0097 0098 #endif