Don't print W_VerifyFile errors more than once
This commit is contained in:
parent
6b4d422664
commit
445d040795
|
@ -998,7 +998,7 @@ static void IdentifyVersion(void)
|
||||||
#define MUSICTEST(str) \
|
#define MUSICTEST(str) \
|
||||||
{\
|
{\
|
||||||
const char *musicpath = va(pandf,srb2waddir,str);\
|
const char *musicpath = va(pandf,srb2waddir,str);\
|
||||||
int ms = W_VerifyNMUSlumps(musicpath); \
|
int ms = W_VerifyNMUSlumps(musicpath, false); \
|
||||||
if (ms == 1) \
|
if (ms == 1) \
|
||||||
D_AddFile(startupwadfiles, musicpath); \
|
D_AddFile(startupwadfiles, musicpath); \
|
||||||
else if (ms == 0) \
|
else if (ms == 0) \
|
||||||
|
@ -1187,14 +1187,10 @@ void D_SRB2Main(void)
|
||||||
const char *s = M_GetNextParm();
|
const char *s = M_GetNextParm();
|
||||||
|
|
||||||
if (s) // Check for NULL?
|
if (s) // Check for NULL?
|
||||||
{
|
|
||||||
if (!W_VerifyNMUSlumps(s))
|
|
||||||
G_SetGameModified(true);
|
|
||||||
D_AddFile(startuppwads, s);
|
D_AddFile(startuppwads, s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// get map from parms
|
// get map from parms
|
||||||
|
|
||||||
|
|
|
@ -3294,7 +3294,13 @@ static void Command_Addfile(void)
|
||||||
if (!isprint(fn[i]) || fn[i] == ';')
|
if (!isprint(fn[i]) || fn[i] == ';')
|
||||||
return;
|
return;
|
||||||
|
|
||||||
musiconly = W_VerifyNMUSlumps(fn);
|
musiconly = W_VerifyNMUSlumps(fn, false);
|
||||||
|
|
||||||
|
if (musiconly == -1)
|
||||||
|
{
|
||||||
|
addedfiles[numfilesadded++] = fn;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!musiconly)
|
if (!musiconly)
|
||||||
{
|
{
|
||||||
|
|
23
src/w_wad.c
23
src/w_wad.c
|
@ -66,6 +66,7 @@
|
||||||
#include "p_setup.h" // P_ScanThings
|
#include "p_setup.h" // P_ScanThings
|
||||||
#endif
|
#endif
|
||||||
#include "m_misc.h" // M_MapNumber
|
#include "m_misc.h" // M_MapNumber
|
||||||
|
#include "g_game.h" // G_SetGameModified
|
||||||
|
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
#include "hardware/hw_main.h"
|
#include "hardware/hw_main.h"
|
||||||
|
@ -683,9 +684,9 @@ static UINT16 W_InitFileError (const char *filename, boolean exitworthy)
|
||||||
if (exitworthy)
|
if (exitworthy)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
CONS_Error("A WAD file was not found or not valid.\nCheck the log to see which ones.\n");
|
CONS_Error(va("%s was not found or not valid.\nCheck the log for more details.\n", filename));
|
||||||
#else
|
#else
|
||||||
I_Error("A WAD file was not found or not valid.\nCheck the log to see which ones.\n");
|
I_Error("%s was not found or not valid.\nCheck the log for more details.\n", filename);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -746,12 +747,12 @@ UINT16 W_InitFile(const char *filename, boolean mainfile, boolean startup)
|
||||||
if ((handle = W_OpenWadFile(&filename, true)) == NULL)
|
if ((handle = W_OpenWadFile(&filename, true)) == NULL)
|
||||||
return W_InitFileError(filename, startup);
|
return W_InitFileError(filename, startup);
|
||||||
|
|
||||||
important = W_VerifyNMUSlumps(filename);
|
important = W_VerifyNMUSlumps(filename, startup);
|
||||||
|
|
||||||
if (important == -1)
|
if (important == -1)
|
||||||
{
|
{
|
||||||
fclose(handle);
|
fclose(handle);
|
||||||
return W_InitFileError(filename, startup);
|
return INT16_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if wad files will overflow fileneededbuffer. Only the filename part
|
// Check if wad files will overflow fileneededbuffer. Only the filename part
|
||||||
|
@ -819,6 +820,9 @@ UINT16 W_InitFile(const char *filename, boolean mainfile, boolean startup)
|
||||||
return W_InitFileError(filename, startup);
|
return W_InitFileError(filename, startup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (important && !mainfile)
|
||||||
|
G_SetGameModified(true);
|
||||||
|
|
||||||
//
|
//
|
||||||
// link wad file to search files
|
// link wad file to search files
|
||||||
//
|
//
|
||||||
|
@ -2088,12 +2092,13 @@ static int W_VerifyFile(const char *filename, lumpchecklist_t *checklist,
|
||||||
* be sent.
|
* be sent.
|
||||||
*
|
*
|
||||||
* \param filename Filename of the wad to check.
|
* \param filename Filename of the wad to check.
|
||||||
|
* \param exit_on_error Whether to exit upon file error.
|
||||||
* \return 1 if file contains only music/sound lumps, 0 if it contains other
|
* \return 1 if file contains only music/sound lumps, 0 if it contains other
|
||||||
* stuff (maps, sprites, dehacked lumps, and so on). -1 if there no
|
* stuff (maps, sprites, dehacked lumps, and so on). -1 if there no
|
||||||
* file exists with that filename
|
* file exists with that filename
|
||||||
* \author Alam Arias
|
* \author Alam Arias
|
||||||
*/
|
*/
|
||||||
int W_VerifyNMUSlumps(const char *filename)
|
int W_VerifyNMUSlumps(const char *filename, boolean exit_on_error)
|
||||||
{
|
{
|
||||||
// MIDI, MOD/S3M/IT/XM/OGG/MP3/WAV, WAVE SFX
|
// MIDI, MOD/S3M/IT/XM/OGG/MP3/WAV, WAVE SFX
|
||||||
// ENDOOM text and palette lumps
|
// ENDOOM text and palette lumps
|
||||||
|
@ -2167,7 +2172,13 @@ int W_VerifyNMUSlumps(const char *filename)
|
||||||
|
|
||||||
{NULL, 0},
|
{NULL, 0},
|
||||||
};
|
};
|
||||||
return W_VerifyFile(filename, NMUSlist, false);
|
|
||||||
|
int status = W_VerifyFile(filename, NMUSlist, false);
|
||||||
|
|
||||||
|
if (status == -1)
|
||||||
|
W_InitFileError(filename, exit_on_error);
|
||||||
|
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \brief Generates a virtual resource used for level data loading.
|
/** \brief Generates a virtual resource used for level data loading.
|
||||||
|
|
|
@ -206,6 +206,6 @@ void W_UnlockCachedPatch(void *patch);
|
||||||
|
|
||||||
void W_VerifyFileMD5(UINT16 wadfilenum, const char *matchmd5);
|
void W_VerifyFileMD5(UINT16 wadfilenum, const char *matchmd5);
|
||||||
|
|
||||||
int W_VerifyNMUSlumps(const char *filename);
|
int W_VerifyNMUSlumps(const char *filename, boolean exit_on_error);
|
||||||
|
|
||||||
#endif // __W_WAD__
|
#endif // __W_WAD__
|
||||||
|
|
Loading…
Reference in New Issue