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

Method btnOkClick

src/Geoscape/ConfirmDestinationState.cpp:114–141  ·  view source on GitHub ↗

* Confirms the selected target for the craft. * @param action Pointer to an action. */

Source from the content-addressed store, hash-verified

112 * @param action Pointer to an action.
113 */
114void ConfirmDestinationState::btnOkClick(Action *)
115{
116 Waypoint *w = dynamic_cast<Waypoint*>(_target);
117 if (w != 0 && w->getId() == 0)
118 {
119 w->setId(_game->getSavedGame()->getId("STR_WAYPOINT"));
120 _game->getSavedGame()->getWaypoints()->push_back(w);
121 }
122 _craft->setDestination(_target);
123 _craft->setStatus("STR_OUT");
124 if(_craft->getInterceptionOrder() == 0)
125 {
126 int maxInterceptionOrder = 0;
127 for(std::vector<Base*>::iterator baseIt = _game->getSavedGame()->getBases()->begin(); baseIt != _game->getSavedGame()->getBases()->end(); ++baseIt)
128 {
129 for(std::vector<Craft*>::iterator craftIt = (*baseIt)->getCrafts()->begin(); craftIt != (*baseIt)->getCrafts()->end(); ++craftIt)
130 {
131 if((*craftIt)->getInterceptionOrder() > maxInterceptionOrder)
132 {
133 maxInterceptionOrder = (*craftIt)->getInterceptionOrder();
134 }
135 }
136 }
137 _craft->setInterceptionOrder(++maxInterceptionOrder);
138 }
139 _game->popState();
140 _game->popState();
141}
142
143/**
144 * Returns to the previous screen.

Callers

nothing calls this directly

Calls 11

getSavedGameMethod · 0.80
getInterceptionOrderMethod · 0.80
getBasesMethod · 0.80
setInterceptionOrderMethod · 0.80
getIdMethod · 0.45
setIdMethod · 0.45
getWaypointsMethod · 0.45
setDestinationMethod · 0.45
setStatusMethod · 0.45
getCraftsMethod · 0.45
popStateMethod · 0.45

Tested by

no test coverage detected