MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / btnYesClick

Method btnYesClick

src/Geoscape/ConfirmLandingState.cpp:129–169  ·  view source on GitHub ↗

* Enters the mission. * @param action Pointer to an action. */

Source from the content-addressed store, hash-verified

127 * @param action Pointer to an action.
128 */
129void 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.

Callers

nothing calls this directly

Calls 15

ExceptionClass · 0.85
getDestinationMethod · 0.80
setBattleGameMethod · 0.80
getSavedGameMethod · 0.80
setWorldTextureMethod · 0.80
setWorldShadeMethod · 0.80
setMissionTypeMethod · 0.80
setUfoMethod · 0.80
setTerrorSiteMethod · 0.80
pushStateMethod · 0.80
popStateMethod · 0.45

Tested by

no test coverage detected