* Returns to the previous screen. * @param action Pointer to an action. */
| 131 | * @param action Pointer to an action. |
| 132 | */ |
| 133 | void NewGameState::btnOkClick(Action *) |
| 134 | { |
| 135 | GameDifficulty diff; |
| 136 | if (_difficulty == _btnBeginner) |
| 137 | { |
| 138 | diff = DIFF_BEGINNER; |
| 139 | } |
| 140 | else if (_difficulty == _btnExperienced) |
| 141 | { |
| 142 | diff = DIFF_EXPERIENCED; |
| 143 | } |
| 144 | else if (_difficulty == _btnVeteran) |
| 145 | { |
| 146 | diff = DIFF_VETERAN; |
| 147 | } |
| 148 | else if (_difficulty == _btnGenius) |
| 149 | { |
| 150 | diff = DIFF_GENIUS; |
| 151 | } |
| 152 | else if (_difficulty == _btnSuperhuman) |
| 153 | { |
| 154 | diff = DIFF_SUPERHUMAN; |
| 155 | } |
| 156 | SavedGame *save = _game->getRuleset()->newSave(); |
| 157 | save->setDifficulty(diff); |
| 158 | save->setIronman(_btnIronman->getPressed()); |
| 159 | _game->setSavedGame(save); |
| 160 | |
| 161 | GeoscapeState *gs = new GeoscapeState(_game); |
| 162 | _game->setState(gs); |
| 163 | gs->init(); |
| 164 | _game->pushState(new BuildNewBaseState(_game, _game->getSavedGame()->getBases()->back(), gs->getGlobe(), true)); |
| 165 | } |
| 166 | |
| 167 | /** |
| 168 | * Returns to the previous screen. |
no test coverage detected