Group key config symbols together
[neverball] / share / ball.c
index 63e7fc7..bac3e78 100644 (file)
@@ -19,6 +19,7 @@
 #include "glext.h"
 #include "config.h"
 #include "solid_gl.h"
+#include "common.h"
 
 /*---------------------------------------------------------------------------*/
 
@@ -79,17 +80,12 @@ void ball_init(void)
 {
     int T = config_get_d(CONFIG_TEXTURES);
 
-    char solid_file[PATHMAX];
-    char inner_file[PATHMAX];
-    char outer_file[PATHMAX];
-
-    config_get_s(CONFIG_BALL_FILE, solid_file, PATHMAX - 12);
-    config_get_s(CONFIG_BALL_FILE, inner_file, PATHMAX - 12);
-    config_get_s(CONFIG_BALL_FILE, outer_file, PATHMAX - 12);
-
-    strcat(solid_file, "-solid.sol");
-    strcat(inner_file, "-inner.sol");
-    strcat(outer_file, "-outer.sol");
+    char *solid_file = concat_string(config_get_s(CONFIG_BALL_FILE),
+                                     "-solid.sol", NULL);
+    char *inner_file = concat_string(config_get_s(CONFIG_BALL_FILE),
+                                     "-inner.sol", NULL);
+    char *outer_file = concat_string(config_get_s(CONFIG_BALL_FILE),
+                                     "-outer.sol", NULL);
 
     solid_flags = 0;
     inner_flags = 0;
@@ -99,14 +95,18 @@ void ball_init(void)
     inner_alpha = 1.0f;
     outer_alpha = 1.0f;
 
-    if ((has_solid = sol_load_gl(&solid, config_data(solid_file), T, 0)))
+    if ((has_solid = sol_load_gl(&solid, solid_file, T, 0)))
         solid_flags = ball_opts(&solid, &solid_alpha);
 
-    if ((has_inner = sol_load_gl(&inner, config_data(inner_file), T, 0)))
+    if ((has_inner = sol_load_gl(&inner, inner_file, T, 0)))
         inner_flags = ball_opts(&inner, &inner_alpha);
 
-    if ((has_outer = sol_load_gl(&outer, config_data(outer_file), T, 0)))
+    if ((has_outer = sol_load_gl(&outer, outer_file, T, 0)))
         outer_flags = ball_opts(&outer, &outer_alpha);
+
+    free(solid_file);
+    free(inner_file);
+    free(outer_file);
 }
 
 void ball_free(void)