int loop = 0;for (int x = 0; x < 19; x++ ){ for (int y = 0; y < 19; y++ ) { loop++; }}
And why MapArray[20][20] this? it is a 21x21 array with 0 counted :p.
int loop = 0;for (int x = 0; x < 19; x++ ){ for (int y = 0; y < 19; y++ ) { loop++; }}
Quote:And why MapArray[20][20] this? it is a 21x21 array with 0 counted :p.
// define a constant like this elsewhere so it is easy to change (or replace with a command line parameter)const char *dataFile = "C:\\Documents and Settings\\Sean P Jones\\My Documents\\1Work\\Year2\\2301-GamesDev1\\MapReading\\Media\\map1.txt";GameSetup(){// ...// dont use a global if you don't have to// make this localstd::ifstream InFile(dataFile); for(int x = 0 ; x < 20 ; x++){ for(int y = 0 ; y < 20 ; y++) { char c; InFile >> c; MapArray[x][y] = c - '0'; }}// std::fstreams close themselves// InFile.close();// ...}