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

View File

@ -82,9 +82,6 @@
#define MAXORDERS 256 #define MAXORDERS 256
#define MAXPERSISTENT 128 #define MAXPERSISTENT 128
/* exported symbols symbols */
int g_writegame = 1;
static void read_alliances(gamedata *data) static void read_alliances(gamedata *data)
{ {
storage *store = data->store; storage *store = data->store;
@ -1773,9 +1770,6 @@ int writegame(const char *filename)
stream strm; stream strm;
FILE *F; FILE *F;
if (g_writegame == 0) {
return -1;
}
create_directories(); create_directories();
path_join(datapath(), filename, path, sizeof(path)); path_join(datapath(), filename, path, sizeof(path));
/* make sure we don't overwrite an existing file (hard links) */ /* 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 */ * dass hier ein Fehler (fehlende ") vorliegt */
/* TODO: is this *really* still in use? */ /* TODO: is this *really* still in use? */
extern int g_writegame;
int readgame(const char *filename); int readgame(const char *filename);
int writegame(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; const char *arg;
switch (argi[1]) { switch (argi[1]) {
case 'D': case 'D':
g_writegame = 0; config_set("config.debug", "1");
break; break;
case 'c': case 'c':
i = get_arg(argc, argv, 2, i, &arg, 0); i = get_arg(argc, argv, 2, i, &arg, 0);