T
Tom Padilla
I am making a map generator and for some bizarre reason I have a variable
that will not come in scope.
Code snippet:
void placeContinents(int NumberOfContinents)
{
for(int Loop = 0; Loop < NumberOfContinents; Loop++)
{
// Get a random X co-ordinate
int ContinentX = (int)((pRND->NextDouble() * _MapWidth) - 0.5);
int ContinentY; // <---------------- ***** It's this one.**********
for(;
{
// Get a random Y co-ordinate
int CandidateY = (int)(pRND->NextDouble() * (double)_MapHeight -
(double)0.5);
ContinentY = CandidateY;
double RndNum = pRND->NextDouble();
// Find a tile close enough to the equator...
if(equatorDistance(CandidateY) > (double)0.81999999999999998 +
(double)0.17999999999999999 * RndNum)
break;
}
// ...set a continent marker.
mapGrid->SetValue((char)TileType::GRASS_NORMAL, ContinentX, ContinentY);
}
}
The debugger won't see it and their doesn't appear to be any amount of
declaring I can do to make it show up. I've tried declaring it at the top
of the method, in the first for loop, in the second for loop... I've tried
a while loop I've tried a for(; loop...I can't even set breakpoints on it.
When I right click in the IDE and select "Goto Definition" it says it's not
defined, even if I do it to the variable name in the declaration itself!
I cannot, for the life of me get this thing to recognize that variable.
What am I doing wrong?
Thanks,
Tom P.
that will not come in scope.
Code snippet:
void placeContinents(int NumberOfContinents)
{
for(int Loop = 0; Loop < NumberOfContinents; Loop++)
{
// Get a random X co-ordinate
int ContinentX = (int)((pRND->NextDouble() * _MapWidth) - 0.5);
int ContinentY; // <---------------- ***** It's this one.**********
for(;
{
// Get a random Y co-ordinate
int CandidateY = (int)(pRND->NextDouble() * (double)_MapHeight -
(double)0.5);
ContinentY = CandidateY;
double RndNum = pRND->NextDouble();
// Find a tile close enough to the equator...
if(equatorDistance(CandidateY) > (double)0.81999999999999998 +
(double)0.17999999999999999 * RndNum)
break;
}
// ...set a continent marker.
mapGrid->SetValue((char)TileType::GRASS_NORMAL, ContinentX, ContinentY);
}
}
The debugger won't see it and their doesn't appear to be any amount of
declaring I can do to make it show up. I've tried declaring it at the top
of the method, in the first for loop, in the second for loop... I've tried
a while loop I've tried a for(; loop...I can't even set breakpoints on it.
When I right click in the IDE and select "Goto Definition" it says it's not
defined, even if I do it to the variable name in the declaration itself!
I cannot, for the life of me get this thing to recognize that variable.
What am I doing wrong?
Thanks,
Tom P.