1)I know that the best replacement for dynamic arrays is a vector array.
I declare the array like this:
] vector<unsigned int> Map(width * height)width : we divide screen width with tile width
height: we divide screen height with tile height
Thats correct? is there anything bad in my code?
2)
Here's my map file!!:
25 20 00000000000000000000000 00000000000000000000000 00000000000000000000000 00000000000000000000000 00000000000000000000000 00000000000000000000000 00000000000000000000000 00000000000000000000000 00000000000000000000000 00000000000000000000000 00000000000000000000000 00000001111110000000000 00000000000000000000000 00000000000000000000000 00000000000000000000000 00000000000000000000000 00000000000000000000000 00000000000000000000000 00000000000000000000000 00000000000000000000000 00000000000000000000000 00000000000000000000000 00000000000000000000000 11111111111111111111111
And here's how i load the map file into the vector :
bool LoadMap(string File,vector<int>& MAP)
{
std::ifstream map( File.c_str() );
if(map==NULL)return false;//damn !
int x=0,y=0;//array dimensions
MAP.clear();
map>>x>>y;//get array dimensions from file!
vector< int > temp(x * y);//create a temp vector array!
for( int i = 0; i < x*y; i++ )//add the values!
{
char character;
map >> character;
int num = character-'0';
temp[i]=num;
}
//assign temp to MAP!
MAP = temp;
//clear temp !
temp.clear();
//close the file!
map.close();
return true;//all fine?
}
Im doing it right?
3)Here's my tile class!(and where i really need your help!!)
class Tile
{
public:
Tile();
Render(int tile_id);//ie : TILE_WALL = 1 , TILE_EMPTY =0..
bool Blocked;
}cTile;
Question 1: Using the linear vector array , how can i render the tiles on the screen?Thats all , i hope i can get some replies!!!
Thanks!












