Skip to content

Commit

Permalink
Fixed: "Failing to read more than one loose ded" see here (http://sou…
Browse files Browse the repository at this point in the history
…rceforge.net/tracker2/?func=detail&aid=2646623&group_id=74815&atid=542099).

This wasn't strictly speaking a bug in that Doomsday expected that there would only be one instance of -def and/or -defs on the command line. Snowberry however assumed that any number of these may be specified. As such, I've opted to change how these command line options are handled in Doomsday:

The command line options -def and -defs are now treated identically, each can be used to specify one or more DED on the command line (e.g., "-def "}defs/jdoom/file1.ded" "}defs/jdoom/file2.ded") and Doomsday now accepts multiple instances of either option (e.g., "-def "}defs/jdoom/file1.ded" -def "}defs/jdoom/file2.ded"").
  • Loading branch information
danij committed Mar 20, 2009
1 parent 4c86ad9 commit 774d92b
Showing 1 changed file with 14 additions and 25 deletions.
39 changes: 14 additions & 25 deletions doomsday/engine/portable/src/def_main.c
Expand Up @@ -125,7 +125,7 @@ static int GetXGClasses(void)
*/
void Def_Init(void)
{
int c;
int c, p;

sprNames = NULL; // Sprite name list.
mobjInfo = NULL;
Expand All @@ -147,41 +147,30 @@ void Def_Init(void)

DED_Init(&defs);

memset(dedFiles, 0, sizeof(dedFiles));

// The engine defs.
dedFiles[0] = defsFileName;
c = 0;
dedFiles[c++] = defsFileName;

// Add the default ded. It will be overwritten by -defs.
dedFiles[c = 1] = topDefsFileName;
dedFiles[c++] = topDefsFileName;

// See which .ded files are specified on the command line.
if(ArgCheck("-defs"))
for(p = 0; p < Argc(); ++p)
{
while(c < MAX_READ)
{
char* arg = ArgNext();
const char* arg = Argv(p);

if(!arg || arg[0] == '-')
break;
if(stricmp(arg, "-def") && stricmp(arg, "-defs"))
continue;

while(c < MAX_READ && ++p != Argc() && !ArgIsOption(p))
{
// Add it to the list.
dedFiles[c++] = arg;
dedFiles[c++] = Argv(p);
}
}

// How about additional .ded files?
if(ArgCheckWith("-def", 1))
{
// Find the next empty place.
for(c = 0; dedFiles[c] && c < MAX_READ; ++c);
while(c < MAX_READ)
{
char* arg = ArgNext();

if(!arg || arg[0] == '-')
break;
// Add it to the list.
dedFiles[c++] = arg;
}
p--;/* For ArgIsOption(p) necessary, for p==Argc() harmless */
}
}

Expand Down

0 comments on commit 774d92b

Please sign in to comment.