mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-07 11:13:53 +03:00
Fix buffer overflow
This commit is contained in:
parent
29ec96ec39
commit
1cb86192bb
1 changed files with 6 additions and 7 deletions
|
@ -184,17 +184,16 @@ int DrawAllPickups()
|
||||||
}
|
}
|
||||||
|
|
||||||
int pickupIndex = CurrentPickup;
|
int pickupIndex = CurrentPickup;
|
||||||
int i = 0;
|
int i;
|
||||||
do
|
for (i = 0; i < NUM_PICKUPS; ++i)
|
||||||
{
|
{
|
||||||
if (Pickups[pickupIndex].life > 0)
|
if (Pickups[pickupIndex].life > 0)
|
||||||
break;
|
break;
|
||||||
pickupIndex = (pickupIndex + 1) & 7;
|
pickupIndex = pickupIndex + 1 & NUM_PICKUPS - 1;
|
||||||
i++;
|
}
|
||||||
} while (i < 8);
|
|
||||||
|
|
||||||
CurrentPickup = pickupIndex;
|
CurrentPickup = pickupIndex;
|
||||||
if (i != 8)
|
if (i != NUM_PICKUPS)
|
||||||
return g_Renderer->DrawPickup(Pickups[CurrentPickup].objectNumber);
|
return g_Renderer->DrawPickup(Pickups[CurrentPickup].objectNumber);
|
||||||
|
|
||||||
CurrentPickup = 0;
|
CurrentPickup = 0;
|
||||||
|
@ -223,7 +222,7 @@ void AddDisplayPickup(short objectNumber)
|
||||||
|
|
||||||
void InitialisePickupDisplay()
|
void InitialisePickupDisplay()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 8; i++)
|
for (int i = 0; i < NUM_PICKUPS; i++)
|
||||||
{
|
{
|
||||||
DISPLAY_PICKUP* pickup = &Pickups[i];
|
DISPLAY_PICKUP* pickup = &Pickups[i];
|
||||||
pickup->life = -1;
|
pickup->life = -1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue