mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Move Dehacked table sanity check to deh_tables.c
This commit is contained in:
parent
33e0dd7cba
commit
5e832ece89
5 changed files with 28 additions and 25 deletions
|
|
@ -1072,7 +1072,7 @@ void D_SRB2Main(void)
|
||||||
G_LoadGameSettings();
|
G_LoadGameSettings();
|
||||||
|
|
||||||
// Test Dehacked lists
|
// Test Dehacked lists
|
||||||
DEH_Check();
|
DEH_TableCheck();
|
||||||
|
|
||||||
// Netgame URL special case: change working dir to EXE folder.
|
// Netgame URL special case: change working dir to EXE folder.
|
||||||
ChangeDirForUrlHandler();
|
ChangeDirForUrlHandler();
|
||||||
|
|
|
||||||
|
|
@ -5457,3 +5457,27 @@ struct int_const_s const INT_CONST[] = {
|
||||||
|
|
||||||
{NULL,0}
|
{NULL,0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// For this to work compile-time without being in this file,
|
||||||
|
// this function would need to check sizes at runtime, without sizeof
|
||||||
|
void DEH_TableCheck(void)
|
||||||
|
{
|
||||||
|
#if defined(_DEBUG) || defined(PARANOIA)
|
||||||
|
const size_t dehstates = sizeof(STATE_LIST)/sizeof(const char*);
|
||||||
|
const size_t dehmobjs = sizeof(MOBJTYPE_LIST)/sizeof(const char*);
|
||||||
|
const size_t dehpowers = sizeof(POWERS_LIST)/sizeof(const char*);
|
||||||
|
const size_t dehcolors = sizeof(COLOR_ENUMS)/sizeof(const char*);
|
||||||
|
|
||||||
|
if (dehstates != S_FIRSTFREESLOT)
|
||||||
|
I_Error("You forgot to update the Dehacked states list, you dolt!\n(%d states defined, versus %s in the Dehacked list)\n", S_FIRSTFREESLOT, sizeu1(dehstates));
|
||||||
|
|
||||||
|
if (dehmobjs != MT_FIRSTFREESLOT)
|
||||||
|
I_Error("You forgot to update the Dehacked mobjtype list, you dolt!\n(%d mobj types defined, versus %s in the Dehacked list)\n", MT_FIRSTFREESLOT, sizeu1(dehmobjs));
|
||||||
|
|
||||||
|
if (dehpowers != NUMPOWERS)
|
||||||
|
I_Error("You forgot to update the Dehacked powers list, you dolt!\n(%d powers defined, versus %s in the Dehacked list)\n", NUMPOWERS, sizeu1(dehpowers));
|
||||||
|
|
||||||
|
if (dehcolors != SKINCOLOR_FIRSTFREESLOT)
|
||||||
|
I_Error("You forgot to update the Dehacked colors list, you dolt!\n(%d colors defined, versus %s in the Dehacked list)\n", SKINCOLOR_FIRSTFREESLOT, sizeu1(dehcolors));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -72,4 +72,7 @@ extern const char *const MENUTYPES_LIST[];
|
||||||
|
|
||||||
extern struct int_const_s const INT_CONST[];
|
extern struct int_const_s const INT_CONST[];
|
||||||
|
|
||||||
|
// Moved to this file because it can't work compile-time otherwise
|
||||||
|
void DEH_TableCheck(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -645,25 +645,3 @@ void DEH_LoadDehackedLump(lumpnum_t lumpnum)
|
||||||
{
|
{
|
||||||
DEH_LoadDehackedLumpPwad(WADFILENUM(lumpnum),LUMPNUM(lumpnum), false);
|
DEH_LoadDehackedLumpPwad(WADFILENUM(lumpnum),LUMPNUM(lumpnum), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DEH_Check(void)
|
|
||||||
{
|
|
||||||
#if defined(_DEBUG) || defined(PARANOIA)
|
|
||||||
const size_t dehstates = sizeof(STATE_LIST)/sizeof(const char*);
|
|
||||||
const size_t dehmobjs = sizeof(MOBJTYPE_LIST)/sizeof(const char*);
|
|
||||||
const size_t dehpowers = sizeof(POWERS_LIST)/sizeof(const char*);
|
|
||||||
const size_t dehcolors = sizeof(COLOR_ENUMS)/sizeof(const char*);
|
|
||||||
|
|
||||||
if (dehstates != S_FIRSTFREESLOT)
|
|
||||||
I_Error("You forgot to update the Dehacked states list, you dolt!\n(%d states defined, versus %s in the Dehacked list)\n", S_FIRSTFREESLOT, sizeu1(dehstates));
|
|
||||||
|
|
||||||
if (dehmobjs != MT_FIRSTFREESLOT)
|
|
||||||
I_Error("You forgot to update the Dehacked mobjtype list, you dolt!\n(%d mobj types defined, versus %s in the Dehacked list)\n", MT_FIRSTFREESLOT, sizeu1(dehmobjs));
|
|
||||||
|
|
||||||
if (dehpowers != NUMPOWERS)
|
|
||||||
I_Error("You forgot to update the Dehacked powers list, you dolt!\n(%d powers defined, versus %s in the Dehacked list)\n", NUMPOWERS, sizeu1(dehpowers));
|
|
||||||
|
|
||||||
if (dehcolors != SKINCOLOR_FIRSTFREESLOT)
|
|
||||||
I_Error("You forgot to update the Dehacked colors list, you dolt!\n(%d colors defined, versus %s in the Dehacked list)\n", SKINCOLOR_FIRSTFREESLOT, sizeu1(dehcolors));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,6 @@ typedef enum
|
||||||
void DEH_LoadDehackedLump(lumpnum_t lumpnum);
|
void DEH_LoadDehackedLump(lumpnum_t lumpnum);
|
||||||
void DEH_LoadDehackedLumpPwad(UINT16 wad, UINT16 lump, boolean mainfile);
|
void DEH_LoadDehackedLumpPwad(UINT16 wad, UINT16 lump, boolean mainfile);
|
||||||
|
|
||||||
void DEH_Check(void);
|
|
||||||
|
|
||||||
fixed_t get_number(const char *word);
|
fixed_t get_number(const char *word);
|
||||||
FUNCPRINTF void deh_warning(const char *first, ...);
|
FUNCPRINTF void deh_warning(const char *first, ...);
|
||||||
void deh_strlcpy(char *dst, const char *src, size_t size, const char *warntext);
|
void deh_strlcpy(char *dst, const char *src, size_t size, const char *warntext);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue