okay I am making a very nice tile engine using a class for the map and a structure for each tile and NPC. It will have lighting effect, 3 layers, weather, etc. But anyways, I'm having problems with my code.

I use fstream to load in the map files, and it loads everything in okay except the tiles. Well, actually the tiles DO load correctly, but if I try to read the tile's value from another function it always thinks it's 0. But if I call it from within the function I load with, it gets the right value. Here is the source that loads the maps, my map class, and the function I am using to fetch the value of the tiles.

Code:
#define MTX 60
#define MTY 45    // Max Deminsions
#define ML 3

...

typedef class map
{
 private:
 BITMAP *MapDrawBuffer;
 tile tiles[MTX][MTY][ML];
 int width, height;
 int camerax, cameray;
 char *MapFileName;
 char MapName[256];
 bool ExcludeSecondLayer;
 public:
 void LoadMap(char *file);
 int GetTileType(int positX, int positY, int positL);
};
Code:
   int LoadPositionX = 0;
   int LoadPositionY = 0;
   
   for (int i=0; i <= height; i++)
   {
    for (int j=0; j <= width; j++)
    {
     MapFile >> buffer;
     clear(screen);
     tiles[LoadPositionX][LoadPositionY][0].type = atoi(buffer);
     textprintf(screen,font,0,0,makecol(255,255,255),"%i",tiles[LoadPositionX][LoadPositionY][0].type);
     LoadPositionX++;
    }
    
    LoadPositionX = 0;
    LoadPositionY++;
   }
Code:
int map::GetTileType(int positX, int positY, int positL)
{
 return tiles[positX][positY][positL].type;
}
Code:
 map CurrentMap;
 CurrentMap.LoadMap("test.tmf");
 clear(screen);
 textprintf(screen,font,5,5,makecol(255,255,255),"%i",CurrentMap.GetTileType(4,3,0));
 readkey();
Sorry if that didn't copy over right. But what is strange is, if you look at the function that loads the map, it has a textprintf, which is Allegro's text function for graphics mode writing, and it displays the tile's type value. And it works perfectly inside the function that loads the map. But when I try to use GetTileType to do it, it ALWAYS gives me 0 no matter what.