StarTrekV3_Linux  Version3
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros Pages
Universe.h
Go to the documentation of this file.
1 //
2 // ___.--------._____________,------' -----.`----._
3 // \ ` - . _ /\
4 // `.__________ ` - | | __,---"-._
5 // `-----------.______ ,'_/ ________,------'___________`----.___________
6 // `-----.____,' \===========================================/
7 // | :| >--------------.----------.---------------'
8 // / :| _,--' ,--' `--.__.--'
9 // / : |--'______________/_
10 // ,---,' : \__________________`--.
11 // `__________ |/|
12 // `------._ |\|
13 // `--._________,-'
14 //
15 //
16 //
17 // Credits go to Paramount pictures for the star - trek concept and universe.
18 
19 
20 // Copyright (C) 2015 - 2016 E.J.M. Martens
21 //
22 // This program is free software; you can redistribute it and/or
23 // modify it under the terms of the GNU General Public License
24 // as published by the Free Software Foundation; either version 2
25 // of the License, or (at your option) any later version.
26 //
27 // This program is distributed in the hope that it will be useful,
28 // but WITHOUT ANY WARRANTY; without even the implied warranty of
29 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 // GNU General Public License for more details.
31 //
32 // You should have received a copy of the GNU General Public License
33 // along with this program; if not, write to the Free Software
34 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
35 
36 
37 
38 #ifndef _UNIVERSE
39 #define _UNIVERSE
40 
41 
42 #include "types.h"
43 #include "Engine.h"
44 #include "SpaceObject.h"
45 #include "Starbase.h"
46 #include <vector>
47 #include <math.h>
48 
49 
50 
51 class TStarbase;
52 
54 {
55  friend class TEnterprise;
56 
57 public:
60  int m_nX;
61  int m_nY;
63  GamePlanetRec();
64 };
65 
67 {
68  friend class TEnterprise;
69 
70 public:
73  int m_nX;
74  int m_nY;
76 };
77 
78 
80 {
81  friend class TEnterprise;
82 
83 public:
86  int m_nX;
87  int m_nY;
88  int m_nHealth[11];
89  GameStarbaseRec(ID a_nStarbaseType);
90 };
91 
92 
93 
94 
95 class Sector
96 {
97  friend class TEnterprise;
98 
99 private:
100 bool m_blKnown;
101 char m_nMember;
102 char m_nKlingonBC;
103 char m_nKlingonBOP;
104 char m_nRomulanBOP;
105 char m_nFederation1;
106 char m_nFederation2;
107 char m_nFederation3;
108 
109 
110 vector<GamePlanetRec> m_Planet;
111 vector<GameSpecialRec> m_Special;
112 vector<GameStarbaseRec> m_Starbase;
113 
114 void StoreStarbase(TStarbase * a_pStarbase);
115 void StorePlanet (TSpaceObject * a_pPlanet);
116 void StoreSpecial (TSprite * a_pSprite);
117 
118 public:
120 Sector();
121 
122 void Build(TEngine * a_pEngine);
123 void Store(TEngine * a_pEngine);
124 
125 void Save(ofstream & a_SaveStream);
126 void Load(ifstream & a_LoadStream);
127 
128 void Clear();
129 
130 friend class Universe;
131 };
132 
133 
134 
135 
136 class Universe
137 {
138  friend class TEnterprise;
139 
140 private:
141  Sector m_nSector[UNIVERSE_SIZE][UNIVERSE_SIZE];
142  int m_nHomeX;
143  int m_nHomeY;
144 
145 protected:
146  void BuildFederationSpace();
147  void BuildKlingonSpace();
148  void BuildRomulanSpace();
149 
150  void GenerateStarSystems();
151  void GenerateBlueStarSystem(Sector & a_Sector);
152  void GenerateWhiteStarSystem(Sector & a_Sector);
153  void GenerateYellowStarSystem(Sector & a_Sector);
154  void GenerateRedStarSystem(Sector & a_Sector);
155 
156  void GenerateHomeSector(Sector & a_Sector);
157 
158 public:
159 
160 
162  int GetHomeX();
163  int GetHomeY();
164 
165  Universe();
166 
167  void Generate();
168  void BuildSector(int a_nX, int a_nY,TEngine * a_pEngine);
169  void StoreSector(int a_nX, int a_nY,TEngine * a_pEngine);
170 
171  void Save(ofstream & a_SaveStream);
172  void Load(ifstream & a_LoadStream);
173 
174 };
175 
176 
177 #endif
GamePlanetRec()
Definition: Universe.cpp:36
void BuildSector(int a_nX, int a_nY, TEngine *a_pEngine)
Definition: Universe.cpp:497
Universe()
Definition: Universe.cpp:508
int m_nX
Definition: Universe.h:60
void BuildRomulanSpace()
Definition: Universe.cpp:892
void GenerateStarSystems()
Definition: Universe.cpp:525
MEMBER m_Member
Definition: Universe.h:84
Definition: Universe.h:53
int m_nX
Definition: Universe.h:73
void BuildFederationSpace()
Definition: Universe.cpp:799
void GenerateWhiteStarSystem(Sector &a_Sector)
Definition: Universe.cpp:590
Definition: Universe.h:136
int m_nX
Definition: Universe.h:86
GameSpecialRec()
Definition: Universe.cpp:45
ID m_StarbaseType
Definition: Universe.h:85
MEMBER m_Member
Definition: Universe.h:71
void Save(ofstream &a_SaveStream)
Definition: Universe.cpp:406
void Generate()
Definition: Universe.cpp:936
Definition: Engine.h:131
Definition: Universe.h:79
Definition: Engine.h:274
ID m_SpecialType
Definition: Universe.h:72
GameStarbaseRec(ID a_nStarbaseType)
Definition: Universe.cpp:54
GamePlanetRec * GetPlanetForStarbase()
Definition: Universe.cpp:267
void BuildKlingonSpace()
Definition: Universe.cpp:846
void StoreSector(int a_nX, int a_nY, TEngine *a_pEngine)
Definition: Universe.cpp:502
int m_nSectorCenter
Definition: Universe.h:161
Definition: SpaceObject.h:45
Definition: Universe.h:95
MEMBER
Definition: types.h:133
void Save(ofstream &a_SaveStream)
Definition: Universe.cpp:948
void Load(ifstream &a_LoadStream)
Definition: Universe.cpp:962
#define UNIVERSE_SIZE
Definition: types.h:94
int m_nY
Definition: Universe.h:74
void GenerateBlueStarSystem(Sector &a_Sector)
Definition: Universe.cpp:556
Definition: Enterprise.h:49
void GenerateHomeSector(Sector &a_Sector)
Definition: Universe.cpp:748
ID m_PlanetType
Definition: Universe.h:59
int m_nY
Definition: Universe.h:87
void Store(TEngine *a_pEngine)
Definition: Universe.cpp:348
void Build(TEngine *a_pEngine)
Definition: Universe.cpp:129
MEMBER m_Member
Definition: Universe.h:58
Definition: Universe.h:66
void GenerateRedStarSystem(Sector &a_Sector)
Definition: Universe.cpp:709
int m_nPopulation
Definition: Universe.h:62
int GetHomeY()
Definition: Universe.cpp:519
int GetHomeX()
Definition: Universe.cpp:514
Definition: Starbase.h:50
Sector()
Definition: Universe.cpp:101
int m_nHealth[11]
Definition: Universe.h:88
int m_nY
Definition: Universe.h:61
void GenerateYellowStarSystem(Sector &a_Sector)
Definition: Universe.cpp:637
void Clear()
Definition: Universe.cpp:114
void Load(ifstream &a_LoadStream)
Definition: Universe.cpp:449
ID
Definition: types.h:170