Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Breakpoint 1, SimGrid::put (this=0x7fffffffe170, agent=0x7b7cd0, cell=0x7fffe928b390) at core/simgrid.cpp:20
- 20 assert(cell != NULL && agent != NULL && cell->sim() == this && cell->agent() == NULL);
- (gdb) p *cell
- Cannot access memory at address 0x7fffe928b390
- Billes sim;
- sim.add(50000);
- void Billes::add(unsigned int n){
- for(unsigned int i = 0 ; i < n ; i++)
- put(new Bille(), emptyCell());
- }
- SimGrid::SimGrid(unsigned int xlen, unsigned int ylen){
- m_xlen = xlen;
- m_ylen = ylen;
- for(unsigned int x = 0 ; x < m_xlen ; x++){
- for(unsigned y = 0 ; y < m_ylen ; y++){
- m_cells.push_back(Cell(this, x, y));
- m_emptyCells.push_back(cell(x, y));
- }
- }
- }
- void SimGrid::put(GridAgent *agent, Cell *cell){
- assert(cell != NULL && agent != NULL && cell->sim() == this && cell->agent() == NULL);
- cell->agent(agent);
- agent->cell(cell);
- for(unsigned int i = 0 ; i < m_emptyCells.size() ; i++){
- if(m_emptyCells[i] == cell){
- m_emptyCells.erase(m_emptyCells.begin() + i);
- break;
- }
- }
- addAgent(agent);
- }
- Cell *SimGrid::emptyCell(){ return m_emptyCells.at(lrand48() % m_emptyCells.size()); }
Add Comment
Please, Sign In to add comment