1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 01:59:43 +01:00

Fix infinite loop pressing left/right in tele menu w/ no teles unlocked

This infinite loop would occur because once you pressed left or right,
the game keeps searching through all the list of teleporters until it
finds one that is unlocked. But if there's none that are unlocked, then
the game goes into an infinite loop, which brings up the Not Responding
dialog on Windows so you can kill it.

Normally, you're not supposed to have no teleporters unlocked while
being able to access a teleporter, but you can achieve this by going to
Class Dismissed from a custom level (while making sure you don't start
in 0,0, because there's a teleporter there that you would unlock).

The solution is to make sure at least one teleporter is unlocked before
doing any searching.
This commit is contained in:
Misa 2020-07-04 18:58:13 -07:00 committed by Ethan Lee
parent aa873ce172
commit 1dfc536b0f

View file

@ -2335,7 +2335,22 @@ void teleporterinput()
game.jumpheld = true;
}
if (game.press_left)
bool any_tele_unlocked = false;
if (game.press_left || game.press_right)
{
for (size_t i = 0; i < map.teleporters.size(); i++)
{
point& tele = map.teleporters[i];
if (map.explored[tele.x + tele.y*20])
{
any_tele_unlocked = true;
break;
}
}
}
if (game.press_left && any_tele_unlocked)
{
do
{
@ -2346,7 +2361,7 @@ void teleporterinput()
}
while (map.explored[tempx + (20 * tempy)] == 0);
}
else if (game.press_right)
else if (game.press_right && any_tele_unlocked)
{
do
{