forked from github/server
fehlende updates vom samstag: main.c aufgeraeumt, argument-parsing an zerntraler stelle. init/done funktionen umgestellt
This commit is contained in:
parent
176ffef3cb
commit
fc03d7922a
|
@ -1,6 +1,6 @@
|
|||
/* vi: set ts=2:
|
||||
*
|
||||
* $Id: main.c,v 1.3 2001/02/03 13:45:27 enno Exp $
|
||||
* $Id: main.c,v 1.4 2001/02/05 16:11:57 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)
|
||||
|
@ -450,10 +450,6 @@ main(int argc, char *argv[])
|
|||
case 'q':
|
||||
quiet = 1;
|
||||
break;
|
||||
case 'i':
|
||||
inside_only = 1;
|
||||
printf(" - Lade nur die innersten Regionen.\n");
|
||||
break;
|
||||
case 'x':
|
||||
maxregions = atoi(argv[++i]);
|
||||
maxregions = (maxregions*81+80) / 81;
|
||||
|
@ -465,8 +461,9 @@ main(int argc, char *argv[])
|
|||
strcat(strcpy(zText, resourcepath()), "/timestrings");
|
||||
read_datenames(zText);
|
||||
}
|
||||
|
||||
kernel_init();
|
||||
init_game();
|
||||
initgame();
|
||||
readgame(false);
|
||||
#if MALLOCDBG
|
||||
assert(_CrtCheckMemory());
|
||||
|
@ -590,8 +587,6 @@ main(int argc, char *argv[])
|
|||
case 'x':
|
||||
i++;
|
||||
case 'q':
|
||||
case 'i':
|
||||
/* inner_world, quiet, minfaction und maxregions wird schon vorher abgefragt */
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Usage: %s [options]\n"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* vi: set ts=2:
|
||||
*
|
||||
* $Id: creport.c,v 1.4 2001/02/03 13:45:29 enno Exp $
|
||||
* $Id: creport.c,v 1.5 2001/02/05 16:11:57 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)
|
||||
|
@ -21,10 +21,11 @@
|
|||
|
||||
#include <config.h>
|
||||
#include "eressea.h"
|
||||
#include "reports.h"
|
||||
#include "creport.h"
|
||||
|
||||
#include "plane.h"
|
||||
#include "render.h"
|
||||
#include <reports.h>
|
||||
#include <plane.h>
|
||||
#include <render.h>
|
||||
#include "movement.h"
|
||||
#include "item.h"
|
||||
#include "faction.h"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* vi: set ts=2:
|
||||
*
|
||||
* $Id: report.c,v 1.10 2001/02/04 18:50:59 corwin Exp $
|
||||
* $Id: report.c,v 1.11 2001/02/05 16:11:57 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)
|
||||
|
@ -91,9 +91,8 @@ int seasons;
|
|||
extern int weeks_per_month;
|
||||
extern int months_per_year;
|
||||
|
||||
void
|
||||
read_datenames(char *filename)
|
||||
|
||||
int
|
||||
read_datenames(const char *filename)
|
||||
{
|
||||
FILE *namesFP;
|
||||
char line[256];
|
||||
|
@ -101,7 +100,7 @@ read_datenames(char *filename)
|
|||
|
||||
if( (namesFP=fopen(filename,"r")) == NULL) {
|
||||
fprintf(stderr, "Kann Datei '%s' nicht öffnen, Abbruch\n",filename);
|
||||
exit(1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
fgets(line,255,namesFP);
|
||||
|
@ -113,7 +112,7 @@ read_datenames(char *filename)
|
|||
seasons = strtol(line, NULL, 10);
|
||||
seasonnames = malloc(sizeof(char *) * seasons);
|
||||
|
||||
for(i=0;i<seasons;i++) {
|
||||
for (i=0;i<seasons;i++) {
|
||||
fgets(line,255,namesFP);
|
||||
l = strlen(line)-1;
|
||||
if(line[l] == '\n') line[l] = 0;
|
||||
|
@ -157,6 +156,7 @@ read_datenames(char *filename)
|
|||
}
|
||||
|
||||
fclose(namesFP);
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *
|
||||
|
@ -1793,7 +1793,7 @@ report(FILE *F, faction * f)
|
|||
centre(F, "Kämpfe", false);
|
||||
rnl(F);
|
||||
for (bm=f->battles;bm;bm=bm->next) {
|
||||
#if HAVE_SNPRINTF
|
||||
#ifdef HAVE_SNPRINTF
|
||||
snprintf(buf, 80, "In %s findet ein Kampf statt:",
|
||||
translate_regions(regionid(bm->r), f));
|
||||
#else
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* vi: set ts=2:
|
||||
*
|
||||
* $Id: battle.c,v 1.5 2001/02/04 10:04:36 corwin Exp $
|
||||
* $Id: battle.c,v 1.6 2001/02/05 16:11:57 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)
|
||||
|
@ -2901,24 +2901,22 @@ make_battle(region * r)
|
|||
|
||||
if (!nobattledebug) {
|
||||
char zText[MAX_PATH];
|
||||
char zFilename[MAX_PATH];
|
||||
sprintf(zText, "%s/battles", basepath());
|
||||
if (!debug) {
|
||||
char zFilename[MAX_PATH];
|
||||
makedir(zText, 0700);
|
||||
makedir(zText, 0700);
|
||||
#ifdef HAVE_ZLIB
|
||||
sprintf(zFilename, "%s/battle-%d-%s.log.gz", zText, obs_count, simplename(r));
|
||||
bdebug = gzopen(zFilename, "w");
|
||||
sprintf(zFilename, "%s/battle-%d-%s.log.gz", zText, obs_count, simplename(r));
|
||||
bdebug = gzopen(zFilename, "w");
|
||||
#elif HAVE_BZ2LIB
|
||||
sprintf(zFilename, "%s/battle-%d-%s.log.bz2", zText, obs_count, simplename(r));
|
||||
bdebug = BZ2_bzopen(zFilename, "w");+
|
||||
sprintf(zFilename, "%s/battle-%d-%s.log.bz2", zText, obs_count, simplename(r));
|
||||
bdebug = BZ2_bzopen(zFilename, "w");+
|
||||
#else
|
||||
sprintf(zFilename, "%s/battle-%d-%s.log", zText, obs_count, simplename(r));
|
||||
bdebug = fopen(zFilename, "w");
|
||||
sprintf(zFilename, "%s/battle-%d-%s.log", zText, obs_count, simplename(r));
|
||||
bdebug = fopen(zFilename, "w");
|
||||
#endif
|
||||
if (!bdebug) fputs("battles können nicht debugged werden\n", stderr);
|
||||
else {
|
||||
dbgprintf((bdebug, "In %s findet ein Kampf statt:", rname(r, NULL)));
|
||||
}
|
||||
if (!bdebug) fputs("battles können nicht debugged werden\n", stderr);
|
||||
else {
|
||||
dbgprintf((bdebug, "In %s findet ein Kampf statt:", rname(r, NULL)));
|
||||
}
|
||||
obs_count++;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* vi: set ts=2:
|
||||
*
|
||||
* $Id: eressea.c,v 1.8 2001/02/05 07:23:17 corwin Exp $
|
||||
* $Id: eressea.c,v 1.9 2001/02/05 16:11:58 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)
|
||||
|
@ -459,8 +459,6 @@ stripunit(unit * u)
|
|||
while (u->attribs) a_remove (&u->attribs, u->attribs);
|
||||
}
|
||||
|
||||
extern int inside_only;
|
||||
|
||||
void
|
||||
verify_data (void)
|
||||
{
|
||||
|
@ -470,8 +468,6 @@ verify_data (void)
|
|||
unit *u;
|
||||
int mage, alchemist;
|
||||
|
||||
if (inside_only)
|
||||
return;
|
||||
puts(" - Überprüfe Daten auf Korrektheit...");
|
||||
|
||||
list_foreach(faction, factions, f) {
|
||||
|
@ -1893,15 +1889,35 @@ init_tokens(void)
|
|||
}
|
||||
}
|
||||
|
||||
extern void attrib_init(void);
|
||||
extern void render_cleanup(void);
|
||||
|
||||
void
|
||||
initgame(void)
|
||||
kernel_done(void)
|
||||
{
|
||||
/* calling this function releases memory assigned to static variables, etc.
|
||||
* calling it is optional, e.g. a release server will most likely not do it.
|
||||
*/
|
||||
render_cleanup();
|
||||
skill_done();
|
||||
gc_done();
|
||||
}
|
||||
|
||||
extern void attrib_init(void);
|
||||
extern void render_init(void);
|
||||
|
||||
void
|
||||
kernel_init(void)
|
||||
{
|
||||
init_tokens();
|
||||
skill_init();
|
||||
attrib_init();
|
||||
init_locales();
|
||||
render_init();
|
||||
if (!turn) turn = lastturn();
|
||||
if (turn == 0)
|
||||
srand(time((time_t *) NULL));
|
||||
else
|
||||
srand(turn);
|
||||
}
|
||||
|
||||
/*********************/
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* vi: set ts=2:
|
||||
*
|
||||
* $Id: eressea.h,v 1.11 2001/02/05 07:23:17 corwin Exp $
|
||||
* $Id: eressea.h,v 1.12 2001/02/05 16:11:58 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)
|
||||
|
@ -911,8 +911,6 @@ extern char buf[BUFSIZE + 1];
|
|||
/* special units */
|
||||
struct unit *make_undead_unit(struct region * r, struct faction * f, int n, race_t race);
|
||||
|
||||
extern FILE *debug; /* Hier können bei -debug Debug-Ausgaben hineingeschreiben werden. */
|
||||
|
||||
extern struct region *regions;
|
||||
extern struct faction *factions;
|
||||
|
||||
|
@ -1061,8 +1059,6 @@ boolean idle(struct faction * f);
|
|||
boolean unit_has_cursed_item(struct unit *u);
|
||||
struct region * rconnect(const struct region *, direction_t dir);
|
||||
|
||||
void game_done(void);
|
||||
|
||||
/* simple garbage collection: */
|
||||
void * gc_add(void * p);
|
||||
void gc_done(void);
|
||||
|
@ -1131,6 +1127,8 @@ extern void add_income(struct unit * u, int type, int want, int qty);
|
|||
extern int month(int offset);
|
||||
extern const char * basepath(void);
|
||||
extern const char * resourcepath(void);
|
||||
extern void kernel_init(void);
|
||||
extern void kernel_done(void);
|
||||
|
||||
#define FIRST_TURN 184
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* vi: set ts=2:
|
||||
*
|
||||
* $Id: plane.h,v 1.2 2001/01/26 16:19:40 enno Exp $
|
||||
* $Id: plane.h,v 1.3 2001/02/05 16:11:58 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)
|
||||
|
@ -47,13 +47,13 @@ typedef struct plane {
|
|||
attrib *attribs;
|
||||
} plane;
|
||||
|
||||
plane *planes;
|
||||
struct plane *planes;
|
||||
|
||||
plane *getplane(const struct region *r);
|
||||
plane *findplane(int x, int y);
|
||||
struct plane *getplane(const struct region *r);
|
||||
struct plane *findplane(int x, int y);
|
||||
void init_planes(void);
|
||||
int getplaneid(struct region *r);
|
||||
plane * getplanebyid(int id);
|
||||
struct plane * getplanebyid(int id);
|
||||
int region_x(const struct region *r, const struct faction *f);
|
||||
int region_y(const struct region *r, const struct faction *f);
|
||||
int plane_center_x(plane *pl);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* vi: set ts=2:
|
||||
*
|
||||
* $Id: region.c,v 1.6 2001/02/03 13:45:32 enno Exp $
|
||||
* $Id: region.c,v 1.7 2001/02/05 16:11:58 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)
|
||||
|
@ -75,10 +75,12 @@ tregionid(const region * r, const faction * f)
|
|||
} else if (pl && fval(pl, PFL_NOCOORDS)) {
|
||||
strncpy(buf, rname(r, f->locale), 65);
|
||||
} else {
|
||||
#if HAVE_SNPRINTF
|
||||
#ifdef HAVE_SNPRINTF
|
||||
snprintf(buf, 65, "%s (%d,%d)", rname(r, f->locale), region_x(r, f), region_y(r, f));
|
||||
#else
|
||||
sprintf(buf, "%s (%d,%d)", rname(r, f->locale), region_x(r, f), region_y(r, f));
|
||||
strncpy(buf, rname(r, f->locale), 50);
|
||||
buf[50]=0;
|
||||
sprintf(buf+strlen(buf), " (%d,%d)", region_x(r, f), region_y(r, f));
|
||||
#endif
|
||||
}
|
||||
buf[64] = 0;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* vi: set ts=2:
|
||||
*
|
||||
* $Id: reports.h,v 1.2 2001/01/26 16:19:40 enno Exp $
|
||||
* $Id: reports.h,v 1.3 2001/02/05 16:11:58 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)
|
||||
|
@ -35,7 +35,7 @@ extern boolean kann_finden(struct faction * f1, struct faction * f2);
|
|||
extern void add_find(struct faction *, struct unit *);
|
||||
extern struct unit * can_find(struct faction *, struct faction *);
|
||||
/* funktionen zum schreiben eines reports */
|
||||
void read_datenames(char *filename);
|
||||
extern int read_datenames(const char *filename);
|
||||
void sparagraph(struct strlist ** SP, const char *s, int indent, char mark);
|
||||
void lparagraph(struct strlist ** SP, char *s, int indent, char mark);
|
||||
const char *hp_status(const struct unit * u);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* vi: set ts=2:
|
||||
*
|
||||
* $Id: save.c,v 1.10 2001/02/04 09:46:47 corwin Exp $
|
||||
* $Id: save.c,v 1.11 2001/02/05 16:11:58 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)
|
||||
|
@ -75,7 +75,6 @@ extern void resolve2(void);
|
|||
|
||||
#define ESCAPE_FIX
|
||||
|
||||
int inside_only = 0;
|
||||
int minfaction = 0;
|
||||
const char * g_datadir;
|
||||
/* imported symbols */
|
||||
|
@ -542,7 +541,7 @@ readorders(const char *filename)
|
|||
}
|
||||
|
||||
fclose(F);
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
/* ------------------------------------------------------------- */
|
||||
|
||||
|
@ -760,9 +759,6 @@ readgame(boolean backup)
|
|||
nextborder = ri(F);
|
||||
}
|
||||
|
||||
printf(" - Version: %d.%d, Runde %d.\n",
|
||||
global.data_version / 10, global.data_version % 10, turn);
|
||||
|
||||
/* Planes */
|
||||
planes = NULL;
|
||||
n = ri(F);
|
||||
|
@ -1195,14 +1191,7 @@ readgame(boolean backup)
|
|||
init=true;
|
||||
}
|
||||
#endif
|
||||
#ifdef AMIGA
|
||||
u = &dummyu;
|
||||
#else
|
||||
if (inside_only && inner_world(r) < 2)
|
||||
u = &dummyu;
|
||||
else
|
||||
u = (unit *) calloc(1, sizeof(unit));
|
||||
#endif
|
||||
u = (unit *) calloc(1, sizeof(unit));
|
||||
|
||||
#if USE_EVENTS
|
||||
add_handler(&u->attribs, "hunger", print_hunger, 0);
|
||||
|
@ -1396,12 +1385,7 @@ readgame(boolean backup)
|
|||
}
|
||||
a_read(F, &u->attribs);
|
||||
|
||||
if (inside_only && inner_world(r) < 2) {
|
||||
destroy_unit(u);
|
||||
memset(u, 0, sizeof(unit));
|
||||
} else {
|
||||
addlist2(up,u);
|
||||
}
|
||||
addlist2(up,u);
|
||||
}
|
||||
}
|
||||
if (global.data_version >= BORDER_VERSION) read_borders(F);
|
||||
|
@ -2169,24 +2153,6 @@ attrib_init(void)
|
|||
at_register(&at_jihad);
|
||||
}
|
||||
|
||||
extern void skill_init(void);
|
||||
extern void skill_done(void);
|
||||
void game_done(void)
|
||||
{
|
||||
#if 0
|
||||
int l, i;
|
||||
for (i=0;i!=MAX_MSG;++i) {
|
||||
fprintf(stderr, "%s\t\n", report_options[i]);
|
||||
for (l=0;l!=ML_MAX;++l)
|
||||
fprintf(stderr, "\t%.8d", cmsg[i][l]);
|
||||
fprintf(stderr, report_options[i]);
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
#endif
|
||||
skill_done();
|
||||
gc_done();
|
||||
}
|
||||
|
||||
extern void inittokens(void);
|
||||
extern void create_teleport_plane(void);
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* vi: set ts=2:
|
||||
*
|
||||
* $Id: save.h,v 1.3 2001/01/30 23:16:17 enno Exp $
|
||||
* $Id: save.h,v 1.4 2001/02/05 16:11:58 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)
|
||||
|
@ -30,12 +30,9 @@ double version(void);
|
|||
/* Nach MAX_INPUT_SIZE brechen wir das Einlesen der Zeile ab und nehmen an,
|
||||
* dass hier ein Fehler (fehlende ") vorliegt */
|
||||
|
||||
extern int inside_only;
|
||||
|
||||
FILE * cfopen(const char *filename, const char *mode);
|
||||
int readorders(const char *);
|
||||
int creategame(void);
|
||||
void initgame(void);
|
||||
int readgame(boolean backup);
|
||||
void writegame(char *path, char quiet);
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* vi: set ts=2:
|
||||
*
|
||||
* $Id: config.h,v 1.4 2001/02/03 13:45:27 enno Exp $
|
||||
* $Id: config.h,v 1.5 2001/02/05 16:11:57 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)
|
||||
|
@ -121,6 +121,7 @@ typedef int boolean;
|
|||
# define HAVE_MKDIR_WITH_PERMISSION
|
||||
# include <string.h>
|
||||
# define HAVE_STRDUP
|
||||
# define HAVE_SNPRINTF
|
||||
#endif
|
||||
|
||||
/* egcpp 4 dos */
|
||||
|
@ -139,7 +140,8 @@ typedef int boolean;
|
|||
# define HAVE_STRICMP
|
||||
# define HAVE_STRNICMP
|
||||
# define HAVE_STRDUP
|
||||
# define HAVE__SNPRINTF
|
||||
# define snprintf _snprintf
|
||||
# define HAVE_SNPRINTF
|
||||
# undef HAVE_STRCASECMP
|
||||
# undef HAVE_STRNCASECMP
|
||||
# define R_OK 4
|
||||
|
@ -150,6 +152,9 @@ typedef int boolean;
|
|||
# define R_OK 4
|
||||
# define HAVE__MKDIR_WITHOUT_PERMISSION
|
||||
|
||||
# define snprintf _snprintf
|
||||
# define HAVE_SNPRINTF
|
||||
|
||||
/* MSVC has _access */
|
||||
_CRTIMP int __cdecl _access(const char *, int);
|
||||
# define access(f, m) _access(f, m)
|
||||
|
|
|
@ -119,7 +119,7 @@ LINK32=link.exe
|
|||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /I ".." /I "../common" /I "../common/util" /I "../common/kernel" /I "../common/gamecode" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /Za /W4 /GX- /Zi /O2 /I ".." /I "../common" /I "../common/util" /I "../common/kernel" /I "../common/gamecode" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /Za /W4 /Zi /O2 /I ".." /I "../common" /I "../common/util" /I "../common/kernel" /I "../common/gamecode" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x407 /d "NDEBUG"
|
||||
# ADD RSC /l 0x407 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* vi: set ts=2:
|
||||
*
|
||||
* $Id: main.c,v 1.9 2001/02/03 13:45:34 enno Exp $
|
||||
* $Id: main.c,v 1.10 2001/02/05 16:11:58 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)
|
||||
|
@ -19,13 +19,6 @@
|
|||
* permission from the authors.
|
||||
*/
|
||||
|
||||
#define BENCHMARK 0
|
||||
#ifdef DMALLOC
|
||||
# define ENNO_CLEANUP 1
|
||||
#else
|
||||
# define ENNO_CLEANUP 0
|
||||
#endif
|
||||
|
||||
#define LOCALE_CHECK
|
||||
#ifdef __LCC__
|
||||
#undef LOCALE_CHECK
|
||||
|
@ -59,8 +52,10 @@
|
|||
#include <message.h>
|
||||
#include <teleport.h>
|
||||
#include <faction.h>
|
||||
#include <plane.h>
|
||||
#include <race.h>
|
||||
#include <reports.h>
|
||||
#include <region.h>
|
||||
#include <save.h>
|
||||
#include <time.h>
|
||||
#include <border.h>
|
||||
|
@ -78,8 +73,9 @@
|
|||
#include <string.h>
|
||||
#include <locale.h>
|
||||
|
||||
int nodescriptions = 0;
|
||||
int nowrite = 0;
|
||||
/**
|
||||
** global variables we are importing from other modules
|
||||
**/
|
||||
extern char * g_reportdir;
|
||||
extern char * g_datadir;
|
||||
extern char * g_basedir;
|
||||
|
@ -92,15 +88,26 @@ extern boolean nomsg;
|
|||
extern boolean nobattle;
|
||||
extern boolean nobattledebug;
|
||||
|
||||
int mapdetail = 0;
|
||||
#ifdef FUZZY_BASE36
|
||||
extern int fuzzy_hits;
|
||||
#endif /* FUZZY_BASE36 */
|
||||
|
||||
extern void render_init(void);
|
||||
/**
|
||||
** global variables wthat we are exporting
|
||||
**/
|
||||
struct settings global = {
|
||||
"Eressea", /* gamename */
|
||||
};
|
||||
|
||||
|
||||
|
||||
static char * orders = NULL;
|
||||
static int nowrite = 0;
|
||||
|
||||
static void
|
||||
init_game(void)
|
||||
game_init(void)
|
||||
{
|
||||
init_triggers();
|
||||
init_locales();
|
||||
|
||||
init_races();
|
||||
init_spells();
|
||||
|
@ -116,53 +123,9 @@ init_game(void)
|
|||
init_museum();
|
||||
init_arena();
|
||||
init_xmas2000();
|
||||
render_init();
|
||||
}
|
||||
|
||||
void
|
||||
create_game(void)
|
||||
{
|
||||
assert(regions==NULL || !"game is initialized");
|
||||
printf("Keine Spieldaten gefunden, erzeuge neues Spiel in %s...\n", datapath());
|
||||
makedir(datapath(), 0700);
|
||||
/* erste Insel generieren */
|
||||
new_region(0, 0);
|
||||
/* Monsterpartei anlegen */
|
||||
createmonsters();
|
||||
/* Teleportebene anlegen */
|
||||
create_teleport_plane();
|
||||
}
|
||||
|
||||
void
|
||||
map(void)
|
||||
{
|
||||
FILE * f;
|
||||
region * r;
|
||||
sprintf(buf, "map-%d.cr", turn);
|
||||
f = fopen(buf, "wt");
|
||||
fputs("VERSION 42\n", f);
|
||||
fputs("\"Standard\";konfiguration\n", f);
|
||||
fprintf(f, "%d;runde\n", turn);
|
||||
for (r=regions;r;r=r->next) {
|
||||
fprintf(f, "REGION %d %d\n", r->x, r->y);
|
||||
fprintf(f, "\"%s\";name\n", rname(r, NULL));
|
||||
fprintf(f, "\"%s\";terrain\n", terrain[rterrain(r)].name);
|
||||
if (!mapdetail) continue;
|
||||
fprintf(f, "%d;silber\n", rmoney(r));
|
||||
if (r->display && strlen(r->display))
|
||||
fprintf(f, "\"%s\";beschr\n", r->display);
|
||||
fprintf(f, "%d;bauern\n", rpeasants(r));
|
||||
fprintf(f, "%d;baeume\n", rtrees(r));
|
||||
fprintf(f, "%d;pferde\n", rhorses(r));
|
||||
if (rterrain(r) == T_MOUNTAIN || rterrain(r) == T_GLACIER) {
|
||||
fprintf(f, "%d;eisen\n", riron(r));
|
||||
if (rlaen(r)>=0) fprintf(f, "%d;laen\n", rlaen(r));
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
getgarbage(void)
|
||||
{
|
||||
faction *f;
|
||||
|
@ -186,9 +149,7 @@ getgarbage(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
int quickleave = 0;
|
||||
|
||||
void
|
||||
static void
|
||||
writepasswd(void)
|
||||
{
|
||||
FILE * F;
|
||||
|
@ -207,29 +168,25 @@ writepasswd(void)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef FUZZY_BASE36
|
||||
extern int fuzzy_hits;
|
||||
#endif /* FUZZY_BASE36 */
|
||||
|
||||
void
|
||||
static int
|
||||
processturn(char *filename)
|
||||
{
|
||||
struct summary * begin, * end;
|
||||
int i;
|
||||
|
||||
begin = make_summary(false);
|
||||
printf(" - Korrekturen Runde %d\n", turn);
|
||||
korrektur();
|
||||
turn++;
|
||||
if (!quickleave) {
|
||||
puts(" - entferne Texte der letzten Runde");
|
||||
getgarbage();
|
||||
puts(" - Nehme Korrekturen am Datenbestand vor");
|
||||
if (!readorders(filename)) return;
|
||||
puts(" - entferne Texte der letzten Runde");
|
||||
getgarbage();
|
||||
puts(" - Nehme Korrekturen am Datenbestand vor");
|
||||
if ((i=readorders(filename))!=0) return i;
|
||||
#if BENCHMARK
|
||||
exit(0);
|
||||
exit(0);
|
||||
#endif
|
||||
processorders();
|
||||
score();
|
||||
}
|
||||
processorders();
|
||||
score();
|
||||
#ifdef WACH_WAFF
|
||||
remove_unequipped_guarded();
|
||||
#endif
|
||||
|
@ -254,40 +211,15 @@ processturn(char *filename)
|
|||
sprintf(ztext, "%s/%d", datapath(), turn);
|
||||
writegame(ztext, 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
doreports(void)
|
||||
{
|
||||
struct summary * begin;
|
||||
begin = make_summary(true);
|
||||
printf("Schreibe die Reports der %d. Runde...\n", turn);
|
||||
reports();
|
||||
report_summary(begin, begin, false);
|
||||
free(begin);
|
||||
}
|
||||
|
||||
void
|
||||
showmap(int mode)
|
||||
{
|
||||
FILE * F = cfopen("karte", "w");
|
||||
if (!F)
|
||||
return;
|
||||
puts("Schreibe Karte...");
|
||||
|
||||
writemap(F, mode);
|
||||
|
||||
fclose(F);
|
||||
}
|
||||
|
||||
#if ENNO_CLEANUP
|
||||
|
||||
extern void creport_cleanup(void);
|
||||
extern void reports_cleanup(void);
|
||||
extern void render_cleanup(void);
|
||||
extern void freeland(land_region * lr);
|
||||
|
||||
void
|
||||
cleanup(void)
|
||||
static void
|
||||
game_done(void)
|
||||
{
|
||||
/* Diese Routine enfernt allen allokierten Speicher wieder. Das ist nur
|
||||
* zum Debugging interessant, wenn man Leak Detection hat, und nach
|
||||
|
@ -299,10 +231,6 @@ cleanup(void)
|
|||
faction *f, *f2;
|
||||
ship *s, *s2;
|
||||
|
||||
creport_cleanup();
|
||||
reports_cleanup();
|
||||
render_cleanup();
|
||||
|
||||
free(used_faction_ids);
|
||||
for (r = regions; r; r = r2) {
|
||||
#if 0
|
||||
|
@ -353,8 +281,9 @@ cleanup(void)
|
|||
#ifdef LEAK_DETECT
|
||||
leak_report(stderr);
|
||||
#endif
|
||||
creport_cleanup();
|
||||
reports_cleanup();
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "magic.h"
|
||||
|
||||
|
@ -386,7 +315,7 @@ locale_check(void)
|
|||
}
|
||||
|
||||
#if MALLOCDBG
|
||||
void
|
||||
static void
|
||||
init_malloc_debug(void)
|
||||
{
|
||||
#if (defined(_MSC_VER))
|
||||
|
@ -399,55 +328,110 @@ init_malloc_debug(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
#if 0
|
||||
static void
|
||||
write_stats(void)
|
||||
{
|
||||
int i, errorlevel = 0;
|
||||
|
||||
setlocale(LC_ALL, "");
|
||||
#ifdef LOCALE_CHECK
|
||||
if (!locale_check())
|
||||
puts("ERROR: The current locale is not suitable for international Eressea.\n");
|
||||
#endif
|
||||
#if MALLOCDBG
|
||||
init_malloc_debug();
|
||||
FILE * F;
|
||||
char zText[MAX_PATH];
|
||||
strcat(strcpy(zText, resourcepath()), "/spells");
|
||||
F = fopen(zText, "wt");
|
||||
if (F) {
|
||||
int i, m = -1;
|
||||
for (i=0;spelldaten[i].id;++i) {
|
||||
if (spelldaten[i].magietyp!=m) {
|
||||
m=spelldaten[i].magietyp;
|
||||
fprintf(F, "\n%s\n", magietypen[m]);
|
||||
}
|
||||
fprintf(F, "%d\t%s\n", spelldaten[i].level, spelldaten[i].name);
|
||||
}
|
||||
fclose(F);
|
||||
} else {
|
||||
sprintf(buf, "fopen(%s): ", zText);
|
||||
perror(buf);
|
||||
}
|
||||
strcat(strcpy(zText, resourcepath()), "/bonus");
|
||||
F = fopen(buf, "wt");
|
||||
if (F) {
|
||||
race_t r;
|
||||
for (r=0;r!=MAXRACES;++r) {
|
||||
skill_t sk;
|
||||
int i = 0;
|
||||
fprintf(F, "const bonus %s_bonus = {\n\t", race[r].name[0]);
|
||||
for (sk=0;sk!=MAXSKILLS;sk++) {
|
||||
if (race[r].bonus[sk]) {
|
||||
if (i==8) {
|
||||
i = 0;
|
||||
fputs("\n\t", F);
|
||||
}
|
||||
fprintf(F, "{ SK_%s, %d }, ", skillnames[sk], race[r].bonus[sk]);
|
||||
++i;
|
||||
}
|
||||
}
|
||||
fputs("{ SK_NONE, 0 }\n};\n", F);
|
||||
}
|
||||
fclose(F);
|
||||
} else {
|
||||
sprintf(buf, "fopen(%s): ", zText);
|
||||
perror(zText);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
debug = 0;
|
||||
quickleave = 0;
|
||||
static int
|
||||
usage(const char * prog, const char * arg)
|
||||
{
|
||||
if (arg) {
|
||||
fprintf(stderr, "unknown argument: %s\n\n", arg);
|
||||
}
|
||||
fprintf(stderr, "Usage: %s [options]\n"
|
||||
"-x n : Lädt nur die ersten n regionen\n"
|
||||
"-f x y : Lädt nur die regionen ab (x,y)\n"
|
||||
"-v befehlsdatei : verarbeitet automatisch die angegebene Befehlsdatei\n"
|
||||
"-d datadir : gibt das datenverzeichnis an\n"
|
||||
"-b basedir : gibt das basisverzeichnis an\n"
|
||||
"-r resdir : gibt das resourceverzeichnis an\n"
|
||||
"-t turn : read this datafile, not the most current one\n"
|
||||
"-o reportdir : gibt das reportverzeichnis an\n"
|
||||
"--nomsg : keine Messages (RAM sparen)\n"
|
||||
"--nobattle : keine Kämpfe\n"
|
||||
"--nodebug : keine Logfiles für Kämpfe\n"
|
||||
"--debug : schreibt Debug-Ausgaben in die Datei debug\n"
|
||||
"--nocr : keine CRs\n"
|
||||
"--nonr : keine Reports\n"
|
||||
#ifdef USE_MERIAN
|
||||
"--nomer : keine Meriankarten\n"
|
||||
#endif
|
||||
"--help : help\n", prog);
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf(
|
||||
"\n"
|
||||
"%s PBEM host\n"
|
||||
"Copyright (C) 1996-99 C.Schlittchen, K.Zedel, E.Rehling, H.Peters.\n\n"
|
||||
|
||||
"based on Atlantis v1.0\n"
|
||||
"Copyright (C) 1993 by Russell Wallace.\n"
|
||||
"and on German Atlantis v2.3\n"
|
||||
"Copyright (C) 1996 by Alexander Schroeder.\n\n"
|
||||
|
||||
"Eressea is distributed in the hope that it will be useful,\n"
|
||||
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
|
||||
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
|
||||
|
||||
"This program may be freely used, modified and distributed. It may\n"
|
||||
"not be sold or used commercially without prior written permission\n"
|
||||
"from the author.\n\n"
|
||||
|
||||
"Compilation: " __DATE__ " at " __TIME__ "\nVersion: %f\n", global.gamename, version());
|
||||
|
||||
for (i = 1; i != argc; i++)
|
||||
if ((argv[i][0] == '-' || argv[i][0] == '/'))
|
||||
switch (argv[i][1]) {
|
||||
static int
|
||||
read_args(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
for (i=1;i!=argc;++i) {
|
||||
if (argv[i][0]!='-') {
|
||||
return usage(argv[0], argv[i]);
|
||||
} else if (argv[i][1]=='-') { /* long format */
|
||||
if (strcmp(argv[i]+1, "nocr")==0) nocr = true;
|
||||
else if (strcmp(argv[i]+2, "nosave")==0) nowrite = true;
|
||||
else if (strcmp(argv[i]+2, "nonr")==0) nonr = true;
|
||||
else if (strcmp(argv[i]+2, "nomsg")==0) nomsg = true;
|
||||
else if (strcmp(argv[i]+2, "nobattle")==0) nobattle = true;
|
||||
else if (strcmp(argv[i]+2, "nodebug")==0) nobattledebug = true;
|
||||
#ifdef USE_MERIAN
|
||||
else if (strcmp(argv[i]+2, "nomer")==0) nomer = true;
|
||||
#endif
|
||||
else if (strcmp(argv[i]+2, "help")==0)
|
||||
return usage(argv[0], NULL);
|
||||
else
|
||||
return usage(argv[0], argv[i]);
|
||||
} else switch(argv[i][1]) {
|
||||
case 'o':
|
||||
g_reportdir = argv[++i];
|
||||
break;
|
||||
case 'd':
|
||||
if (!strcmp(argv[i] + 1, "debug")) {
|
||||
nodescriptions = 1;
|
||||
debug = fopen("debug", "w");
|
||||
break;
|
||||
}
|
||||
g_datadir = argv[++i];
|
||||
break;
|
||||
case 'r':
|
||||
|
@ -466,301 +450,61 @@ main(int argc, char *argv[])
|
|||
case 'q':
|
||||
quiet = 1;
|
||||
break;
|
||||
case 'i':
|
||||
inside_only = 1;
|
||||
printf(" - Lade nur die innersten Regionen.\n");
|
||||
case 'v':
|
||||
if (i<argc) orders = argv[++i];
|
||||
else return usage(argv[0], argv[i]);
|
||||
break;
|
||||
case 'x':
|
||||
maxregions = atoi(argv[++i]);
|
||||
maxregions = (maxregions*81+80) / 81;
|
||||
break;
|
||||
}
|
||||
{
|
||||
char zText[MAX_PATH];
|
||||
strcat(strcpy(zText, resourcepath()), "/timestrings");
|
||||
read_datenames(zText);
|
||||
}
|
||||
|
||||
#ifdef WRITE_STATS
|
||||
{
|
||||
FILE * F;
|
||||
char zText[MAX_PATH];
|
||||
strcat(strcpy(zText, resourcepath()), "/spells");
|
||||
F = fopen(zText, "wt");
|
||||
if (F) {
|
||||
int i, m = -1;
|
||||
for (i=0;spelldaten[i].id;++i) {
|
||||
if (spelldaten[i].magietyp!=m) {
|
||||
m=spelldaten[i].magietyp;
|
||||
fprintf(F, "\n%s\n", magietypen[m]);
|
||||
}
|
||||
fprintf(F, "%d\t%s\n", spelldaten[i].level, spelldaten[i].name);
|
||||
}
|
||||
fclose(F);
|
||||
} else {
|
||||
sprintf(buf, "fopen(%s): ", zText);
|
||||
perror(buf);
|
||||
}
|
||||
strcat(strcpy(zText, resourcepath()), "/bonus");
|
||||
F = fopen(buf, "wt");
|
||||
if (F) {
|
||||
race_t r;
|
||||
for (r=0;r!=MAXRACES;++r) {
|
||||
skill_t sk;
|
||||
int i = 0;
|
||||
fprintf(F, "const bonus %s_bonus = {\n\t", race[r].name[0]);
|
||||
for (sk=0;sk!=MAXSKILLS;sk++) {
|
||||
if (race[r].bonus[sk]) {
|
||||
if (i==8) {
|
||||
i = 0;
|
||||
fputs("\n\t", F);
|
||||
}
|
||||
fprintf(F, "{ SK_%s, %d }, ", skillnames[sk], race[r].bonus[sk]);
|
||||
++i;
|
||||
}
|
||||
}
|
||||
fputs("{ SK_NONE, 0 }\n};\n", F);
|
||||
}
|
||||
fclose(F);
|
||||
} else {
|
||||
sprintf(buf, "fopen(%s): ", zText);
|
||||
perror(zText);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
init_game();
|
||||
initgame();
|
||||
readgame(false);
|
||||
#if MALLOCDBG
|
||||
assert(_CrtCheckMemory());
|
||||
#endif
|
||||
/* verify_data(); */
|
||||
|
||||
if (turn == 0)
|
||||
srand(time((time_t *) NULL));
|
||||
else
|
||||
srand(turn);
|
||||
|
||||
/* Problem: In jedem Report ist die Regionsreihenfolge eine andere. */
|
||||
|
||||
/* { int nregions=0; region *r; for(r=regions;r;r=r->next) nregions++;
|
||||
* scramble(regions, nregions, sizeof(region *)); } */
|
||||
|
||||
errorlevel = -1;
|
||||
|
||||
for (i = 1; i != argc; i++)
|
||||
if (argv[i][0] == '-' ||
|
||||
argv[i][0] == '/')
|
||||
switch (argv[i][1]) {
|
||||
case 'c':
|
||||
korrektur();
|
||||
break;
|
||||
case 'Q':
|
||||
quickleave = 1;
|
||||
break;
|
||||
case 'n':
|
||||
if (strcmp(argv[i]+1, "nocr")==0) nocr = true;
|
||||
else if (strcmp(argv[i]+1, "nosave")==0) nowrite = true;
|
||||
else if (strcmp(argv[i]+1, "nonr")==0) nonr = true;
|
||||
else if (strcmp(argv[i]+1, "nomer")==0) nomer = true;
|
||||
else if (strcmp(argv[i]+1, "nomsg")==0) nomsg = true;
|
||||
else if (strcmp(argv[i]+1, "nobattle")==0) nobattle = true;
|
||||
else if (strcmp(argv[i]+1, "nodebug")==0) nobattledebug = true;
|
||||
break;
|
||||
case 'v':
|
||||
++i;
|
||||
#define TEST_BORDERS 0
|
||||
#if TEST_BORDERS
|
||||
{
|
||||
border * b;
|
||||
new_border(&bt_fogwall, findregion(5,-6), findregion(5, -5));
|
||||
new_border(&bt_noway, findregion(4,-5), findregion(5, -5));
|
||||
new_border(&bt_wall, findregion(5,-5), findregion(6, -5));
|
||||
b = new_border(&bt_illusionwall, findregion(4,-4), findregion(5, -5));
|
||||
b->data = (void*) 1; /* partei 1 hat's gezaubert */
|
||||
}
|
||||
#endif
|
||||
if (i >= argc || argv[i][0]) {
|
||||
printf(" - verwende Befehlsdatei: %s\n", argv[i]);
|
||||
processturn(argv[i]);
|
||||
errorlevel = 0;
|
||||
} else {
|
||||
puts("Fehler: keine Befehlsdatei angegeben.\n\n");
|
||||
errorlevel = 1;
|
||||
}
|
||||
break;
|
||||
#ifdef EXTRA_CR
|
||||
case 'p' :
|
||||
{
|
||||
FILE * out = fopen("planes.cr", "wt");
|
||||
faction * f;
|
||||
region * r;
|
||||
if (!out) break;
|
||||
fprintf(out, "VERSION 36\n");
|
||||
for (f = factions; f; f = f->next) cr_faction(out, f);
|
||||
for (r = regions;r;r=r->next) if (getplane(r)) cr_region(out, r);
|
||||
fclose(out);
|
||||
}
|
||||
break;
|
||||
case 'w' :
|
||||
{
|
||||
FILE * out = fopen("world.cr", "wt");
|
||||
faction * f;
|
||||
region * r;
|
||||
if (!out) break;
|
||||
fprintf(out, "VERSION 36\n");
|
||||
for (f = factions; f; f = f->next) cr_faction(out, f);
|
||||
for (r = regions;r;r=r->next) cr_region(out, r);
|
||||
fclose(out);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
case '#':
|
||||
score();
|
||||
exit(0);
|
||||
break;
|
||||
case 'm':
|
||||
if (argv[i][2]=='d') mapdetail = 1;
|
||||
map();
|
||||
break;
|
||||
case 'f':
|
||||
i++;
|
||||
case 'r':
|
||||
case 'b':
|
||||
case 't':
|
||||
case 'x':
|
||||
i++;
|
||||
case 'q':
|
||||
case 'i':
|
||||
/* inner_world, quiet, minfaction und maxregions wird schon vorher abgefragt */
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Usage: %s [options]\n"
|
||||
"-r : schreibt die Reports neu\n"
|
||||
"-x n : Lädt nur die ersten n regionen\n"
|
||||
"-g befehlsdatei : verarbeitet Spielleiterbefehle\n"
|
||||
"-v befehlsdatei : verarbeitet automatisch die angegebene Befehlsdatei\n"
|
||||
"-# : gibt Scoreliste aus\n"
|
||||
"-d datadir : gibt das datenverzeichnis an\n"
|
||||
"-o reportdir : gibt das reportverzeichnis an\n"
|
||||
"-nomsg : keine Messages (RAM sparen)\n"
|
||||
#ifdef USE_MERIAN
|
||||
"-nomer : keine Meriankarten\n"
|
||||
#endif
|
||||
"-nocr : keine CRs\n"
|
||||
"-nonr : keine Reports\n"
|
||||
"-nobattle : keine Kämpfe\n"
|
||||
"-debug : schreibt Debug-Ausgaben in die Datei debug\n"
|
||||
"-? : help\n", argv[0]);
|
||||
errorlevel = 1;
|
||||
break;
|
||||
}
|
||||
if (errorlevel >= 0) {
|
||||
#if ENNO_CLEANUP
|
||||
cleanup();
|
||||
#endif
|
||||
game_done();
|
||||
return errorlevel;
|
||||
}
|
||||
puts("? zeigt das Menue an.");
|
||||
printf("sizeof:\n region\t%d (%d)\n unit\t%d (%d)\n", (int)sizeof(region), listlen(regions), (int)sizeof(unit), -1);
|
||||
printf(" ship\t%d (%d)\n building\t%d(%d)\n", (int)sizeof(ship), -1, (int)sizeof(building), -1);
|
||||
|
||||
for (;;) {
|
||||
if (quickleave) break;
|
||||
printf("> ");
|
||||
fgets(buf, 1024, stdin);
|
||||
|
||||
switch (buf[0]) {
|
||||
case 'c':
|
||||
korrektur();
|
||||
break;
|
||||
|
||||
case 'k':
|
||||
showmap(M_TERRAIN);
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
showmap(M_FACTIONS);
|
||||
break;
|
||||
|
||||
case 'u':
|
||||
showmap(M_UNARMED);
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
printf("Datei mit den Befehlen? ");
|
||||
fgets(buf, 1024, stdin);
|
||||
if (buf[0])
|
||||
processturn(buf);
|
||||
break;
|
||||
|
||||
case 's':
|
||||
{
|
||||
char ztext[64];
|
||||
sprintf(ztext, "data/%d", turn);
|
||||
writegame(ztext, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'q':
|
||||
#if ENNO_CLEANUP
|
||||
cleanup();
|
||||
#endif
|
||||
game_done();
|
||||
return 0;
|
||||
case 'Q':
|
||||
quickleave = 1;
|
||||
break;
|
||||
case 'l':
|
||||
listnames();
|
||||
break;
|
||||
|
||||
case '#':
|
||||
score();
|
||||
break;
|
||||
|
||||
#ifdef QTMAP
|
||||
case '*':
|
||||
qt_edit_map(argc, argv);
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
puts("modify:\n"
|
||||
" v - Befehle verarbeiten.\n"
|
||||
" g - Spielleiterbefehle verarbeiten.\n"
|
||||
" e - Erzeuge Regionen.\n"
|
||||
" t - Terraform Region.\n"
|
||||
" T - Terraform Block.\n"
|
||||
" m - Erschaffe Einheiten und Monster.\n"
|
||||
" b - Erbaue eine Burg.\n"
|
||||
" n - Neue Spieler hinzufuegen.\n"
|
||||
" M - Move unit.\n"
|
||||
" c - Korrekturen durchführen.\n"
|
||||
"information:\n"
|
||||
" a - Adressen anzeigen.\n"
|
||||
" i - Info ueber eine Region.\n"
|
||||
" U - Info ueber units einer Region.\n"
|
||||
" k - Karte anzeigen.\n"
|
||||
" p - Politische Karte anzeigen.\n"
|
||||
" u - Karte unbewaffneter Regionen anzeigen.\n"
|
||||
" l - Liste aller Laendernamen zeigen.\n"
|
||||
#ifdef QTMAP
|
||||
" * - Qt-Karte anzeigen.\n"
|
||||
#endif
|
||||
"save:\n"
|
||||
" r - Reports schreiben.\n"
|
||||
" # - Scoreliste speichern.\n"
|
||||
" s - Spielstand speichern.\n"
|
||||
"\n"
|
||||
" q - Beenden.");
|
||||
usage(argv[0], argv[i]);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct settings global = {
|
||||
"Eressea", /* gamename */
|
||||
};
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
char zText[MAX_PATH];
|
||||
|
||||
printf("\n%s PBEM host\n"
|
||||
"Copyright (C) 1996-2001 C.Schlittchen, K.Zedel, E.Rehling, H.Peters.\n\n"
|
||||
"Compilation: " __DATE__ " at " __TIME__ "\nVersion: %f\n\n", global.gamename, version());
|
||||
|
||||
setlocale(LC_ALL, "");
|
||||
#ifdef LOCALE_CHECK
|
||||
if (!locale_check()) {
|
||||
puts("ERROR: The current locale is not suitable for international Eressea.\n");
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
#if MALLOCDBG
|
||||
init_malloc_debug();
|
||||
#endif
|
||||
|
||||
if ((i=read_args(argc, argv))!=0) return i;
|
||||
|
||||
printf(
|
||||
"version %d.%d\n"
|
||||
"turn %d.\n"
|
||||
"orders %s.\n",
|
||||
global.data_version / 10, global.data_version % 10, turn, orders);
|
||||
|
||||
strcat(strcpy(zText, resourcepath()), "/timestrings");
|
||||
if ((i=read_datenames(zText))!=0) return i;
|
||||
|
||||
kernel_init();
|
||||
game_init();
|
||||
|
||||
if ((i=readgame(false))!=0) return i;
|
||||
if ((i=processturn(orders))!=0) return i;
|
||||
|
||||
game_done();
|
||||
kernel_done();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* vi: set ts=2:
|
||||
*
|
||||
* $Id: mapper.c,v 1.5 2001/02/04 18:51:00 corwin Exp $
|
||||
* $Id: mapper.c,v 1.6 2001/02/05 16:11:58 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)
|
||||
|
@ -1160,9 +1160,6 @@ main(int argc, char *argv[])
|
|||
maxregions = atoi(argv[++i]);
|
||||
maxregions = (maxregions*81+80) / 81;
|
||||
break;
|
||||
case 'i':
|
||||
inside_only=1;
|
||||
break;
|
||||
case 'q': quiet = true; break;
|
||||
case 'n':
|
||||
switch (argv[i][2]) {
|
||||
|
@ -1194,9 +1191,9 @@ main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
initgame();
|
||||
kernel_init();
|
||||
|
||||
init_triggers();
|
||||
init_locales();
|
||||
init_attributes();
|
||||
|
||||
init_resources();
|
||||
|
@ -1206,7 +1203,6 @@ main(int argc, char *argv[])
|
|||
init_museum();
|
||||
init_arena();
|
||||
init_xmas2000();
|
||||
render_init();
|
||||
|
||||
if(!*datafile)
|
||||
sprintf(datafile, "%s/%d", datapath(), turn);
|
||||
|
|
|
@ -90,7 +90,7 @@ main(int argc, char ** argv)
|
|||
if (in==NULL) return -1;
|
||||
}
|
||||
|
||||
initgame();
|
||||
kernel_init();
|
||||
readgame(false);
|
||||
|
||||
markup(in);
|
||||
|
|
Loading…
Reference in New Issue