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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
|
// Copyright 2022-2023 Gabriel Bjørnager Jensen.
#pragma once
#include <bow/base.hxx>
#include <cstdint>
#include <string>
#include <type_traits>
namespace bow {
constexpr double DISTANCE_MODIFIER = 0x1.16A5D2D360000000p037; // 1 astronomical unit
constexpr double MASS_MODIFIER = 0x1.91930A5E75F0C192p100; // 1 solar mass
constexpr double TIME_MODIFIER = 0x1.0000000000000000p012; // 1 second
constexpr double GRAVITY_FACTOR = (::bow::MASS_MODIFIER * (::bow::TIME_MODIFIER * ::bow::TIME_MODIFIER)) / ((::bow::DISTANCE_MODIFIER * ::bow::DISTANCE_MODIFIER * ::bow::DISTANCE_MODIFIER)); // Inverse.
constexpr double GRAVITY_VALUE = 0x1.258688101B4BB16Dp-34 * ::bow::GRAVITY_FACTOR; // gravitational constant (s^2*m*t^2)
enum struct Ware: ::std::uint8_t {
AcidsAndBases,
Air,
AlcoholicBeverages,
AncientArtefacts,
AnimalMeats,
Atomics,
Batteries,
BattleWeapons,
Beer,
Biowaste,
Cameras,
Cannabis,
ChemicalWaste,
Clothing,
CoffeeAndTea,
ComputerParts,
Computers,
ComputerSoftware,
Cuttlery,
Dairy,
Drones,
ElectronicComponents,
EncryptedData,
EnergyGenerators,
Explosives,
Films,
FruitsAndVegetables,
Gemstones,
HandWeapons,
HullParts,
Hypnotics,
Ivory,
Jewellry,
Lasers,
LiveAnimals,
LuxuryGoods,
Machinery,
Magnets,
Medicine,
Minerals,
Money,
Monitors,
Music,
Narcotics,
NerveAgents,
NobleGases,
NobleMetals,
OrganicDyes,
Paper,
Pearls,
Pesticides,
Petroleums,
Pharmaceuticals,
Pornography,
Probes,
ProtiumFuel,
Radioactives,
Recyclables,
Robots,
Rockets,
Rubbish,
ScientificInstruments,
SkinsAndFurs,
Slaves,
Soils,
Spirits,
StorageDevices,
Superconductors,
SyntheticDyes,
SyntheticMeat,
Tobacco,
TritiumFuel,
VirtualIntelligences,
Water,
Wine,
XenoRelics,
};
enum struct ObjectType: ::std::uint8_t {
Canister,
Ship,
Star,
Station,
World,
};
class Object {
public:
::bow::ObjectType object_type;
::bow::Xyz<double> position; // astronomical units
::bow::Xyz<double> rotation; // radians
::bow::Xyz<double> positional_velocity; // astronomical units per second
::bow::Xyz<double> rotational_velocity; // radians per second
double mass; // kilograms
virtual ~Object() noexcept = default;
[[nodiscard]] virtual auto object_type_string() const noexcept -> ::std::string;
protected:
Object() noexcept = default;
};
template<typename T>
concept ObjectLike = ::std::is_base_of_v<::bow::Object, T>;
class Canister final: public ::bow::Object {
public:
::bow::Ware content;
Canister() noexcept;
[[nodiscard]] virtual auto object_type_string() const noexcept -> ::std::string;
};
class Ship final: public ::bow::Object {
public:
enum struct Type: ::std::uint8_t {
Aquila,
Cassiopeia,
Centaurus,
Corvus,
Cursor,
Eridanus,
Falco,
Lyra,
Taurus,
Ursa,
Vipera,
};
::bow::Ship::Type type;
Ship() noexcept;
[[nodiscard]] virtual auto object_type_string() const noexcept -> ::std::string;
[[nodiscard]] auto net_mass() noexcept -> double;
};
constexpr ::std::uint8_t MAXIMUM_SHIP_IDENTIFIER = static_cast<::std::uint8_t>(bow::Ship::Type::Vipera);
class Star final: public ::bow::Object {
public:
enum struct Type: ::std::uint8_t {
A, // Main sequence
B, // Main sequence
C, // Carbon
F, // Main sequence
G, // Main sequence
K, // Main sequence
L, // Brown dwarf
M, // Main sequence
N, // Neutron star
O, // Main sequence
S, // Carbon
T, // Brown dwarf
W, // Worm hole
X, // Black hole
Y, // Brown dwarf
Z, // White hole
};
::bow::Star::Type type;
Star() noexcept;
[[nodiscard]] virtual auto object_type_string() const noexcept -> ::std::string;
};
class Station final: public ::bow::Object {
public:
enum struct Type: ::std::uint8_t {
Globus,
Orbis,
};
::bow::Station::Type type;
Station() noexcept;
[[nodiscard]] virtual auto object_type_string() const noexcept -> ::std::string;
};
class World final: public ::bow::Object {
public:
enum struct Type: ::std::uint8_t {
AmmoniumWorld,
GasGiant,
IceWorld,
LavaWorld,
RockyWorld,
WaterWorld,
};
::bow::World::Type type;
World() noexcept;
[[nodiscard]] virtual auto object_type_string() const noexcept -> ::std::string;
};
[[nodiscard]] auto ware_mass(::bow::Ware const ware) noexcept -> double;
}
|