help read map

hey guys, im trying to read from a file into a map then use a for loop to figure out if there is a number 1 in the file and for every number one its supose to put an image one the screen, the code doesnt have any compile errors, but nothing prints to the screen either, help!
the file looks like:

010101010101
010101010101

void gameEvents::gameUpdate()
{
Map map;
if(menu)
{
player = SDL_LoadBMP("Marrow.bmp");
}
SDL_BlitSurface( background, NULL, screen, NULL );
if(newMap)
{
background = SDL_LoadBMP("data/maps/map01.bmp");
item == SDL_LoadBMP("brick.bmp");//layer for background
ifstream ifs ( "data/maps/map01.dat" , ifstream::in );

while (ifs.good())
{

map.level[levelY][levelX] == (char) ifs.get();
levelX += 1;
if(levelX > 20)
{

levelX = 1;
levelY += 1;
}
}
ifs.close();
newMap = false;
}
for (levelY=0;levelY<15;levelY++)
{
for (levelX=0;levelX<20;levelX++)
{
if (map.level[levelY][levelX] == 1)
{
gameDraw(levelX,levelY,2 * 62,2 * 64,playerWidth,playerHeight,item,screen);
}
}
}

SDL_SetColorKey(player,SDL_SRCCOLORKEY,SDL_MapRGB(player->format, 200,0,200));
gameDraw(srcX,srcY,desX,desY,playerWidth,playerHeight,player,screen);
SDL_Flip(screen);
gameRunning = true;
}
Last edited on
Topic archived. No new replies allowed.