mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 17:49:43 +01:00
Fix memory leak from warping moving platforms
It turns out that when the game warps moving platforms, it won't remove the block from the position before they warped. Eventually, these blocks will pile up and will never be removed, causing a memory leak.
This commit is contained in:
parent
79a54f23e6
commit
7f0db19abd
1 changed files with 8 additions and 0 deletions
|
@ -1045,10 +1045,12 @@ void gamelogic()
|
|||
//ascii snakes
|
||||
if (obj.entities[i].xp <= -80)
|
||||
{
|
||||
if (obj.entities[i].isplatform) obj.removeblockat(obj.entities[i].xp, obj.entities[i].yp);
|
||||
obj.entities[i].xp += 400;
|
||||
}
|
||||
else if (obj.entities[i].xp > 320)
|
||||
{
|
||||
if (obj.entities[i].isplatform) obj.removeblockat(obj.entities[i].xp, obj.entities[i].yp);
|
||||
obj.entities[i].xp -= 400;
|
||||
}
|
||||
}
|
||||
|
@ -1056,10 +1058,12 @@ void gamelogic()
|
|||
{
|
||||
if (obj.entities[i].xp <= -10)
|
||||
{
|
||||
if (obj.entities[i].isplatform) obj.removeblockat(obj.entities[i].xp, obj.entities[i].yp);
|
||||
obj.entities[i].xp += 320;
|
||||
}
|
||||
else if (obj.entities[i].xp > 310)
|
||||
{
|
||||
if (obj.entities[i].isplatform) obj.removeblockat(obj.entities[i].xp, obj.entities[i].yp);
|
||||
obj.entities[i].xp -= 320;
|
||||
}
|
||||
}
|
||||
|
@ -1074,10 +1078,12 @@ void gamelogic()
|
|||
if(obj.entities[i].type<50){ //Don't warp warp lines
|
||||
if (obj.entities[i].yp <= -12)
|
||||
{
|
||||
if (obj.entities[i].isplatform) obj.removeblockat(obj.entities[i].xp, obj.entities[i].yp);
|
||||
obj.entities[i].yp += 232;
|
||||
}
|
||||
else if (obj.entities[i].yp > 226)
|
||||
{
|
||||
if (obj.entities[i].isplatform) obj.removeblockat(obj.entities[i].xp, obj.entities[i].yp);
|
||||
obj.entities[i].yp -= 232;
|
||||
}
|
||||
}
|
||||
|
@ -1094,10 +1100,12 @@ void gamelogic()
|
|||
{
|
||||
if (obj.entities[i].xp <= -30)
|
||||
{
|
||||
if (obj.entities[i].isplatform) obj.removeblockat(obj.entities[i].xp, obj.entities[i].yp);
|
||||
obj.entities[i].xp += 350;
|
||||
}
|
||||
else if (obj.entities[i].xp > 320)
|
||||
{
|
||||
if (obj.entities[i].isplatform) obj.removeblockat(obj.entities[i].xp, obj.entities[i].yp);
|
||||
obj.entities[i].xp -= 350;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue