1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| NuMap::NuMap(const std::string &fileName) : _fileName(fileName)
,_map(15, std::vector< std::vector<int> >(11, std::vector<int>(10, 10)))
// _map est bien initialisé
,name("New map")
,version("1")
,author("Unknown")
,tileset("common")
,_rootHandle(0)
,_headHandle(0)
,_casesHandle(0) {
}
void NuMap::setCase(const int idCase, const int z, const int value) {
const int y = std::ceil((float)idCase / 15.f);
const int x = idCase - ((y-1) * 15);
std::cout << "id" << idCase << "_" << "x" << x << "y" << y << std::endl; // tout est en ordre, le problème ne vient pas d'ici
std::cout << "size" << _map.size() << std::endl << std::endl; // ici ça marche... Avec des valeurs irréelles !
if(_map[x-1][y-1].size() < z) { // le plantage s'effectue ici. Pas dans la condition, mais bien lors de l'utilisation de la méthode size().
//_map[x][y].resize(1);
throw std::string("comment est-ce possible ?");
}
//_map[x][y].push_back(value);
} |
Partager