blob: a4b26a57c2bd38342dbd926ba3aa3b6ad1d7cbf0 (
plain)
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
|
#pragma once
#include "StarCelestialCoordinate.hpp"
#include "StarWorldParameters.hpp"
namespace Star {
STAR_CLASS(CelestialParameters);
class CelestialParameters {
public:
CelestialParameters();
CelestialParameters(CelestialCoordinate coordinate, uint64_t seed, String name, Json parameters);
explicit CelestialParameters(Json const& diskStore);
explicit CelestialParameters(ByteArray netStore);
Json diskStore() const;
ByteArray netStore() const;
CelestialCoordinate coordinate() const;
String name() const;
uint64_t seed() const;
Json parameters() const;
Json getParameter(String const& name, Json def = Json()) const;
// Predictably select from a json array, given by the named parameter.
// Selects based on the name hash and the system seed.
Json randomizeParameterList(String const& name, int32_t mix = 0) const;
// Predictably select from a range, given by the named parameter. Works for
// either floating or integral ranges.
Json randomizeParameterRange(String const& name, int32_t mix = 0) const;
// Same function, but if you want to specify the range from an external source
Json randomizeParameterRange(JsonArray const& range, int32_t mix = 0, Maybe<String> const& name = {}) const;
// Not all worlds are visitable, if the world is not visitable its
// visitableParameters will be empty.
bool isVisitable() const;
VisitableWorldParametersConstPtr visitableParameters() const;
void setVisitableParameters(VisitableWorldParametersPtr const& newVisitableParameters);
private:
CelestialCoordinate m_coordinate;
uint64_t m_seed;
String m_name;
Json m_parameters;
VisitableWorldParametersConstPtr m_visitableParameters;
};
}
|