void CApp::ResetMap(int mapIndex) { // remove all blocks for (auto itr = CBlock::BlockList.begin(); itr != CBlock::BlockList.end(); itr++) { CBlock* pBlock = *itr; if (pBlock) { pBlock->OnMove(-MAP_W, -MAP_H); // this will reset the tile if it was on its home delete pBlock; } } CBlock::BlockList.clear(); CurrentMap = mapIndex; if (CurrentMap > highestLevel) highestLevel = CurrentMap; CMap* pMap = maps[mapIndex]; ActionJackson.SetLoc(pMap->startX, pMap->startY); ActionJackson.map = pMap; ActionJackson.ClearUndoList(); // place all blocks for (int i = 0; i < pMap->startBlocks.size(); i++) { SDL_Point p = pMap->startBlocks[i]; CBlock* pBlock = new CBlock(p.x, p.y, pMap); pBlock->SetSpriteSheet(block); pBlock->OnMove(0, 0); // this will make the tile change to HOMEWITHBLOCK if applicable CBlock::BlockList.push_back(pBlock); } // add some flavor Uint8 redness = 2*(Uint8)CurrentMap; SDL_SetTextureColorMod(Texture, 255, 255 - redness, 255 - redness); }