* Enters the mission. * @param action Pointer to an action. */
| 127 | * @param action Pointer to an action. |
| 128 | */ |
| 129 | void ConfirmLandingState::btnYesClick(Action *) |
| 130 | { |
| 131 | _game->popState(); |
| 132 | Ufo* u = dynamic_cast<Ufo*>(_craft->getDestination()); |
| 133 | TerrorSite* t = dynamic_cast<TerrorSite*>(_craft->getDestination()); |
| 134 | AlienBase* b = dynamic_cast<AlienBase*>(_craft->getDestination()); |
| 135 | |
| 136 | SavedBattleGame *bgame = new SavedBattleGame(); |
| 137 | _game->getSavedGame()->setBattleGame(bgame); |
| 138 | BattlescapeGenerator bgen = BattlescapeGenerator(_game); |
| 139 | bgen.setWorldTexture(_texture); |
| 140 | bgen.setWorldShade(_shade); |
| 141 | bgen.setCraft(_craft); |
| 142 | if (u != 0) |
| 143 | { |
| 144 | if(u->getStatus() == Ufo::CRASHED) |
| 145 | bgame->setMissionType("STR_UFO_CRASH_RECOVERY"); |
| 146 | else |
| 147 | bgame->setMissionType("STR_UFO_GROUND_ASSAULT"); |
| 148 | bgen.setUfo(u); |
| 149 | bgen.setAlienRace(u->getAlienRace()); |
| 150 | } |
| 151 | else if (t != 0) |
| 152 | { |
| 153 | bgame->setMissionType("STR_TERROR_MISSION"); |
| 154 | bgen.setTerrorSite(t); |
| 155 | bgen.setAlienRace(t->getAlienRace()); |
| 156 | } |
| 157 | else if (b != 0) |
| 158 | { |
| 159 | bgame->setMissionType("STR_ALIEN_BASE_ASSAULT"); |
| 160 | bgen.setAlienBase(b); |
| 161 | bgen.setAlienRace(b->getAlienRace()); |
| 162 | } |
| 163 | else |
| 164 | { |
| 165 | throw Exception("No mission available!"); |
| 166 | } |
| 167 | bgen.run(); |
| 168 | _game->pushState(new BriefingState(_game, _craft)); |
| 169 | } |
| 170 | |
| 171 | /** |
| 172 | * Returns the craft to base and closes the window. |
nothing calls this directly
no test coverage detected