-1

In my int main() segment of code I declared an identifier (tile). On some lines the identifier thinks it's undeclared, while on other lines it recognizes it's declaration. The initial declaration is outside of all brackets (other than the main). Why is this occurring?

int main( int argc, char* args[] )
{
//Quit flag
bool quit = false;

//The dot
Dot myDot;

//The tiles that will be used
Tile *tiles[ TOTAL_TILES ];

//The frame rate regulator
Timer fps;

//Initialize
if( init() == false )
{
    return 1;
}

//Load the files
if( load_files() == false )
{
    return 1;
}

//Clip the tile sheet
clip_tiles();

//Set the tiles
if( set_tiles( tile ) == false )
{
    return 1;
}

//While the user hasn't quit
while( quit == false )
{
    //Start the frame timer
    fps.start();

    //While there's events to handle
    while( SDL_PollEvent( &event ) )
    {
        //Handle events for the dot
        myDot.handle_input();

        //If the user has Xed out the window
        if( event.type == SDL_QUIT )
        {
            //Quit the program
            quit = true;
        }
    }

    //Move the dot
    myDot.move( tiles );

    //Set the camera
    myDot.set_camera();

    //Show the tiles
    for( int t = 0; t < TOTAL_TILES; t++ )
    {
        tiles[ t ]->show();
    }

    //Show the dot on the screen
    myDot.show();

    //Update the screen
    if( SDL_Flip( screen ) == -1 )
    {
        return 1;
    }

    //Cap the frame rate
    if( fps.get_ticks() < 1000 / FRAMES_PER_SECOND )
    {
        SDL_Delay( ( 1000 / FRAMES_PER_SECOND ) - fps.get_ticks() );
    }
}

//Clean up
clean_up( tile );

return 0;
}

My problem is with clean_up ( tile); and set_up ( tile ); -- or at least that's where my error codes line up.

eebbesen
  • 5,070
  • 8
  • 48
  • 70

1 Answers1

2

tile and tiles are not the same identifier.

Casey
  • 41,449
  • 7
  • 95
  • 125