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

Method CraftErrorState

src/Geoscape/CraftErrorState.cpp:39–79  ·  view source on GitHub ↗

* Initializes all the elements in a Cannot Rearm window. * @param game Pointer to the core game. * @param state Pointer to the Geoscape state. * @param msg Error message. */

Source from the content-addressed store, hash-verified

37 * @param msg Error message.
38 */
39CraftErrorState::CraftErrorState(Game *game, GeoscapeState *state, const std::wstring &msg) : State(game), _state(state)
40{
41 _screen = false;
42
43 // Create objects
44 _window = new Window(this, 256, 160, 32, 20, POPUP_BOTH);
45 _btnOk = new TextButton(100, 18, 48, 150);
46 _btnOk5Secs = new TextButton(100, 18, 172, 150);
47 _txtMessage = new Text(246, 96, 37, 42);
48
49 // Set palette
50 setPalette("PAL_GEOSCAPE", 4);
51
52 add(_window);
53 add(_btnOk);
54 add(_btnOk5Secs);
55 add(_txtMessage);
56
57 centerAllSurfaces();
58
59 // Set up objects
60 _window->setColor(Palette::blockOffset(15)-1);
61 _window->setBackground(_game->getResourcePack()->getSurface("BACK12.SCR"));
62
63 _btnOk->setColor(Palette::blockOffset(8)+5);
64 _btnOk->setText(tr("STR_OK"));
65 _btnOk->onMouseClick((ActionHandler)&CraftErrorState::btnOkClick);
66 _btnOk->onKeyboardPress((ActionHandler)&CraftErrorState::btnOkClick, Options::keyCancel);
67
68 _btnOk5Secs->setColor(Palette::blockOffset(8)+5);
69 _btnOk5Secs->setText(tr("STR_OK_5_SECONDS"));
70 _btnOk5Secs->onMouseClick((ActionHandler)&CraftErrorState::btnOk5SecsClick);
71 _btnOk5Secs->onKeyboardPress((ActionHandler)&CraftErrorState::btnOk5SecsClick, Options::keyOk);
72
73 _txtMessage->setColor(Palette::blockOffset(15)-1);
74 _txtMessage->setAlign(ALIGN_CENTER);
75 _txtMessage->setVerticalAlign(ALIGN_MIDDLE);
76 _txtMessage->setBig();
77 _txtMessage->setWordWrap(true);
78 _txtMessage->setText(msg);
79}
80
81/**
82 *

Callers

nothing calls this directly

Calls 11

onMouseClickMethod · 0.80
onKeyboardPressMethod · 0.80
setColorMethod · 0.45
setBackgroundMethod · 0.45
getSurfaceMethod · 0.45
getResourcePackMethod · 0.45
setTextMethod · 0.45
setAlignMethod · 0.45
setVerticalAlignMethod · 0.45
setBigMethod · 0.45
setWordWrapMethod · 0.45

Tested by

no test coverage detected