/** * Returns to the previous screen. * @param action Pointer to an action. */ void NewGameState::btnOkClick(Action *) { GameDifficulty diff = DIFF_BEGINNER; if (_difficulty == _btnBeginner) { diff = DIFF_BEGINNER; } else if (_difficulty == _btnExperienced) { diff = DIFF_EXPERIENCED; } else if (_difficulty == _btnVeteran) { diff = DIFF_VETERAN; } else if (_difficulty == _btnGenius) { diff = DIFF_GENIUS; } else if (_difficulty == _btnSuperhuman) { diff = DIFF_SUPERHUMAN; } SavedGame *save = _game->getMod()->newSave(); save->setDifficulty(diff); save->setIronman(_btnIronman->getPressed()); _game->setSavedGame(save); GeoscapeState *gs = new GeoscapeState; _game->setState(gs); gs->init(); _game->pushState(new BuildNewBaseState(_game->getSavedGame()->getBases()->back(), gs->getGlobe(), true)); }
/** * Sets up a new saved game and jumps to the Geoscape. * @param diff Difficulty for the saved game. */ void NewGameState::newGame(GameDifficulty diff) { _game->setSavedGame(_game->getRuleset()->newSave()); _game->getSavedGame()->setDifficulty(diff); GeoscapeState *gs = new GeoscapeState(_game); _game->setState(gs); gs->init(); _game->pushState(new BuildNewBaseState(_game, _game->getSavedGame()->getBases()->back(), gs->getGlobe(), true)); }