Skip to content

Commit

Permalink
wad: Move W_CheckCorrectIWAD() into w_main.c.
Browse files Browse the repository at this point in the history
This seems like a more appropriate place for it.
  • Loading branch information
fragglet committed Aug 17, 2015
1 parent a28f2f4 commit f804a75
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 48 deletions.
44 changes: 43 additions & 1 deletion src/w_main.c
Expand Up @@ -16,8 +16,10 @@
// Common code to parse command line, identifying WAD files to load.
//

#include "config.h"
#include "doomfeatures.h"
#include "d_iwad.h"
#include "i_system.h"
#include "m_argv.h"
#include "w_main.h"
#include "w_merge.h"
Expand All @@ -26,7 +28,6 @@

// Parse the command line, merging WAD files that are sppecified.
// Returns true if at least one file was added.

boolean W_ParseCommandLine(void)
{
boolean modifiedgame = false;
Expand Down Expand Up @@ -196,3 +197,44 @@ boolean W_ParseCommandLine(void)
return modifiedgame;
}

// Lump names that are unique to particular game types. This lets us check
// the user is not trying to play with the wrong executable, eg.
// chocolate-doom -iwad hexen.wad.
static const struct
{
GameMission_t mission;
char *lumpname;
} unique_lumps[] = {
{ doom, "POSSA1" },
{ heretic, "IMPXA1" },
{ hexen, "ETTNA1" },
{ strife, "AGRDA1" },
};

void W_CheckCorrectIWAD(GameMission_t mission)
{
int i;
lumpindex_t lumpnum;

for (i = 0; i < arrlen(unique_lumps); ++i)
{
if (mission != unique_lumps[i].mission)
{
lumpnum = W_CheckNumForName(unique_lumps[i].lumpname);

if (lumpnum >= 0)
{
I_Error("\nYou are trying to use a %s IWAD file with "
"the %s%s binary.\nThis isn't going to work.\n"
"You probably want to use the %s%s binary.",
D_SuggestGameName(unique_lumps[i].mission,
indetermined),
PROGRAM_PREFIX,
D_GameMissionString(mission),
PROGRAM_PREFIX,
D_GameMissionString(unique_lumps[i].mission));
}
}
}
}

3 changes: 3 additions & 0 deletions src/w_main.h
Expand Up @@ -18,7 +18,10 @@
#ifndef W_MAIN_H
#define W_MAIN_H

#include "d_mode.h"

boolean W_ParseCommandLine(void);
void W_CheckCorrectIWAD(GameMission_t mission);

#endif /* #ifndef W_MAIN_H */

43 changes: 0 additions & 43 deletions src/w_wad.c
Expand Up @@ -26,8 +26,6 @@

#include "doomtype.h"

#include "config.h"
#include "d_iwad.h"
#include "i_swap.h"
#include "i_system.h"
#include "i_video.h"
Expand Down Expand Up @@ -614,44 +612,3 @@ void W_Reload(void)
W_GenerateHashTable();
}

// Lump names that are unique to particular game types. This lets us check
// the user is not trying to play with the wrong executable, eg.
// chocolate-doom -iwad hexen.wad.
static const struct
{
GameMission_t mission;
char *lumpname;
} unique_lumps[] = {
{ doom, "POSSA1" },
{ heretic, "IMPXA1" },
{ hexen, "ETTNA1" },
{ strife, "AGRDA1" },
};

void W_CheckCorrectIWAD(GameMission_t mission)
{
int i;
lumpindex_t lumpnum;

for (i = 0; i < arrlen(unique_lumps); ++i)
{
if (mission != unique_lumps[i].mission)
{
lumpnum = W_CheckNumForName(unique_lumps[i].lumpname);

if (lumpnum >= 0)
{
I_Error("\nYou are trying to use a %s IWAD file with "
"the %s%s binary.\nThis isn't going to work.\n"
"You probably want to use the %s%s binary.",
D_SuggestGameName(unique_lumps[i].mission,
indetermined),
PROGRAM_PREFIX,
D_GameMissionString(mission),
PROGRAM_PREFIX,
D_GameMissionString(unique_lumps[i].mission));
}
}
}
}

4 changes: 0 additions & 4 deletions src/w_wad.h
Expand Up @@ -23,8 +23,6 @@
#include <stdio.h>

#include "doomtype.h"
#include "d_mode.h"

#include "w_file.h"


Expand Down Expand Up @@ -74,6 +72,4 @@ extern unsigned int W_LumpNameHash(const char *s);
void W_ReleaseLumpNum(lumpindex_t lump);
void W_ReleaseLumpName(char *name);

void W_CheckCorrectIWAD(GameMission_t mission);

#endif

0 comments on commit f804a75

Please sign in to comment.