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

Method SackSoldierState

src/Basescape/SackSoldierState.cpp:43–86  ·  view source on GitHub ↗

* Initializes all the elements in a Sack Soldier window. * @param game Pointer to the core game. * @param base Pointer to the base to get info from. * @param soldierId ID of the soldier to sack. */

Source from the content-addressed store, hash-verified

41 * @param soldierId ID of the soldier to sack.
42 */
43SackSoldierState::SackSoldierState(Game *game, Base *base, size_t soldierId) : State(game), _base(base), _soldierId(soldierId)
44{
45 _screen = false;
46
47 // Create objects
48 _window = new Window(this, 152, 80, 84, 60);
49 _btnOk = new TextButton(44, 16, 100, 115);
50 _btnCancel = new TextButton(44, 16, 176, 115);
51 _txtTitle = new Text(142, 9, 89, 75);
52 _txtSoldier = new Text(142, 9, 89, 85);
53
54 // Set palette
55 setPalette("PAL_BASESCAPE", 6);
56
57 add(_window);
58 add(_btnOk);
59 add(_btnCancel);
60 add(_txtTitle);
61 add(_txtSoldier);
62
63 centerAllSurfaces();
64
65 // Set up objects
66 _window->setColor(Palette::blockOffset(15)+1);
67 _window->setBackground(_game->getResourcePack()->getSurface("BACK13.SCR"));
68
69 _btnOk->setColor(Palette::blockOffset(15)+6);
70 _btnOk->setText(tr("STR_OK"));
71 _btnOk->onMouseClick((ActionHandler)&SackSoldierState::btnOkClick);
72 _btnOk->onKeyboardPress((ActionHandler)&SackSoldierState::btnOkClick, Options::keyOk);
73
74 _btnCancel->setColor(Palette::blockOffset(15)+6);
75 _btnCancel->setText(tr("STR_CANCEL_UC"));
76 _btnCancel->onMouseClick((ActionHandler)&SackSoldierState::btnCancelClick);
77 _btnCancel->onKeyboardPress((ActionHandler)&SackSoldierState::btnCancelClick, Options::keyCancel);
78
79 _txtTitle->setColor(Palette::blockOffset(13)+10);
80 _txtTitle->setAlign(ALIGN_CENTER);
81 _txtTitle->setText(tr("STR_SACK"));
82
83 _txtSoldier->setColor(Palette::blockOffset(13)+10);
84 _txtSoldier->setAlign(ALIGN_CENTER);
85 _txtSoldier->setText(_base->getSoldiers()->at(_soldierId)->getName(true));
86}
87
88/**
89 *

Callers

nothing calls this directly

Calls 10

onMouseClickMethod · 0.80
onKeyboardPressMethod · 0.80
setColorMethod · 0.45
setBackgroundMethod · 0.45
getSurfaceMethod · 0.45
getResourcePackMethod · 0.45
setTextMethod · 0.45
setAlignMethod · 0.45
getNameMethod · 0.45
getSoldiersMethod · 0.45

Tested by

no test coverage detected