remove g_writegame global

use a config variable isntead and check it in Lua.
This commit is contained in:
Enno Rehling 2021-06-19 19:43:45 +02:00
parent 0e83b5b157
commit 3e3597e99f
4 changed files with 9 additions and 15 deletions

View File

@ -150,6 +150,7 @@ function process(rules, orders)
callbacks(rules, 'update')
turn_end() -- ageing, etc.
if not config.debug then
write_files(config.locales)
update_scores()
@ -158,6 +159,7 @@ function process(rules, orders)
eressea.log.error("could not write game")
return -1
end
end
return 0
end

View File

@ -82,9 +82,6 @@
#define MAXORDERS 256
#define MAXPERSISTENT 128
/* exported symbols symbols */
int g_writegame = 1;
static void read_alliances(gamedata *data)
{
storage *store = data->store;
@ -1773,9 +1770,6 @@ int writegame(const char *filename)
stream strm;
FILE *F;
if (g_writegame == 0) {
return -1;
}
create_directories();
path_join(datapath(), filename, path, sizeof(path));
/* make sure we don't overwrite an existing file (hard links) */

View File

@ -23,8 +23,6 @@ extern "C" {
* dass hier ein Fehler (fehlende ") vorliegt */
/* TODO: is this *really* still in use? */
extern int g_writegame;
int readgame(const char *filename);
int writegame(const char *filename);

View File

@ -200,7 +200,7 @@ static int parse_args(int argc, char **argv)
const char *arg;
switch (argi[1]) {
case 'D':
g_writegame = 0;
config_set("config.debug", "1");
break;
case 'c':
i = get_arg(argc, argv, 2, i, &arg, 0);