add a debug option, -D

usually do not need to save the game when debugging
This commit is contained in:
Enno Rehling 2021-01-02 20:16:20 +01:00
parent f4acff67e4
commit fb294d9118
3 changed files with 9 additions and 2 deletions

View File

@ -81,7 +81,7 @@
#define MAXPERSISTENT 128
/* exported symbols symbols */
int firstx = 0, firsty = 0;
int g_writegame = 1;
static void read_alliances(gamedata *data)
{
@ -1719,6 +1719,9 @@ 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,7 +23,7 @@ extern "C" {
* dass hier ein Fehler (fehlende ") vorliegt */
/* TODO: is this *really* still in use? */
extern int enc_gamedata;
extern int g_writegame;
int readgame(const char *filename);
int writegame(const char *filename);

View File

@ -6,6 +6,7 @@
#include <kernel/config.h>
#include <kernel/messages.h>
#include <kernel/version.h>
#include <kernel/save.h>
#include <util/language.h>
#include <util/log.h>
@ -196,6 +197,9 @@ static int parse_args(int argc, char **argv)
else {
const char *arg;
switch (argi[1]) {
case 'D':
g_writegame = 0;
break;
case 'c':
i = get_arg(argc, argv, 2, i, &arg, 0);
config_set("config.path", arg);