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
23#include "sector.h"
24#include "planet.h"
25#include "map/map.h"
26
27//---------------------------------------------------------------------------
28// class Sector
29//---------------------------------------------------------------------------
30
31Sector::Sector()
32 : m_map(NULL ),
33 m_coord( 0,0 ),
34 m_planet( NULL )
35{}
36
37Sector::Sector( Map *map, Coordinate coord )
38 : m_map( map ),
39 m_coord( coord ),
40 m_planet(NULL)
41{
42}
43
44Sector::Sector( const Sector & other )
45 : QObject( 0 ),
46 m_map(other.m_map),
47 m_coord(other.m_coord),
48 m_planet(other.m_planet)
49{
50}
51
52
53void Sector::setPlanet( Planet *planet )
54{
55 m_planet = planet;
56
57 connect( m_planet, SIGNAL( update() ), this, SLOT( childPlanetUpdate() ) );
58
59 emit update();
60}
61
62void Sector::removePlanet()
63{
64 m_planet = NULL;
65
66 emit update();
67}
68
69
70void Sector::childPlanetUpdate()
71{
72 emit update();
73}
74
75Sector &
76Sector::operator=( const Sector &other )
77{
78 m_coord = other.m_coord;
79 m_planet = other.m_planet;
80 m_map = other.m_map;
81
82 return *this;
83}
84