File indexing completed on 2024-02-25 04:09:20

0001 /*
0002     SPDX-FileCopyrightText: 2003 Russell Steffen <rsteffen@bayarea.net>
0003     SPDX-FileCopyrightText: 2003 Stephan Zehetner <s.zehetner@nevox.org>
0004     SPDX-FileCopyrightText: 2006 Dmitry Suzdalev <dimsuz@gmail.com>
0005     SPDX-FileCopyrightText: 2006 Inge Wallin <inge@lysator.liu.se>
0006     SPDX-FileCopyrightText: 2006 Pierre Ducroquet <pinaraf@gmail.com>
0007 
0008     SPDX-License-Identifier: GPL-2.0-or-later
0009 */
0010 
0011 #ifndef KONQUEST_SECTOR_H
0012 #define KONQUEST_SECTOR_H
0013 
0014 #include <QObject>
0015 #include <QPoint>
0016 
0017 class Map;
0018 class Planet;
0019 
0020 // -------------------------------------------------------------------------
0021 // Typedefs
0022 // -------------------------------------------------------------------------
0023 
0024 typedef QPoint Coordinate;  // Gotta start using this instead of int x,y crap
0025 
0026 // ***************************************************************
0027 // class Sector
0028 // ***************************************************************
0029 
0030 class Sector : public QObject
0031 {
0032     Q_OBJECT
0033 
0034 public:
0035 
0036     // constructors
0037     Sector();
0038     Sector( Map *parentMap, Coordinate c );
0039     Sector( const Sector & );
0040 
0041     // assignment operator (makes initialization easy)
0042     Sector &operator=( const Sector & );
0043 
0044     Coordinate  coord()     const { return m_coord; }
0045     bool        hasPlanet() const { return m_planet != nullptr; }
0046     Planet     *planet()    const { return m_planet; }
0047     void        setPlanet( Planet *planet );
0048     void        removePlanet();
0049 
0050 Q_SIGNALS:
0051     void        update();
0052 
0053 protected:
0054     void        childPlanetUpdate( );
0055 
0056     Map        *m_map;
0057     Coordinate  m_coord;
0058     Planet     *m_planet;  // a sector has 0 or 1 planets
0059 };
0060 
0061 
0062 #endif // KONQUEST_SECTOR_H