mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-02-04 23:41:07 +00:00
Calculate buffer size manually
(Yes, I checked; this always outputs "3" for its current usage.)
This commit is contained in:
parent
494fa55390
commit
4bd6ae3f04
1 changed files with 11 additions and 2 deletions
13
src/g_game.c
13
src/g_game.c
|
@ -3273,11 +3273,20 @@ INT16 G_RandMap(INT16 tolflags, INT16 pprevmap, boolean ignorebuffer, UINT8 maph
|
||||||
{
|
{
|
||||||
INT32 numokmaps = 0;
|
INT32 numokmaps = 0;
|
||||||
INT16 ix, bufx;
|
INT16 ix, bufx;
|
||||||
|
UINT16 extbufsize = 0;
|
||||||
boolean usehellmaps; // Only consider Hell maps in this pick
|
boolean usehellmaps; // Only consider Hell maps in this pick
|
||||||
|
|
||||||
if (!okmaps)
|
if (!okmaps)
|
||||||
okmaps = Z_Malloc(NUMMAPS * sizeof(INT16), PU_STATIC, NULL);
|
okmaps = Z_Malloc(NUMMAPS * sizeof(INT16), PU_STATIC, NULL);
|
||||||
|
|
||||||
|
if (extbuffer != NULL)
|
||||||
|
{
|
||||||
|
bufx = 0;
|
||||||
|
while (extbuffer[bufx]) {
|
||||||
|
extbufsize++; bufx++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tryagain:
|
tryagain:
|
||||||
|
|
||||||
usehellmaps = (maphell == 0 ? false : (maphell == 2 || M_RandomChance(FRACUNIT/100))); // 1% chance of Hell
|
usehellmaps = (maphell == 0 ? false : (maphell == 2 || M_RandomChance(FRACUNIT/100))); // 1% chance of Hell
|
||||||
|
@ -3298,9 +3307,9 @@ tryagain:
|
||||||
|
|
||||||
if (!ignorebuffer)
|
if (!ignorebuffer)
|
||||||
{
|
{
|
||||||
if (extbuffer != NULL)
|
if (extbufsize > 0)
|
||||||
{
|
{
|
||||||
for (bufx = 0; bufx < (INT16)(sizeof extbuffer); bufx++)
|
for (bufx = 0; bufx < extbufsize; bufx++)
|
||||||
{
|
{
|
||||||
if (extbuffer[bufx] == -1) // Rest of buffer SHOULD be empty
|
if (extbuffer[bufx] == -1) // Rest of buffer SHOULD be empty
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue