From: Christian Heller Date: Sat, 25 Jan 2014 19:27:08 +0000 (+0100) Subject: Server's remake_world() unlinks any pre-existing record file. X-Git-Tag: tce~864 X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/decks/%7B%7Bdb.prefix%7D%7D/static/bar%20baz.html?a=commitdiff_plain;h=fd2cb2cba67e6f26bb02b827d9e458524fd1f0d4;p=plomrogue Server's remake_world() unlinks any pre-existing record file. --- diff --git a/src/server/init.c b/src/server/init.c index 97ed0fa..7ab5c9d 100644 --- a/src/server/init.c +++ b/src/server/init.c @@ -1,12 +1,13 @@ /* src/server/init.c */ #include "init.h" +#include /* errno */ #include /* NULL */ #include /* uint32_t */ #include /* exit(), free() */ #include /* atoi() */ #include /* time() */ -#include /* optarg, getopt(), access() */ +#include /* optarg, getopt(), access(), unlink() */ #include "../common/readwrite.h" /* try_fopen(), try_fclose(), textfile_sizes(), * try_fgets() */ @@ -65,6 +66,9 @@ extern void remake_world(uint32_t seed) add_map_objects(4, 1 + rrand() % 3); add_map_objects(5, 1 + rrand() % 3); set_cleanup_flag(CLEANUP_MAP_OBJECTS); + int test = unlink(world.path_record); + char * err = "remake_world() fails to unlink() record file."; + exit_err(test && errno != ENOENT, err); } diff --git a/src/server/init.h b/src/server/init.h index 595f697..12d0c08 100644 --- a/src/server/init.h +++ b/src/server/init.h @@ -14,6 +14,7 @@ extern void obey_argv(int argc, char * argv[]); /* Dissolves old game world if it exists, and generates a new one from "seed". + * Unlinks any pre-existing file at world.path_record to re-start record. * * Map object (action) definitions read in from server config directory are not * affected. world.last_update_turn is set to 0 and world.turn to 1, so that