forked from endless-sky/endless-sky-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlanet.h
105 lines (81 loc) · 3.3 KB
/
Planet.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/* Planet.h
Copyright (c) 2014 by Michael Zahniser
Endless Sky is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later version.
Endless Sky is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
*/
#ifndef PLANET_H_
#define PLANET_H_
#include <QString>
#include <limits>
#include <list>
#include <vector>
class DataNode;
class DataWriter;
class System;
// Class representing a stellar object you can land on. (This includes planets,
// moons, and space stations.) Each planet has a certain set of services that
// are available, as well as attributes that determine what sort of missions
// might choose it as a source or destination.
class Planet {
public:
// Load a planet's description from a file.
void Load(const DataNode &node);
void Save(DataWriter &file) const;
// Get the name of the planet.
const QString &Name() const;
// Get the planet's descriptive text.
const QString &Description() const;
// Get the landscape sprite.
const QString &Landscape() const;
// Get the list of "attributes" of the planet.
const std::vector<QString> &Attributes() const;
// Check whether there is a spaceport (which implies there is also trading,
// jobs, banking, and hiring).
bool HasSpaceport() const;
// Get the spaceport's descriptive text.
const QString &SpaceportDescription() const;
// Check if this planet has a shipyard.
bool HasShipyard() const;
// Get the list of ships in the shipyard.
const std::vector<QString> &Shipyard() const;
// Check if this planet has an outfitter.
bool HasOutfitter() const;
// Get the list of outfits available from the outfitter.
const std::vector<QString> &Outfitter() const;
// You need this good a reputation with this system's government to land here.
double RequiredReputation() const;
// This is what fraction of your fleet's value you must pay as a bribe in
// order to land on this planet. (If zero, you cannot bribe it.)
double Bribe() const;
// This is how likely the planet's authorities are to notice if you are
// doing something illegal.
double Security() const;
// Editing a planet:
void SetName(const QString &name);
void SetLandscape(const QString &sprite);
void SetDescription(const QString &text);
void SetSpaceportDescription(const QString &text);
std::vector<QString> &Attributes();
std::vector<QString> &Shipyard();
std::vector<QString> &Outfitter();
void SetRequiredReputation(double value);
void SetBribe(double value);
void SetSecurity(double value);
private:
QString name;
QString description;
QString spaceport;
QString landscape;
std::vector<QString> attributes;
std::vector<QString> shipyard;
std::vector<QString> outfitter;
double requiredReputation = std::numeric_limits<double>::quiet_NaN();
double bribe = std::numeric_limits<double>::quiet_NaN();
double security = std::numeric_limits<double>::quiet_NaN();
std::list<DataNode> unparsed;
};
#endif