168 if ((fp = fopen(filename,
"r")) != NULL) {
169 while (fgets(tmpbuf,
MAX_BUF-1, fp)) {
170 if (tmpbuf[0] ==
'#')
174 tmpbuf[strlen(tmpbuf)-1] = 0;
176 }
else if (online == 1) {
178 }
else if (online == 2) {
187 LOG(
llevError,
"Online read partial data from %s\n", filename);
228 cp = getenv(
"CROSSFIRE_LIBDIR");
231 cp = getenv(
"CROSSFIRE_LOCALDIR");
234 cp = getenv(
"CROSSFIRE_PLAYERDIR");
237 cp = getenv(
"CROSSFIRE_MAPDIR");
240 cp = getenv(
"CROSSFIRE_ARCHETYPES");
243 cp = getenv(
"CROSSFIRE_TREASURES");
246 cp = getenv(
"CROSSFIRE_UNIQUEDIR");
249 cp = getenv(
"CROSSFIRE_TEMPLATEDIR");
252 cp = getenv(
"CROSSFIRE_TMPDIR");
269 fprintf(stderr,
"Unable to open %s as the logfile - will use stderr instead\n", settings.
logfilename);
272 setvbuf(
logfile, NULL, _IOLBF, 0);
404 LOG(
llevError,
"Unable to continue without initial map.\n");
413 LOG(
llevError,
"You need a archetype called 'map' and it have to contain start map\n");
429 if ((fp = fopen(filename,
"w")) == NULL) {
430 LOG(
llevError,
"Cannot open %s for writing\n", filename);
444 static int has_been_done = 0;
452 LOG(
llevDebug,
"Reading clockdata from %s...\n", filename);
453 if ((fp = fopen(filename,
"r")) == NULL) {
478 static int has_been_done = 0;
479 int mess, level, comp;
480 int mode = 0, total = 0;
487 snprintf(filename,
sizeof(filename),
"%s/attackmess", settings.
datadir);
488 LOG(
llevDebug,
"Reading attack messages from %s...\n", filename);
495 while (fgets(buf,
MAX_BUF, fp) != NULL) {
498 if ((cp = strchr(buf,
'\n')) != NULL)
504 if (strncmp(cp,
"TYPE:", 5) == 0) {
505 p = strtok(buf,
":");
506 p = strtok(NULL,
":");
508 attack_mess[mess][level].
level = -1;
509 attack_mess[mess][level].
buf1 = NULL;
510 attack_mess[mess][level].
buf2 = NULL;
511 attack_mess[mess][level].
buf3 = NULL;
519 p = strtok(buf,
"=");
520 attack_mess[mess][level].
level = atoi(buf);
521 p = strtok(NULL,
"=");
528 }
else if (mode == 2) {
529 p = strtok(buf,
"=");
530 attack_mess[mess][level].
level = atoi(buf);
531 p = strtok(NULL,
"=");
538 }
else if (mode == 3) {
539 p = strtok(buf,
"=");
540 attack_mess[mess][level].
level = atoi(buf);
541 p = strtok(NULL,
"=");
552 LOG(
llevDebug,
"got %d messages in %d categories.\n", total, mess+1);
#define STAT_LOSS_ON_DEATH
#define SPELL_FAILURE_EFFECTS
#define BALANCED_STAT_LOSS
#define SPELLPOINT_LEVEL_DEPEND
struct Statistics statistics
#define DEATH_PENALTY_RATIO
attackmess_t attack_mess[NROFATTACKMESS][MAXATTACKMESS]
EXTERN int num_animations
EXTERN objectlink * first_friendly_object
#define PERMANENT_EXPERIENCE_RATIO
#define ARMOR_SPEED_IMPROVEMENT
#define EMERGENCY_MAPPATH
mapstruct * ready_map_name(const char *name, int flags)
void init_archetypes(void)
#define ARMOR_SPEED_LINEAR
#define ARMOR_MAX_ENCHANT
void close_and_delete(FILE *fp, int compressed)
static void init_attackmess(void)
void init_experience(void)
#define SPELL_ENCUMBRANCE
EXTERN char first_map_ext_path[MAX_BUF]
#define DEATH_PENALTY_LEVEL
const char *const spellpathnames[NRSPELLPATHS]
EXTERN archetype * amulet_arch
void init_hash_table(void)
#define ARMOR_WEIGHT_LINEAR
void write_todclock(void)
static void init_emergency_mappath(void)
static void init_defaults(void)
static void init_environ(void)
EXTERN const char * undead_name
#define RESET_LOCATION_TIME
EXTERN Animations * animations
static void init_dynamic(void)
void free_experience(void)
#define FREE_AND_CLEAR_STR(xyz)
EXTERN treasurelist * first_treasurelist
EXTERN artifactlist * first_artifactlist
char * strdup_local(const char *str)
void read_bmap_names(void)
EXTERN long nrofartifacts
EXTERN long nrofallowedstr
int snprintf(char *dest, int max, const char *format,...)
EXTERN archetype * staff_arch
EXTERN long trying_emergency_save
EXTERN int animations_allocated
object objarray[STARTMAX]
void delete_map(mapstruct *m)
EXTERN char first_map_path[MAX_BUF]
sstring add_string(const char *str)
EXTERN player * first_player
#define ARMOR_WEIGHT_REDUCTION
void LOG(LogLevel logLevel, const char *format,...)
EXTERN long warn_archetypes
EXTERN archetype * ring_arch
EXTERN region * first_region
static void init_clocks(void)
#define FREE_AND_CLEAR(xyz)
#define SET_FRIENDLY_FIRE
EXTERN mapstruct * first_map
EXTERN archetype * first_archetype
FILE * open_and_uncompress(const char *name, int flag, int *compressed)
EXTERN long nroftreasures