MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / SelectForces

Method SelectForces

game/ui/skirmish/selectforces.cpp:17–253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15{
16
17SelectForces::SelectForces(sp<GameState> state, Skirmish &skirmish,
18 std::map<StateRef<AgentType>, int> *aliens, int *guards, int *civilians)
19 : Stage(), menuform(ui().getForm("selectforces")), skirmish(skirmish), state(*state)
20{
21 menuform->findControlTyped<Label>("TEXT_FUNDS")->setText(state->getPlayerBalance());
22 menuform->findControlTyped<Label>("LOCATION")->setText(skirmish.getLocationText());
23
24 menuform->findControlTyped<ScrollBar>("NUM_BSK_SLIDER")
25 ->addCallback(FormEventType::ScrollBarChange, [this](Event *) {
26 menuform->findControlTyped<Label>("NUM_BSK")->setText(
27 format("%d", menuform->findControlTyped<ScrollBar>("NUM_BSK_SLIDER")->getValue()));
28 });
29 menuform->findControlTyped<ScrollBar>("NUM_CHRYS_SLIDER")
30 ->addCallback(FormEventType::ScrollBarChange, [this](Event *) {
31 menuform->findControlTyped<Label>("NUM_CHRYS")
32 ->setText(format(
33 "%d", menuform->findControlTyped<ScrollBar>("NUM_CHRYS_SLIDER")->getValue()));
34 });
35 menuform->findControlTyped<ScrollBar>("NUM_EGG_SLIDER")
36 ->addCallback(FormEventType::ScrollBarChange, [this](Event *) {
37 menuform->findControlTyped<Label>("NUM_EGG")->setText(
38 format("%d", menuform->findControlTyped<ScrollBar>("NUM_EGG_SLIDER")->getValue()));
39 });
40
41 menuform->findControlTyped<ScrollBar>("NUM_SPITTER_SLIDER")
42 ->addCallback(FormEventType::ScrollBarChange, [this](Event *) {
43 menuform->findControlTyped<Label>("NUM_SPITTER")
44 ->setText(format(
45 "%d", menuform->findControlTyped<ScrollBar>("NUM_SPITTER_SLIDER")->getValue()));
46 });
47 menuform->findControlTyped<ScrollBar>("NUM_ANTHROPOD_SLIDER")
48 ->addCallback(FormEventType::ScrollBarChange, [this](Event *) {
49 menuform->findControlTyped<Label>("NUM_ANTHROPOD")
50 ->setText(format(
51 "%d",
52 menuform->findControlTyped<ScrollBar>("NUM_ANTHROPOD_SLIDER")->getValue()));
53 });
54 menuform->findControlTyped<ScrollBar>("NUM_MULTIWORM_SLIDER")
55 ->addCallback(FormEventType::ScrollBarChange, [this](Event *) {
56 menuform->findControlTyped<Label>("NUM_MULTIWORM")
57 ->setText(format(
58 "%d",
59 menuform->findControlTyped<ScrollBar>("NUM_MULTIWORM_SLIDER")->getValue()));
60 });
61
62 menuform->findControlTyped<ScrollBar>("NUM_POPPER_SLIDER")
63 ->addCallback(FormEventType::ScrollBarChange, [this](Event *) {
64 menuform->findControlTyped<Label>("NUM_POPPER")
65 ->setText(format(
66 "%d", menuform->findControlTyped<ScrollBar>("NUM_POPPER_SLIDER")->getValue()));
67 });
68 menuform->findControlTyped<ScrollBar>("NUM_SKEL_SLIDER")
69 ->addCallback(FormEventType::ScrollBarChange, [this](Event *) {
70 menuform->findControlTyped<Label>("NUM_SKEL")
71 ->setText(format(
72 "%d", menuform->findControlTyped<ScrollBar>("NUM_SKEL_SLIDER")->getValue()));
73 });
74 menuform->findControlTyped<ScrollBar>("NUM_HYPERWORM_SLIDER")

Callers

nothing calls this directly

Calls 15

formatFunction · 0.85
ColourClass · 0.85
getPlayerBalanceMethod · 0.80
getLocationTextMethod · 0.80
addCallbackMethod · 0.80
isCheckedMethod · 0.80
findControlMethod · 0.80
getFormMethod · 0.45
setTextMethod · 0.45
getValueMethod · 0.45
setVisibleMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected