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

Remove map.numteleporters

This removes the separate length-tracking variable map.numteleporters,
in favor of using map.teleporters.size().
This commit is contained in:
Misa 2020-04-14 19:32:30 -07:00 committed by Ethan Lee
parent 5b9c6a9680
commit d63ba761d5
5 changed files with 8 additions and 9 deletions

View file

@ -5593,7 +5593,7 @@ void Game::initteleportermode()
//Set the teleporter variable to the right position!
teleport_to_teleporter = 0;
for (int i = 0; i < map.numteleporters; i++)
for (size_t i = 0; i < map.teleporters.size(); i++)
{
if (roomx == map.teleporters[i].x + 100 && roomy == map.teleporters[i].y + 100)
{

View file

@ -2224,13 +2224,13 @@ void teleporterinput()
if (game.press_left)
{
game.teleport_to_teleporter--;
if (game.teleport_to_teleporter < 0) game.teleport_to_teleporter = map.numteleporters - 1;
if (game.teleport_to_teleporter < 0) game.teleport_to_teleporter = map.teleporters.size() - 1;
tempx = map.teleporters[game.teleport_to_teleporter].x;
tempy = map.teleporters[game.teleport_to_teleporter].y;
while (map.explored[tempx + (20 * tempy)] == 0)
{
game.teleport_to_teleporter--;
if (game.teleport_to_teleporter < 0) game.teleport_to_teleporter = map.numteleporters - 1;
if (game.teleport_to_teleporter < 0) game.teleport_to_teleporter = map.teleporters.size() - 1;
tempx = map.teleporters[game.teleport_to_teleporter].x;
tempy = map.teleporters[game.teleport_to_teleporter].y;
}
@ -2238,13 +2238,13 @@ void teleporterinput()
else if (game.press_right)
{
game.teleport_to_teleporter++;
if (game.teleport_to_teleporter >= map.numteleporters) game.teleport_to_teleporter = 0;
if (game.teleport_to_teleporter >= (int) map.teleporters.size()) game.teleport_to_teleporter = 0;
tempx = map.teleporters[game.teleport_to_teleporter].x;
tempy = map.teleporters[game.teleport_to_teleporter].y;
while (map.explored[tempx + (20 * tempy)] == 0)
{
game.teleport_to_teleporter++;
if (game.teleport_to_teleporter >= map.numteleporters) game.teleport_to_teleporter = 0;
if (game.teleport_to_teleporter >= (int) map.teleporters.size()) game.teleport_to_teleporter = 0;
tempx = map.teleporters[game.teleport_to_teleporter].x;
tempy = map.teleporters[game.teleport_to_teleporter].y;
}

View file

@ -411,7 +411,6 @@ std::string mapclass::getglitchname(int x, int y)
void mapclass::initmapdata()
{
//Set up static map information like teleporters and shiny trinkets.
numteleporters = 17;
setteleporter(0, 0);
setteleporter(0, 16);
setteleporter(2, 4);

View file

@ -154,7 +154,7 @@ public:
std::vector<point> teleporters;
std::vector<point> shinytrinkets;
int numteleporters, numshinytrinkets;
int numshinytrinkets;
bool showteleporters, showtargets, showtrinkets;
//Roomtext

View file

@ -2008,7 +2008,7 @@ void maprender()
}
//draw legend details
for (int i = 0; i < map.numteleporters; i++)
for (size_t i = 0; i < map.teleporters.size(); i++)
{
if (map.showteleporters && map.explored[map.teleporters[i].x + (20 * map.teleporters[i].y)] > 0)
{
@ -2819,7 +2819,7 @@ void teleporterrender()
}
//draw legend details
for (int i = 0; i < map.numteleporters; i++)
for (size_t i = 0; i < map.teleporters.size(); i++)
{
if (map.showteleporters && map.explored[map.teleporters[i].x + (20 * map.teleporters[i].y)] > 0)
{