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_SECTOR_H |
23 | #define KONQUEST_SECTOR_H |
24 | |
25 | #include <QObject> |
26 | #include <QPoint> |
27 | |
28 | class Map; |
29 | class Planet; |
30 | |
31 | // ------------------------------------------------------------------------- |
32 | // Typedefs |
33 | // ------------------------------------------------------------------------- |
34 | |
35 | typedef QPoint Coordinate; // Gotta start using this instead of int x,y crap |
36 | |
37 | // *************************************************************** |
38 | // class Sector |
39 | // *************************************************************** |
40 | |
41 | class Sector : public QObject |
42 | { |
43 | Q_OBJECT |
44 | |
45 | public: |
46 | |
47 | // constructors |
48 | Sector(); |
49 | Sector( Map *parentMap, Coordinate c ); |
50 | Sector( const Sector & ); |
51 | |
52 | // assignment operator (makes initialization easy) |
53 | Sector &operator=( const Sector & ); |
54 | |
55 | Coordinate coord() const { return m_coord; } |
56 | bool hasPlanet() const { return m_planet != NULL; } |
57 | Planet *planet() const { return m_planet; } |
58 | void setPlanet( Planet *planet ); |
59 | void removePlanet(); |
60 | |
61 | signals: |
62 | void update(); |
63 | |
64 | protected slots: |
65 | void childPlanetUpdate( ); |
66 | |
67 | |
68 | protected: |
69 | Map *m_map; |
70 | Coordinate m_coord; |
71 | Planet *m_planet; // a sector has 0 or 1 planets |
72 | }; |
73 | |
74 | |
75 | #endif // KONQUEST_SECTOR_H |
76 | |