I decided not to post the whole back story to this program, but I could use some help with it :P (more for flexibility reasons). So basically I have an tile class with the following variables: x, y, texture, and solid. I have created an array called tile MAP[map_tiles_x][map_tiles_y]. The object of the following snip-it of code is to loop through all of the tiles in the map placing their default values in each. For some reason this code does not work as planned, but in theory shouldn't it? I cannot see why it doesn't work. Thanks in advanced for help :P (BTW I do plan on open sourcing this map editor :D)
// A for loop to go through the tiles one by one
for(int t = 0; t < MaxTiles; t++)
// Make a offset for the tile types
int tiletype = -1;
map >> tiletype;
// If the map fails to get the tile id
// Display this message
std::cout << "Map failed to load.\n";
// Close the map file, then return an error value.
// If the tile type is a valid number, go on to work with them
if((tiletype >= 0 ) && ( tiletype < TILETYPES))
// Add a tile to the vector at the coordinates of x, and y, then with the tiletype
// loaded from the map.
Tiles.push_back(new Tile(x, y, tiletype));
// If it isn't a valid number close the map immediately and return an error
// Add the value of x by 1 tile pixel width each time a tile is loaded
x += TILE_W;
// If the x value passes the level width we set x to 0 and
// make the y value move on tile height down.
if(x > MapW)
x = 0;
y += TILE_H;
It's easily expandable to make it take the "solid" value.