mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-09 01:01:07 +00:00
Give a more helpful warning when mods try to play empty sound names.
This commit is contained in:
parent
32e6191f3f
commit
98c6ddd80d
3 changed files with 22 additions and 0 deletions
|
@ -661,6 +661,12 @@ static void PF_sound (void)
|
|||
volume = G_FLOAT(OFS_PARM3) * 255;
|
||||
attenuation = G_FLOAT(OFS_PARM4);
|
||||
|
||||
if (!*sample)
|
||||
{
|
||||
PR_RunWarning("PF_sound: empty string\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Spike -- these checks are redundant
|
||||
if (volume < 0 || volume > 255)
|
||||
Host_Error ("SV_StartSound: volume = %i", volume);
|
||||
|
|
|
@ -258,6 +258,21 @@ void PR_RunError (const char *error, ...)
|
|||
Host_Error("Program error");
|
||||
}
|
||||
|
||||
void PR_RunWarning (const char *error, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
char string[1024];
|
||||
|
||||
va_start (argptr, error);
|
||||
q_vsnprintf (string, sizeof(string), error, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
PR_PrintStatement(qcvm->statements + qcvm->xstatement);
|
||||
PR_StackTrace();
|
||||
|
||||
Con_Warning("%s\n", string);
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
PR_EnterFunction
|
||||
|
|
|
@ -139,6 +139,7 @@ int NUM_FOR_EDICT(edict_t *e);
|
|||
extern int type_size[8];
|
||||
|
||||
FUNC_NORETURN void PR_RunError (const char *error, ...) FUNC_PRINTF(1,2);
|
||||
void PR_RunWarning (const char *error, ...) FUNC_PRINTF(1,2);
|
||||
#ifdef __WATCOMC__
|
||||
#pragma aux PR_RunError aborts;
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue