void Map::setup(IGame &game, int cols, int rows, int width, int height) { this->c=cols; this->r=rows; this->w=width; this->h=height; m.clear(); m.resize(cols,vector<int>(rows,0)); // Changed for use a same seed //srand(time(NULL)); mapgen(); game.getPacman()->X((cols/2+0.5)*width); game.getPacman()->Y(1.5*height); game.getPacman()->speed(width*3.0); unsigned int c=0; for(int j=-2;j<=0;j++) for(int i=-2;i<=2;i++) if(c<game.getGhosts().size()) { IGhost *g=game.getGhosts().at(c); // ghost's speed is dynamic //g->speed(game.getPacman()->speed()*1.5); g->X((cols/2+i+0.5)*width); g->Y((rows/2+j+0.5)*height); c++; } game.reshape(0,0); }