blob: 4b608677e57089916daf231dc5b9e6b12a517227 (
plain) (
blame)
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
|
// Copyright 2022-2023 Gabriel Bjørnager Jensen.
#include <bow/logic.hxx>
#include <bow/server.hxx>
#include <cstdint>
#include <format>
#include <string>
using namespace ::std::literals::string_literals;
auto bow::ServerInstance::generate_system(::bow::ObjectRoot& system, ::std::uint64_t const identifier, ::std::uint64_t const time) -> void {
::bow::log("server"s, ::std::format("generating system ({:x})", identifier));
if (system.has_objects()) [[likely]] {
system.~ObjectRoot();
}
// Nb.: The following code is only temporary.
// Currently, every system has only an Earth-Sol
// orbit.
system.add([]() -> ::bow::Star {
auto star = ::bow::Star();
star.mass = 0x1p0,
star.type = ::bow::StarType::G;
return star;
}());
system.add([]() -> ::bow::World {
auto world = ::bow::World();
world.position.y = 0x1.F76F144Dp-1;
world.positional_velocity.x = 0x1.B2D06FF3p-23 * ::bow::TIME_MODIFIER;
world.rotational_velocity.z = 0x1.31DB66BBp-15;
world.mass = 0x1.931AFC649369998Fp-19,
world.type = ::bow::WorldType::RockyWorld;
return world;
}());
this->simulate(system, time);
}
|