mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Error checking for running out of freeslots
This commit is contained in:
parent
b0af04eeeb
commit
e027cc2a06
2 changed files with 22 additions and 4 deletions
|
|
@ -224,7 +224,10 @@ void readfreeslots(MYFILE *f)
|
||||||
// TODO: Out-of-slots warnings/errors.
|
// TODO: Out-of-slots warnings/errors.
|
||||||
// TODO: Name too long (truncated) warnings.
|
// TODO: Name too long (truncated) warnings.
|
||||||
if (fastcmp(type, "SFX"))
|
if (fastcmp(type, "SFX"))
|
||||||
|
{
|
||||||
|
CONS_Printf("Sound sfx_%s allocated.\n",word);
|
||||||
S_AddSoundFx(word, false, 0, false);
|
S_AddSoundFx(word, false, 0, false);
|
||||||
|
}
|
||||||
else if (fastcmp(type, "SPR"))
|
else if (fastcmp(type, "SPR"))
|
||||||
{
|
{
|
||||||
for (i = SPR_FIRSTFREESLOT; i <= SPR_LASTFREESLOT; i++)
|
for (i = SPR_FIRSTFREESLOT; i <= SPR_LASTFREESLOT; i++)
|
||||||
|
|
@ -238,39 +241,54 @@ void readfreeslots(MYFILE *f)
|
||||||
// Found a free slot!
|
// Found a free slot!
|
||||||
strncpy(sprnames[i],word,4);
|
strncpy(sprnames[i],word,4);
|
||||||
//sprnames[i][4] = 0;
|
//sprnames[i][4] = 0;
|
||||||
|
CONS_Printf("Sprite SPR_%s allocated.\n",word);
|
||||||
used_spr[(i-SPR_FIRSTFREESLOT)/8] |= 1<<(i%8); // Okay, this sprite slot has been named now.
|
used_spr[(i-SPR_FIRSTFREESLOT)/8] |= 1<<(i%8); // Okay, this sprite slot has been named now.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (i > SPR_LASTFREESLOT)
|
||||||
|
I_Error("Out of Sprite Freeslots while allocating \"%s\"\nLoad less addons to fix this.", word);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (fastcmp(type, "S"))
|
else if (fastcmp(type, "S"))
|
||||||
{
|
{
|
||||||
for (i = 0; i < NUMSTATEFREESLOTS; i++)
|
for (i = 0; i < NUMSTATEFREESLOTS; i++)
|
||||||
if (!FREE_STATES[i]) {
|
if (!FREE_STATES[i]) {
|
||||||
|
CONS_Printf("State S_%s allocated.\n",word);
|
||||||
FREE_STATES[i] = Z_Malloc(strlen(word)+1, PU_STATIC, NULL);
|
FREE_STATES[i] = Z_Malloc(strlen(word)+1, PU_STATIC, NULL);
|
||||||
strcpy(FREE_STATES[i],word);
|
strcpy(FREE_STATES[i],word);
|
||||||
freeslotusage[0][0]++;
|
freeslotusage[0][0]++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (i == NUMSTATEFREESLOTS)
|
||||||
|
I_Error("Out of State Freeslots while allocating \"%s\"\nLoad less addons to fix this.", word);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (fastcmp(type, "MT"))
|
else if (fastcmp(type, "MT"))
|
||||||
{
|
{
|
||||||
for (i = 0; i < NUMMOBJFREESLOTS; i++)
|
for (i = 0; i < NUMMOBJFREESLOTS; i++)
|
||||||
if (!FREE_MOBJS[i]) {
|
if (!FREE_MOBJS[i]) {
|
||||||
|
CONS_Printf("MobjType MT_%s allocated.\n",word);
|
||||||
FREE_MOBJS[i] = Z_Malloc(strlen(word)+1, PU_STATIC, NULL);
|
FREE_MOBJS[i] = Z_Malloc(strlen(word)+1, PU_STATIC, NULL);
|
||||||
strcpy(FREE_MOBJS[i],word);
|
strcpy(FREE_MOBJS[i],word);
|
||||||
freeslotusage[1][0]++;
|
freeslotusage[1][0]++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (i == NUMMOBJFREESLOTS)
|
||||||
|
I_Error("Out of Mobj Freeslots while allocating \"%s\"\nLoad less addons to fix this.", word);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (fastcmp(type, "SKINCOLOR"))
|
else if (fastcmp(type, "SKINCOLOR"))
|
||||||
{
|
{
|
||||||
for (i = 0; i < NUMCOLORFREESLOTS; i++)
|
for (i = 0; i < NUMCOLORFREESLOTS; i++)
|
||||||
if (!FREE_SKINCOLORS[i]) {
|
if (!FREE_SKINCOLORS[i]) {
|
||||||
|
CONS_Printf("Skincolor SKINCOLOR_%s allocated.\n",word);
|
||||||
FREE_SKINCOLORS[i] = Z_Malloc(strlen(word)+1, PU_STATIC, NULL);
|
FREE_SKINCOLORS[i] = Z_Malloc(strlen(word)+1, PU_STATIC, NULL);
|
||||||
strcpy(FREE_SKINCOLORS[i],word);
|
strcpy(FREE_SKINCOLORS[i],word);
|
||||||
M_AddMenuColor(numskincolors++);
|
M_AddMenuColor(numskincolors++);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (i == NUMCOLORFREESLOTS)
|
||||||
|
I_Error("Out of Skincolor Freeslots while allocating \"%s\"\nLoad less addons to fix this.", word);
|
||||||
}
|
}
|
||||||
else if (fastcmp(type, "SPR2"))
|
else if (fastcmp(type, "SPR2"))
|
||||||
{
|
{
|
||||||
|
|
@ -287,7 +305,7 @@ void readfreeslots(MYFILE *f)
|
||||||
spr2defaults[free_spr2] = 0;
|
spr2defaults[free_spr2] = 0;
|
||||||
spr2names[free_spr2++][4] = 0;
|
spr2names[free_spr2++][4] = 0;
|
||||||
} else
|
} else
|
||||||
deh_warning("Ran out of free SPR2 slots!\n");
|
I_Error("Out of SPR2 Freeslots while allocating \"%s\"\nLoad less addons to fix this.", word);
|
||||||
}
|
}
|
||||||
else if (fastcmp(type, "TOL"))
|
else if (fastcmp(type, "TOL"))
|
||||||
{
|
{
|
||||||
|
|
@ -302,7 +320,7 @@ void readfreeslots(MYFILE *f)
|
||||||
|
|
||||||
// We don't, so freeslot it.
|
// We don't, so freeslot it.
|
||||||
if (lastcustomtol == (UINT32)MAXTOL) // Unless you have way too many, since they're flags.
|
if (lastcustomtol == (UINT32)MAXTOL) // Unless you have way too many, since they're flags.
|
||||||
deh_warning("Ran out of free typeoflevel slots!\n");
|
I_Error("Out of Typeoflevel Freeslots while allocating \"%s\"\nLoad less addons to fix this.", word);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
G_AddTOL(lastcustomtol, word);
|
G_AddTOL(lastcustomtol, word);
|
||||||
|
|
@ -326,7 +344,7 @@ void readfreeslots(MYFILE *f)
|
||||||
precipprops[i].name = Z_StrDup(word);
|
precipprops[i].name = Z_StrDup(word);
|
||||||
precip_freeslot++;
|
precip_freeslot++;
|
||||||
} else
|
} else
|
||||||
deh_warning("Ran out of free PRECIP slots!\n");
|
I_Error("Out of Precipitation Freeslots while allocating \"%s\"\nLoad less addons to fix this.", word);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
deh_warning("Freeslots: unknown enum class '%s' for '%s_%s'", type, type, word);
|
deh_warning("Freeslots: unknown enum class '%s' for '%s_%s'", type, type, word);
|
||||||
|
|
|
||||||
|
|
@ -1353,7 +1353,7 @@ sfxenum_t S_AddSoundFx(const char *name, boolean singular, INT32 flags, boolean
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
CONS_Alert(CONS_WARNING, M_GetText("No more free sound slots\n"));
|
I_Error("Out of Sound Freeslots while allocating \"%s\"\nLoad less addons to fix this.", name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue