1 | /* |
2 | Copyright 2003 Russell Steffen <rsteffen@bayarea.net> |
3 | Copyright 2003 Stephan Zehetner <s.zehetner@nevox.org> |
4 | Copyright 2006 Dmitry Suzdalev <dimsuz@gmail.com> |
5 | Copyright 2006 Inge Wallin <inge@lysator.liu.se> |
6 | Copyright 2006 Pierre Ducroquet <pinaraf@gmail.com> |
7 | |
8 | This program is free software; you can redistribute it and/or modify |
9 | it under the terms of the GNU General Public License as published by |
10 | the Free Software Foundation; either version 2 of the License, or |
11 | (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
21 | */ |
22 | #ifndef KONQUEST_FLEET_H |
23 | #define KONQUEST_FLEET_H |
24 | |
25 | #include <QObject> |
26 | |
27 | class Player; |
28 | class Planet; |
29 | |
30 | //********************************************************** |
31 | // class Fleet |
32 | // +--- class AttackFleet |
33 | // +--- class DefenseFleet |
34 | //********************************************************** |
35 | |
36 | class Fleet : public QObject |
37 | { |
38 | Q_OBJECT |
39 | |
40 | public: |
41 | |
42 | explicit Fleet( int initialShipCount ); |
43 | virtual ~Fleet() {} |
44 | |
45 | int shipCount() const { return m_shipCount; } |
46 | void removeShips( int lostShips ); |
47 | |
48 | protected: |
49 | int m_shipCount; |
50 | }; |
51 | |
52 | |
53 | class AttackFleet : public Fleet |
54 | { |
55 | Q_OBJECT |
56 | public: |
57 | AttackFleet( Planet *src, Planet *dest, int initialCount, int arrivalTurn ); |
58 | |
59 | Player *owner; |
60 | Planet *source; |
61 | Planet *destination; |
62 | int arrivalTurn; |
63 | }; |
64 | |
65 | |
66 | class DefenseFleet : public Fleet |
67 | { |
68 | Q_OBJECT |
69 | |
70 | public: |
71 | DefenseFleet( Planet *newHome, int initialCount ); |
72 | |
73 | void absorb( AttackFleet *fleet ); |
74 | void become( AttackFleet *fleet ); |
75 | |
76 | void addShips( int newShips ); |
77 | |
78 | AttackFleet *spawnAttackFleet( Planet *destination, int shipCount, int arrivalTurn ); |
79 | |
80 | Planet *home; |
81 | signals: |
82 | void update(); |
83 | }; |
84 | |
85 | typedef QList<AttackFleet *> AttackFleetList; |
86 | |
87 | #endif // KONQUEST_FLEET_H |
88 | |