It's all one file. Regardless, it's like this.
There are a certain different number of tiles that the map can have. Each tile refers to a specific state that an object has (more than just the class, values are as important as the type, notice the two different PassableTile, which are both the same type, but are different classes). Each tile (starting state) is assigned an integer index. The indicies are then listed in the data section.
Here is the trial implementation as of now.
Code:
void GameMap::readMap(std::istream &input) {
Parse::SimpleParser parser(input);
vector<AbstractTile*> tempTileVec(MAP_MAX_UNIQUE_TILES , NULL);
Util::Matrix<int> tileIndicies(tileMap.numRows(), tileMap.numCols(), -1);
parser.addAction("BombableTile",
new Parse::NaturalVectorParser<AbstractTile, ExplodableTile>(tempTileVec));
parser.addAction("PassableTile",
new Parse::NaturalVectorParser<AbstractTile, PassableTile>(tempTileVec));
parser.addAction("UnbombableTile",
new Parse::NaturalVectorParser<AbstractTile, IndestructibleTile>(tempTileVec));
parser.addAction("MapData", new Parse::StdRead<Util::Matrix<int> >(tileIndicies));
parser.read();
for (int i = 0; i < tileIndicies.numRows() ; i++) {
for (int j = 0; j < tileIndicies.numCols(); j++) {
size_t indexIntoTileVec = (size_t) tileIndicies(i,j);
if (indexIntoTileVec >= MAP_MAX_UNIQUE_TILES) { debugOut << "Error" <<endl; /* ERROR */ }
if (indexIntoTileVec < 0) { debugOut << "Error" <<endl; /* ERROR */ }
if (tempTileVec[indexIntoTileVec] == NULL) { debugOut << "Error" <<endl; /* ERROR */ }
/* only way I figured it possible to copy and allocate new types that were copies of previous types do this
was to make the dynCopy() part of the interface of AbstractTile */
tileMap(i,j) = tempTileVec[indexIntoTileVec]->dynCopy();
}
}
for (vector<AbstractTile*>::iterator iter = tempTileVec.begin(); iter != tempTileVec.end(); iter++) {
delete (*iter);
*iter = NULL;
}
}