mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-06 19:01:06 +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 i = 0;
|
||||
do
|
||||
int i;
|
||||
for (i = 0; i < NUM_PICKUPS; ++i)
|
||||
{
|
||||
if (Pickups[pickupIndex].life > 0)
|
||||
break;
|
||||
pickupIndex = (pickupIndex + 1) & 7;
|
||||
i++;
|
||||
} while (i < 8);
|
||||
pickupIndex = pickupIndex + 1 & NUM_PICKUPS - 1;
|
||||
}
|
||||
|
||||
CurrentPickup = pickupIndex;
|
||||
if (i != 8)
|
||||
if (i != NUM_PICKUPS)
|
||||
return g_Renderer->DrawPickup(Pickups[CurrentPickup].objectNumber);
|
||||
|
||||
CurrentPickup = 0;
|
||||
|
@ -223,7 +222,7 @@ void AddDisplayPickup(short objectNumber)
|
|||
|
||||
void InitialisePickupDisplay()
|
||||
{
|
||||
for (int i = 0; i < 8; i++)
|
||||
for (int i = 0; i < NUM_PICKUPS; i++)
|
||||
{
|
||||
DISPLAY_PICKUP* pickup = &Pickups[i];
|
||||
pickup->life = -1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue