X-Git-Url: https://plomlompom.com/repos/foo.html?a=blobdiff_plain;f=src%2Fserver%2Finit.c;h=3a83c34025d53ff56f74b23bb423a368fb9ee306;hb=169b8dda5f4c4373300b5be5edc113a376799737;hp=75b224c5aa0ec1f0bdb555b6f075a9eb12bce644;hpb=1a8b80508bc0bc6d9e9d3f8c48a8c7c40675c61f;p=plomrogue diff --git a/src/server/init.c b/src/server/init.c index 75b224c..3a83c34 100644 --- a/src/server/init.c +++ b/src/server/init.c @@ -1,5 +1,6 @@ /* src/server/init.c */ +#define _POSIX_C_SOURCE 2 /* getopt(), optarg */ #include "init.h" #include /* global errno, EEXIST */ #include /* NULL */ @@ -16,12 +17,15 @@ */ #include "../common/rexit.h" /* exit_err() */ #include "../common/try_malloc.h" /* try_malloc() */ -#include "cleanup.h" /* set_cleanup_flag() */ -#include "map_object_actions.h" /* init_map_object_actions() */ -#include "map_objects.h" /* free_map_objects(), add_map_objects(), - * init_map_object_defs() - */ +#include "cleanup.h" /* set_cleanup_flag(), CLEANUP_MAP_OBJ_DEFS, + * CLEANUP_MAP_OBJ_ACTS + */ +#include "io.h" /* read_config_file(), struct EntrySkeleton */ #include "map.h" /* init_map() */ +#include "map_object_actions.h" /* struct MapObjAct, read_map_object_action() */ +#include "map_objects.h" /* struct MapObjDef, free_map_objects(), + * add_map_objects(), read_map_object_def() + */ #include "rrand.h" /* rrand() */ #include "run.h" /* obey_msg(), io_loop() */ #include "world.h" /* global world */ @@ -64,8 +68,12 @@ extern void init_map_and_map_objects_configs() char * err_moa = "No map object actions file."; exit_err(access(world.path_map_obj_defs, F_OK), err_mod); exit_err(access(world.path_map_obj_acts, F_OK), err_moa); - init_map_object_defs(); - init_map_object_actions(); + read_config_file(world.path_map_obj_defs, CLEANUP_MAP_OBJECT_DEFS, + read_map_object_def, sizeof(struct MapObjDef), + (struct EntrySkeleton **) &world.map_obj_defs); + read_config_file(world.path_map_obj_acts, CLEANUP_MAP_OBJECT_ACTS, + read_map_object_action, sizeof(struct MapObjAct), + (struct EntrySkeleton **) &world.map_obj_acts); }