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

Method begin

game/ui/general/aequipscreen.cpp:131–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129AEquipScreen::~AEquipScreen() = default;
130
131void AEquipScreen::begin()
132{
133 if (state->current_battle)
134 {
135 formMain->findControlTyped<Graphic>("DOLLAR")->setVisible(false);
136 }
137 else
138 {
139 formMain->findControlTyped<Graphic>("DOLLAR")->setVisible(true);
140 formMain->findControlTyped<Label>("TEXT_FUNDS")->setText(state->getPlayerBalance());
141 }
142
143 auto owner = state->getPlayer();
144 if (state->current_battle)
145 {
146 owner = state->current_battle->currentPlayer;
147 }
148
149 if (firstAgent)
150 {
151 selectAgent(firstAgent);
152 }
153 else
154 {
155 for (auto &agent : state->agents)
156 {
157 if (!checkAgent(agent.second, owner))
158 {
159 continue;
160 }
161 if (agent.second->unit && !agent.second->unit->isConscious())
162 {
163 continue;
164 }
165 selectAgent(agent.second);
166 break;
167 }
168 }
169
170 auto mode = getMode();
171 if (mode == Mode::Enemy)
172 {
173 formMain->findControlTyped<Label>("EQUIP_AGENT")->setText(tr("MIND PROBE"));
174 }
175 else
176 {
177 formMain->findControlTyped<Label>("EQUIP_AGENT")->setText(tr("EQUIP AGENT"));
178 }
179
180 formMain->findControlTyped<RadioButton>("BUTTON_SHOW_WEAPONS")->setChecked(true);
181
182 updateAgents();
183}
184
185void AEquipScreen::pause() {}
186

Callers 7

selectAgentMethod · 0.45
tryPlaceItemMethod · 0.45
closeScreenMethod · 0.45
updateAgentControlMethod · 0.45

Calls 7

trFunction · 0.85
getPlayerBalanceMethod · 0.80
getPlayerMethod · 0.80
isConsciousMethod · 0.80
setVisibleMethod · 0.45
setTextMethod · 0.45
setCheckedMethod · 0.45

Tested by

no test coverage detected