basepath() ausgiebiger benutzen

This commit is contained in:
Enno Rehling 2001-01-28 08:50:46 +00:00
parent 4e802f83bb
commit d35ec83eb6
5 changed files with 61 additions and 29 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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
/**** ****