summaryrefslogtreecommitdiffstats
path: root/atlantik/libatlantic/atlantic_core.h
blob: 197fca9183a8c6f4ec3a73cf1605416774719922 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// Copyright (c) 2002-2003 Rob Kaper <cap@capsi.com>
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License version 2.1 as published by the Free Software Foundation.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this library; see the file COPYING.LIB.  If not, write to
// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
// Boston, MA 02110-1301, USA.

#ifndef LIBATLANTIC_CORE_H
#define LIBATLANTIC_CORE_H

#include <tqobject.h>
#include <tqptrlist.h>

#include "libatlantic_export.h"

class Player;
class ConfigOption;
class Estate;
class EstateGroup;
class Game;
class Trade;
class Auction;

class LIBATLANTIC_EXPORT AtlanticCore : public QObject
{
Q_OBJECT

public:
	AtlanticCore(TQObject *parent, const char *name);

	void reset(bool deletePermanents = false);

	bool selfIsMaster() const;

	void setPlayerSelf(Player *player);
	Player *playerSelf();

	TQPtrList<Player> players();
	Player *newPlayer(int playerId, const bool &playerSelf = false);
	Player *findPlayer(int playerId);
	void removePlayer(Player *player);

	TQPtrList<Game> games();
	Game *newGame(int gameId, const TQString &type = TQString::null);
	Game *findGame(const TQString &type); // finds game types
	Game *findGame(int gameId); // finds actual games
	Game *gameSelf();
	void removeGame(Game *game);
	void emitGames();

	TQPtrList<Estate> estates();
	Estate *newEstate(int estateId);
	Estate *findEstate(int estateId);
	Estate *estateAfter(Estate *estate);

	TQPtrList<EstateGroup> estateGroups();
	EstateGroup *newEstateGroup(int groupId);
	EstateGroup *findEstateGroup(int groupId);

	TQPtrList<Trade> trades();
	Trade *newTrade(int tradeId);
	Trade *findTrade(int tradeId);
	void removeTrade(Trade *trade);

	TQPtrList<Auction> auctions();
	Auction *newAuction(int auctionId, Estate *estate);
	void delAuction(Auction *auction);

	ConfigOption *newConfigOption(int configId);
	void removeConfigOption(ConfigOption *configOption);
	ConfigOption *findConfigOption(int configId);

	void printDebug();

signals:
	void createGUI(Player *player);
	void removeGUI(Player *player);
	void createGUI(Game *game);
	void removeGUI(Game *game);
	void createGUI(Trade *trade);
	void removeGUI(Trade *trade);
	void createGUI(ConfigOption *configOption);
	void removeGUI(ConfigOption *configOption);

private:
	Player *m_playerSelf;
	TQPtrList<Player> m_players;
	TQPtrList<Game> m_games;
	TQPtrList<Estate> m_estates;
	TQPtrList<EstateGroup> m_estateGroups;
	TQPtrList<Trade> m_trades;
	TQPtrList<Auction> m_auctions;
	TQPtrList<ConfigOption> m_configOptions;
};

#endif