mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-26 20:31:30 +00:00
Merge branch 'freeslot-errors' into 'master'
Error checking for running out of freeslots See merge request KartKrew/Kart-Public!267
This commit is contained in:
commit
8cd205cd28
2 changed files with 20 additions and 8 deletions
|
@ -591,7 +591,6 @@ void DEH_UpdateMaxFreeslots(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Figure out how to do undolines for this....
|
// TODO: Figure out how to do undolines for this....
|
||||||
// TODO: Warnings for running out of freeslots
|
|
||||||
static void readfreeslots(MYFILE *f)
|
static void readfreeslots(MYFILE *f)
|
||||||
{
|
{
|
||||||
char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL);
|
char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL);
|
||||||
|
@ -625,10 +624,12 @@ static void readfreeslots(MYFILE *f)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// TODO: Check for existing freeslot mobjs/states/etc. and make errors.
|
// TODO: Check for existing freeslot mobjs/states/etc. and make 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++)
|
||||||
|
@ -642,29 +643,40 @@ static 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
|
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);
|
||||||
|
@ -9245,7 +9257,7 @@ static inline int lib_freeslot(lua_State *L)
|
||||||
lua_pushinteger(L, sfx);
|
lua_pushinteger(L, sfx);
|
||||||
r++;
|
r++;
|
||||||
} else
|
} else
|
||||||
return r;
|
I_Error("Out of Sfx Freeslots while allocating \"%s\"\nLoad less addons to fix this.", word); //Should never get here since S_AddSoundFx was changed to throw I_Error when it can't allocate
|
||||||
}
|
}
|
||||||
else if (fastcmp(type, "SPR"))
|
else if (fastcmp(type, "SPR"))
|
||||||
{
|
{
|
||||||
|
@ -9272,7 +9284,7 @@ static inline int lib_freeslot(lua_State *L)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (j > SPR_LASTFREESLOT)
|
if (j > SPR_LASTFREESLOT)
|
||||||
return r;
|
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"))
|
||||||
{
|
{
|
||||||
|
@ -9288,7 +9300,7 @@ static inline int lib_freeslot(lua_State *L)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (i == NUMSTATEFREESLOTS)
|
if (i == NUMSTATEFREESLOTS)
|
||||||
return r;
|
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"))
|
||||||
{
|
{
|
||||||
|
@ -9304,7 +9316,7 @@ static inline int lib_freeslot(lua_State *L)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (i == NUMMOBJFREESLOTS)
|
if (i == NUMMOBJFREESLOTS)
|
||||||
return r;
|
I_Error("Out of Mobj Freeslots while allocating \"%s\"\nLoad less addons to fix this.", word);
|
||||||
}
|
}
|
||||||
Z_Free(s);
|
Z_Free(s);
|
||||||
lua_remove(L, 1);
|
lua_remove(L, 1);
|
||||||
|
|
|
@ -1034,7 +1034,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…
Reference in a new issue