diff options
author | Mike Turvey <mturvey6@gmail.com> | 2017-03-11 09:00:58 -0700 |
---|---|---|
committer | Mike Turvey <mturvey6@gmail.com> | 2017-03-11 09:00:58 -0700 |
commit | ba38ddcc4c3d74c00139ceff9b45481259d80fc7 (patch) | |
tree | ba1efc8aa8f7a76aa9f9f831aff16ea86fdc2b23 /src/survive.c | |
parent | 1d9db12d7e115f2b8994f014e37f1086c17e90fd (diff) | |
parent | cdc60d110a9cd69c5bd8c0ac4e67db1ce7cecc93 (diff) | |
download | libsurvive-ba38ddcc4c3d74c00139ceff9b45481259d80fc7.tar.gz libsurvive-ba38ddcc4c3d74c00139ceff9b45481259d80fc7.tar.bz2 |
Merge remote-tracking branch 'remotes/upstream/master' into Octavios_Algorithm
Conflicts:
redist/linmath.c
Diffstat (limited to 'src/survive.c')
-rw-r--r-- | src/survive.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/survive.c b/src/survive.c index efa5d82..09eb432 100644 --- a/src/survive.c +++ b/src/survive.c @@ -8,6 +8,8 @@ #include <string.h> #include <zlib.h> +#include "survive_config.h" + static void survivefault( struct SurviveContext * ctx, const char * fault ) { fprintf( stderr, "Error: %s\n", fault ); @@ -26,6 +28,14 @@ SurviveContext * survive_init( int headless ) int i = 0; SurviveContext * ctx = calloc( 1, sizeof( SurviveContext ) ); + ctx->global_config_values = malloc( sizeof(config_group) ); + ctx->lh_config = malloc( sizeof(config_group) * NUM_LIGHTHOUSES); + + init_config_group(ctx->global_config_values,10); + init_config_group(ctx->lh_config,10); + + config_read(ctx, "config.json"); + ctx->faultfunction = survivefault; ctx->notefunction = survivenote; @@ -43,7 +53,7 @@ SurviveContext * survive_init( int headless ) } i = 0; - const char * PreferredPoser = "PoserDummy"; //config_read_str( cg, "DefualtPoser", "PoserDummy" ); /XXX Axlecrusher, can you add config stuff for this? + const char * PreferredPoser = config_read_str( ctx->global_config_values, "DefualtPoser", "PoserDummy" ); PoserCB PreferredPoserCB = 0; const char * FirstPoser = 0; printf( "Available posers:\n" ); @@ -169,11 +179,20 @@ void survive_close( SurviveContext * ctx ) ctx->drivercloses[i]( ctx, ctx->drivers[i] ); } + + config_save(ctx, "config.json"); + + destroy_config_group(ctx->global_config_values); + destroy_config_group(ctx->lh_config); + free( ctx->objs ); free( ctx->drivers ); free( ctx->driverpolls ); free( ctx->drivermagics ); free( ctx->drivercloses ); + free( ctx->global_config_values ); + free( ctx->lh_config ); + free( ctx ); } |