From b7dde0bcf09d20351aca9dbc87c666301fc0f234 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 28 Dec 2003 10:54:47 +0000 Subject: [PATCH] writegame schreib das datenfile in den falschen folder --- src/common/kernel/save.c | 8 ++++---- src/common/kernel/save.h | 2 +- src/eressea/lua/eressea.cpp | 3 +-- src/eressea/main.c | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/common/kernel/save.c b/src/common/kernel/save.c index e6870868f..4c3ca3b93 100644 --- a/src/common/kernel/save.c +++ b/src/common/kernel/save.c @@ -1303,7 +1303,7 @@ export_players(const char * path) } #endif -void +int writegame(const char *filename, char quiet) { int i,n; @@ -1325,10 +1325,9 @@ writegame(const char *filename, char quiet) /* write_dynamictypes(); */ - sprintf(buf, "%s/%s", datapath(), filename); - F = cfopen(buf, "w"); + F = cfopen(filename, "w"); if (F==NULL) - return; + return -1; if (!quiet) printf("Schreibe die %d. Runde...\n", turn); @@ -1458,6 +1457,7 @@ writegame(const char *filename, char quiet) #endif fclose(F); printf("\nOk.\n"); + return 0; } /* ------------------------------------------------------------- */ diff --git a/src/common/kernel/save.h b/src/common/kernel/save.h index 0d07b6640..15b8841c9 100644 --- a/src/common/kernel/save.h +++ b/src/common/kernel/save.h @@ -37,7 +37,7 @@ FILE * cfopen(const char *filename, const char *mode); int readorders(const char *); int creategame(void); extern int readgame(const char * filename, int backup); -void writegame(const char *filename, char quiet); +int writegame(const char *filename, char quiet); extern void rsf(FILE * F, char *s, size_t len); diff --git a/src/eressea/lua/eressea.cpp b/src/eressea/lua/eressea.cpp index 803b5e3f5..7eb626cfa 100644 --- a/src/eressea/lua/eressea.cpp +++ b/src/eressea/lua/eressea.cpp @@ -51,8 +51,7 @@ write_game(const char *filename) free_units(); remove_empty_factions(true); - writegame(filename, 0); - return 0; + return writegame(filename, 0); } extern int writepasswd(void); diff --git a/src/eressea/main.c b/src/eressea/main.c index d79e16caf..040db9cb9 100644 --- a/src/eressea/main.c +++ b/src/eressea/main.c @@ -344,7 +344,7 @@ processturn(char *filename) if (!nowrite) { char ztext[64]; sprintf(ztext, "%s/%d", datapath(), turn); - writegame(ztext, 0); + return writegame(ztext, 0); } return 0; }