allocate mission filenames dynamically

This commit is contained in:
Bradley Bell 2004-12-17 14:31:18 +00:00
parent 31ec92d9c2
commit cfa099c0c7
2 changed files with 7 additions and 5 deletions

View file

@ -1,4 +1,4 @@
/* $Id: mission.c,v 1.37 2004-12-17 14:28:41 btb Exp $ */
/* $Id: mission.c,v 1.38 2004-12-17 14:31:18 btb Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -455,6 +455,7 @@ void add_missions_to_list(mle *mission, int anarchy_mode)
ext = strrchr(*i, '.');
if (ext && (!strnicmp(ext, ".msn", 4) || !strnicmp(ext, ".mn2", 4)))
if (read_mission_file(mission, *i, ML_MISSIONDIR))
{
if (anarchy_mode || !mission->anarchy_only_flag) {
mission++;
num_missions++;
@ -462,6 +463,7 @@ void add_missions_to_list(mle *mission, int anarchy_mode)
}
else
d_free(mission->filename);
}
if (num_missions >= MAX_MISSIONS)
{
mprintf((0, "Warning: more missions than d2x can handle\n"));

View file

@ -1,4 +1,4 @@
/* $Id: mission.h,v 1.23 2004-11-19 18:42:48 schaffner Exp $ */
/* $Id: mission.h,v 1.24 2004-12-17 14:28:41 btb Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -63,12 +63,12 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#endif
typedef struct {
char *filename; // filename
int builtin_hogsize; // the size of the hogfile for a builtin mission, and 0 for an add-on mission
char mission_name[MISSION_NAME_LEN+1];
char filename[9]; // filename
ubyte descent_version; // descent 1 or descent 2?
bool anarchy_only_flag; // if true, mission is only for anarchy
ubyte anarchy_only_flag; // if true, mission is only for anarchy
ubyte enhanced; // 0: mission has "name", 1:"xname", 2:"zname"
int builtin_hogsize; // the size of the hogfile for a builtin mission, and 0 for an add-on mission
char briefing_text_filename[FILENAME_LEN]; // name of briefing file
char ending_text_filename[FILENAME_LEN]; // name of ending file
ubyte last_level;