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

Method BattleDebriefing

game/ui/battle/battledebriefing.cpp:18–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16namespace OpenApoc
17{
18BattleDebriefing::BattleDebriefing(sp<GameState> state)
19 : Stage(), menuform(ui().getForm("battle/debriefing")), state(state)
20{
21 menuform->findControlTyped<GraphicButton>("BUTTON_OK")
22 ->addCallback(FormEventType::ButtonClick, [this](Event *) {
23 Battle::exitBattle(*this->state);
24 fw().stageQueueCommand({StageCmd::Command::REPLACEALL, mksp<CityView>(this->state)});
25 });
26
27 menuform->findControlTyped<Label>("TEXT_SCORE_COMBAT_RATING")
28 ->setText(format("%d", state->current_battle->score.combatRating));
29 menuform->findControlTyped<Label>("TEXT_SCORE_CASUALTY_PENALTY")
30 ->setText(format("%d", state->current_battle->score.casualtyPenalty));
31 menuform->findControlTyped<Label>("TEXT_SCORE_LEADERSHIP_BONUS")
32 ->setText(format("%d", state->current_battle->score.getLeadershipBonus()));
33 menuform->findControlTyped<Label>("TEXT_SCORE_LIVE_ALIENS_CAPTURED")
34 ->setText(format("%d", state->current_battle->score.liveAlienCaptured));
35 menuform->findControlTyped<Label>("TEXT_SCORE_EQUIPMENT_CAPTURED")
36 ->setText(format("%d", state->current_battle->score.equipmentCaptured));
37 menuform->findControlTyped<Label>("TEXT_SCORE_EQUIPMENT_LOST")
38 ->setText(format("%d", state->current_battle->score.equipmentLost));
39 menuform->findControlTyped<Label>("TEXT_SCORE_TOTAL")
40 ->setText(format("%d", state->current_battle->score.getTotal()));
41 menuform->findControlTyped<Label>("TEXT_MISSION_PERFORMANCE")
42 ->setText(format("%s", state->current_battle->score.getText()));
43
44 int idx = 1;
45 for (auto &u : state->current_battle->unitsPromoted)
46 {
47 menuform->findControlTyped<Label>(format("PROMOTION_%d", idx++))
48 ->setText(
49 format("%s %s %s", u->agent->name, tr("promoted to"), u->agent->getRankName()));
50 }
51}
52
53void BattleDebriefing::begin() {}
54

Callers

nothing calls this directly

Calls 10

formatFunction · 0.85
trFunction · 0.85
addCallbackMethod · 0.80
stageQueueCommandMethod · 0.80
getLeadershipBonusMethod · 0.80
getRankNameMethod · 0.80
getFormMethod · 0.45
setTextMethod · 0.45
getTotalMethod · 0.45
getTextMethod · 0.45

Tested by

no test coverage detected