File indexing completed on 2024-04-14 14:31:58

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_CORE_H
0018 #define LIBATLANTIC_CORE_H
0019 
0020 #include <QList>
0021 #include <QObject>
0022 
0023 #include "libatlantic_export.h"
0024 
0025 class Player;
0026 class Estate;
0027 class EstateGroup;
0028 class Game;
0029 class Trade;
0030 class Auction;
0031 class Card;
0032 
0033 class LIBATLANTIC_EXPORT AtlanticCore : public QObject
0034 {
0035 Q_OBJECT
0036 
0037 public:
0038     AtlanticCore(QObject *parent);
0039 
0040     void reset(bool deletePermanents = false);
0041 
0042     bool selfIsMaster() const;
0043 
0044     void setPlayerSelf(Player *player);
0045     Player *playerSelf() const;
0046 
0047     QList<Player *> players() const;
0048     Player *newPlayer(int playerId, bool playerSelf = false);
0049     Player *findPlayer(int playerId) const;
0050     void removePlayer(Player *player);
0051 
0052     QList<Game *> games() const;
0053     Game *newGame(int gameId, const QString &type = QString());
0054     Game *findGame(const QString &type) const; // finds game types
0055     Game *findGame(int gameId) const; // finds actual games
0056     Game *gameSelf() const;
0057     void removeGame(Game *game);
0058     void emitGames();
0059 
0060     QList<Estate *> estates() const;
0061     Estate *newEstate(int estateId);
0062     Estate *findEstate(int estateId) const;
0063     Estate *estateAfter(Estate *estate) const;
0064 
0065     QList<EstateGroup *> estateGroups() const;
0066     EstateGroup *newEstateGroup(int groupId);
0067     EstateGroup *findEstateGroup(int groupId) const;
0068 
0069     QList<Trade *> trades() const;
0070     Trade *newTrade(int tradeId);
0071     Trade *findTrade(int tradeId) const;
0072     void removeTrade(Trade *trade);
0073 
0074     QList<Auction *> auctions() const;
0075     Auction *newAuction(int auctionId, Estate *estate);
0076     Auction *findAuction(int auctionId) const;
0077     void delAuction(Auction *auction);
0078 
0079     QList<Card *> cards() const;
0080     Card *newCard(int cardId);
0081     Card *findCard(int cardId) const;
0082 
0083     void printDebug() const;
0084 
0085 Q_SIGNALS:
0086     void createGUI(Player *player);
0087     void removeGUI(Player *player);
0088     void createGUI(Game *game);
0089     void removeGUI(Game *game);
0090     void createGUI(Trade *trade);
0091     void removeGUI(Trade *trade);
0092 
0093 private:
0094     Player *m_playerSelf;
0095     QList<Player *> m_players;
0096     QList<Game *> m_games;
0097     QList<Estate *> m_estates;
0098     QList<EstateGroup *> m_estateGroups;
0099     QList<Trade *> m_trades;
0100     QList<Auction *> m_auctions;
0101     QList<Card *> m_cards;
0102 };
0103 
0104 #endif