forked from omega13a/stargen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStarGenerator.cpp
More file actions
54 lines (44 loc) · 1.38 KB
/
Copy pathStarGenerator.cpp
File metadata and controls
54 lines (44 loc) · 1.38 KB
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
#include "StarGenerator.h"
#include "const.h"
StarGenerator::StarGenerator() {
initializeDefaults();
}
StarGenerator::StarGenerator(const Config& cfg) : config(cfg) {
initializeDefaults();
}
void StarGenerator::initializeDefaults() {
// Initialize Config defaults
config.dust_density_ratio = DUST_DENSITY_COEFF;
if (config.max_age == 0.0) {
config.max_age = 10.0E9;
}
if (config.max_age_backup == 0.0) {
config.max_age_backup = 10.0E9;
}
// Initialize SimulationContext defaults
sim_context.dust_density_coeff = DUST_DENSITY_COEFF;
}
void StarGenerator::setRandomSeed(long seed) {
config.random_seed = seed;
random_context.setSeed(seed);
sim_context.current_system_seed = seed;
}
long StarGenerator::getRandomSeed() const {
return random_context.getSeed();
}
void StarGenerator::resetAllStatistics() {
sim_context.resetGlobalStatistics();
sim_context.resetSystemStatistics();
}
void StarGenerator::resetSystemStatistics() {
sim_context.resetSystemStatistics();
}
void StarGenerator::reset() {
// Reset system-specific state
sim_context.resetSystemStatistics();
sim_context.clearPlanets();
sim_context.system_counter = 0;
sim_context.current_system_seed = 0;
// Config remains unchanged - set once per pooled object
// Global statistics remain unchanged - they accumulate across systems
}