Browse Source

Make config loader helper functions private

Claude
main
cinnaboot 6 months ago
parent
commit
b6636e429b
  1. 10
      src/config_loader.cpp
  2. 6
      src/config_loader.h

10
src/config_loader.cpp

@ -3,8 +3,7 @@
#include <cmath>
#include <cstring>
// Helper function: extract Vec3 from TOML table
bool extract_vec3_from_table(toml_datum_t table, Vec3* pos) {
static bool extract_vec3_from_table(toml_datum_t table, Vec3* pos) {
toml_datum_t x = toml_get(table, "x");
toml_datum_t y = toml_get(table, "y");
toml_datum_t z = toml_get(table, "z");
@ -22,8 +21,7 @@ bool extract_vec3_from_table(toml_datum_t table, Vec3* pos) {
return true;
}
// Helper function: extract color RGB from TOML table
bool extract_color_from_table(toml_datum_t table, float* color) {
static bool extract_color_from_table(toml_datum_t table, float* color) {
toml_datum_t r = toml_get(table, "r");
toml_datum_t g = toml_get(table, "g");
toml_datum_t b = toml_get(table, "b");
@ -41,8 +39,7 @@ bool extract_color_from_table(toml_datum_t table, float* color) {
return true;
}
// Parse individual body from TOML table
bool parse_toml_body(toml_datum_t body_table, CelestialBody* body) {
static bool parse_toml_body(toml_datum_t body_table, CelestialBody* body) {
// Extract string fields
toml_datum_t name = toml_get(body_table, "name");
if (name.type != TOML_STRING) {
@ -91,7 +88,6 @@ bool parse_toml_body(toml_datum_t body_table, CelestialBody* body) {
return true;
}
// Load system configuration from TOML file
bool load_system_config(SimulationState* sim, const char* filepath) {
toml_result_t result = toml_parse_file_ex(filepath);
if (!result.ok) {

6
src/config_loader.h

@ -4,12 +4,6 @@
#include "simulation.h"
#include "../ext/tomlc17/src/tomlc17.h"
// Load a system configuration from a file (TOML format)
bool load_system_config(SimulationState* sim, const char* filepath);
// Helper functions for TOML parsing
bool extract_vec3_from_table(toml_datum_t table, Vec3* pos);
bool extract_color_from_table(toml_datum_t table, float* color);
bool parse_toml_body(toml_datum_t body_table, CelestialBody* body);
#endif

Loading…
Cancel
Save