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

Method UfoDetectedState

src/Geoscape/UfoDetectedState.cpp:49–183  ·  view source on GitHub ↗

* Initializes all the elements in the Ufo Detected window. * @param game Pointer to the core game. * @param ufo Pointer to the UFO to get info from. * @param state Pointer to the Geoscape. * @param detected Was the UFO detected? * @param hyperwave Was it a hyperwave radar? */

Source from the content-addressed store, hash-verified

47 * @param hyperwave Was it a hyperwave radar?
48 */
49UfoDetectedState::UfoDetectedState(Game *game, Ufo *ufo, GeoscapeState *state, bool detected, bool hyperwave) : State(game), _ufo(ufo), _state(state), _hyperwave(hyperwave)
50{
51 // Generate UFO ID
52 if (_ufo->getId() == 0)
53 {
54 _ufo->setId(_game->getSavedGame()->getId("STR_UFO"));
55 }
56 if (_ufo->getAltitude() == "STR_GROUND" && _ufo->getLandId() == 0)
57 {
58 _ufo->setLandId(_game->getSavedGame()->getId("STR_LANDING_SITE"));
59 }
60
61 _screen = false;
62
63 // Create objects
64 if (hyperwave)
65 {
66 _window = new Window(this, 224, 180, 16, 10, POPUP_BOTH);
67 }
68 else
69 {
70 _window = new Window(this, 224, 128, 16, 44, POPUP_BOTH);
71 }
72 _btnIntercept = new TextButton(200, 12, 28, 118);
73 _btnCentre = new TextButton(200, 12, 28, 134);
74 _btnCancel = new TextButton(200, 12, 28, 150);
75 _txtUfo = new Text(207, 17, 28, 53);
76 _txtDetected = new Text(100, 9, 28, 69);
77 _txtHyperwave = new Text(214, 17, 21, 44);
78 _lstInfo = new TextList(207, 32, 28, 80);
79 _lstInfo2 = new TextList(207, 32, 28, 96);
80
81 if (hyperwave)
82 {
83 _btnIntercept->setY(136);
84 _btnCentre->setY(152);
85 _btnCancel->setY(168);
86 _txtUfo->setY(20);
87 _txtDetected->setY(36);
88 _lstInfo->setY(60);
89 }
90 else
91 {
92 _txtHyperwave->setVisible(false);
93 _lstInfo2->setVisible(false);
94 }
95
96 // Set palette
97 if (hyperwave)
98 {
99 setPalette("PAL_GEOSCAPE", 2);
100 }
101 else
102 {
103 setPalette("PAL_GEOSCAPE", 7);
104 }
105
106 add(_window);

Callers

nothing calls this directly

Calls 15

getSavedGameMethod · 0.80
getLandIdMethod · 0.80
setLandIdMethod · 0.80
onMouseClickMethod · 0.80
onKeyboardPressMethod · 0.80
getLanguageMethod · 0.80
setColumnsMethod · 0.80
setDotMethod · 0.80
addRowMethod · 0.80
setCellColorMethod · 0.80
getSpeedMethod · 0.80
getMissionTypeMethod · 0.80

Tested by

no test coverage detected