]> git.lizzy.rs Git - dragonblocks_alpha.git/blobdiff - src/client/client_config.c
refactoring
[dragonblocks_alpha.git] / src / client / client_config.c
index 2dbe24b07bef27f6aa0b8cbce9fdc210b1e4dfdc..be0d221c5abfa427fb3c155dbcc59933383ddcf8 100644 (file)
@@ -4,39 +4,46 @@
 struct ClientConfig client_config = {
        .antialiasing = 4,
        .mipmap = true,
-       .render_distance = 255.0,
+       .view_distance = 255.0,
        .vsync = true,
        .meshgen_threads = 4,
 };
 
+#define NUM_CONFIG_ENTRIES 5
+static ConfigEntry config_entries[NUM_CONFIG_ENTRIES] = {
+       {
+               .type = CONFIG_UINT,
+               .key = "antialiasing",
+               .value = &client_config.antialiasing,
+       },
+       {
+               .type = CONFIG_BOOL,
+               .key = "mipmap",
+               .value = &client_config.mipmap,
+       },
+       {
+               .type = CONFIG_FLOAT,
+               .key = "view_distance",
+               .value = &client_config.view_distance,
+       },
+       {
+               .type = CONFIG_BOOL,
+               .key = "vsync",
+               .value = &client_config.vsync,
+       },
+       {
+               .type = CONFIG_UINT,
+               .key = "meshgen_threads",
+               .value = &client_config.meshgen_threads,
+       },
+};
+
 __attribute__((constructor)) static void client_config_init()
 {
-       config_read("client.conf", (ConfigEntry[]) {
-               {
-                       .type = CT_UINT,
-                       .key = "antialiasing",
-                       .value = &client_config.antialiasing,
-               },
-               {
-                       .type = CT_BOOL,
-                       .key = "mipmap",
-                       .value = &client_config.mipmap,
-               },
-               {
-                       .type = CT_FLOAT,
-                       .key = "render_distance",
-                       .value = &client_config.render_distance,
-               },
-               {
-                       .type = CT_BOOL,
-                       .key = "vsync",
-                       .value = &client_config.vsync,
-               },
-               {
-                       .type = CT_UINT,
-                       .key = "meshgen_threads",
-                       .value = &client_config.meshgen_threads,
-               },
-       }, 5);
+       config_read("client.conf", config_entries, NUM_CONFIG_ENTRIES);
 }
 
+__attribute__((destructor)) static void client_config_deinit()
+{
+       config_free(config_entries, NUM_CONFIG_ENTRIES);
+}