diff --git a/src/common/gamecode/creport.c b/src/common/gamecode/creport.c index 73daca2b2..f450e727a 100644 --- a/src/common/gamecode/creport.c +++ b/src/common/gamecode/creport.c @@ -1,6 +1,6 @@ /* vi: set ts=2: * - * $Id: creport.c,v 1.2 2001/01/26 16:19:39 enno Exp $ + * $Id: creport.c,v 1.3 2001/01/28 08:50:45 enno Exp $ * Eressea PB(E)M host Copyright (C) 1998-2000 * Christian Schlittchen (corwin@amber.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de) @@ -793,7 +793,7 @@ report_computer(FILE * F, faction * f) /* traverse all regions */ for (sd = seen; sd!=NULL; sd = sd->next) { int modifier = 0; - char * tname; + const char * tname; r = sd->r; diff --git a/src/common/gamecode/monster.c b/src/common/gamecode/monster.c index 307c0cfa2..aceffdb46 100644 --- a/src/common/gamecode/monster.c +++ b/src/common/gamecode/monster.c @@ -1,6 +1,6 @@ /* vi: set ts=2: * - * $Id: monster.c,v 1.2 2001/01/26 16:19:39 enno Exp $ + * $Id: monster.c,v 1.3 2001/01/28 08:50:45 enno Exp $ * Eressea PB(E)M host Copyright (C) 1998-2000 * Christian Schlittchen (corwin@amber.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de) @@ -837,12 +837,16 @@ plan_monsters(void) strlist *S; if (!dragonlog) { + char zText[MAX_PATH]; #ifdef HAVE_ZLIB - dragonlog = gzopen("dragonlog.gz", "w"); + sprintf(zText, "%s/dragonlog.gz", basepath()); + dragonlog = gzopen(zText, "w"); #elif HAVE_BZ2LIB - dragonlog = BZ2_bzopen("dragonlog.bz2","w"); + sprintf(zText, "%s/dragonlog.bz2", basepath()); + dragonlog = BZ2_bzopen(zText,"w"); #else - dragonlog = fopen("dragonlog", "w"); + sprintf(zText, "%s/dragonlog", basepath()); + dragonlog = fopen(zText, "w"); #endif } u = findunitg(atoi36("ponn"), NULL); diff --git a/src/common/gamecode/report.c b/src/common/gamecode/report.c index d5b2dac8b..54f4a11b6 100644 --- a/src/common/gamecode/report.c +++ b/src/common/gamecode/report.c @@ -1,6 +1,6 @@ /* vi: set ts=2: * - * $Id: report.c,v 1.3 2001/01/27 18:15:32 enno Exp $ + * $Id: report.c,v 1.4 2001/01/28 08:50:46 enno Exp $ * Eressea PB(E)M host Copyright (C) 1998-2000 * Christian Schlittchen (corwin@amber.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de) @@ -2992,10 +2992,12 @@ writemonument(void) for(i=0; i <= 6; i++) if(buildings[i]) { fset(buildings[i], FL_DH); } - - F = cfopen("news-monument", "w"); - if (!F) return; - + { + char zText[MAX_PATH]; + sprintf(zText, "%s/news-monument", basepath()); + F = cfopen(zText, "w"); + if (!F) return; + } fprintf(F, "\n--- maintitle ---\n\n"); for(i = 0; i<=6; i++) { if (buildings[i] != NULL) { @@ -3035,7 +3037,12 @@ writemonument(void) fclose(F); #ifdef OLD_ITEMS - if (!(F = cfopen("news-silly", "w"))) return; + { + char zText[MAX_PATH]; + sprintf(zText, "%s/news-silly", basepath()); + F = cfopen(zText, "w"); + if (!F) return; + } for (f=factions;f;f=f->next) { unit * u; int k; @@ -3067,7 +3074,12 @@ writeforward(void) region *r; unit *u; - forwardFile = fopen("aliases", "w"); + { + char zText[MAX_PATH]; + sprintf(zText, "%s/aliases", basepath()); + forwardFile = cfopen(zText, "w"); + if (!forwardFile) return; + } for (r = regions; r; r = r->next) { for (u = r->units; u; u = u->next) { @@ -3088,13 +3100,16 @@ report_summary(summary * s, summary * o, boolean full) faction * f; int nmrs[ORDERGAP]; - if (full) { - F = cfopen("parteien.full", "w"); - } else { - F = cfopen("parteien", "w"); + { + char zText[MAX_PATH]; + if (full) { + sprintf(zText, "%s/parteien.full", basepath()); + } else { + sprintf(zText, "%s/parteien.full", basepath()); + } + F = cfopen(zText, "w"); + if (!F) return; } - if (!F) return; - printf("Schreibe Zusammenfassung (parteien)...\n"); fprintf(F, "%s\n%s\n\n", global.gamename, gamedate2()); fprintf(F, "Auswertung Nr: %d\n", turn); @@ -3199,21 +3214,31 @@ report_summary(summary * s, summary * o, boolean full) #ifdef PLAYER_CSV region * r; #endif - FILE * F = cfopen("adressen", "w"); - + FILE * F; + char zText[MAX_PATH]; + if (full) { + sprintf(zText, "%s/adressen", basepath()); + F = cfopen(zText, "w"); + } if (!F) return; printf("Schreibe Liste der Adressen (adressen)...\n"); writeadresses("adressen"); writeforward(); fclose(F); - F = cfopen("datum", "w"); + { + sprintf(zText, "%s/datum", basepath()); + F = cfopen(zText, "w"); + } if (!F) return; printf("Schreibe Datum (datum)...\n"); fputs(gamedate2(), F); fclose(F); #ifdef PLAYER_CSV - F = cfopen("players", "w"); + { + strcpy(zText, "%s/players", basepath()); + F = cfopen(zText, "w"); + } if (!F) return; printf("Schreibe Spielerliste (players)...\n"); r = findregion(0, 0); diff --git a/src/common/kernel/eressea.c b/src/common/kernel/eressea.c index 2bc36730e..b7357a8cd 100644 --- a/src/common/kernel/eressea.c +++ b/src/common/kernel/eressea.c @@ -1,6 +1,6 @@ /* vi: set ts=2: * - * $Id: eressea.c,v 1.3 2001/01/27 18:15:32 enno Exp $ + * $Id: eressea.c,v 1.4 2001/01/28 08:50:46 enno Exp $ * Eressea PB(E)M host Copyright (C) 1998-2000 * Christian Schlittchen (corwin@amber.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de) @@ -1940,8 +1940,11 @@ remove_empty_factions(void) { faction **fp, *f3; FILE *dofp; + char zText[MAX_PATH]; - dofp = fopen("dropouts", "a"); + sprintf(zText, "%s/dropouts", basepath()); + + dofp = fopen(zText, "a"); for (fp = &factions; *fp;) { faction * f = *fp; diff --git a/src/config.h b/src/config.h index 63b9d2b55..37e40f229 100644 --- a/src/config.h +++ b/src/config.h @@ -1,6 +1,6 @@ /* vi: set ts=2: * - * $Id: config.h,v 1.2 2001/01/26 16:19:38 enno Exp $ + * $Id: config.h,v 1.3 2001/01/28 08:50:45 enno Exp $ * Eressea PB(E)M host Copyright (C) 1998-2000 * Christian Schlittchen (corwin@amber.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de) @@ -213,9 +213,9 @@ extern char * strdup(const char *s); #endif #ifdef WIN32 -# define PATH_MAX _MAX_PATH -#elif !defined(PATH_MAX) -# define PATH_MAX 1024 +# define MAX_PATH _MAX_PATH +#elif !defined(MAX_PATH) +# define MAX_PATH 1024 #endif /**** ****