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

Method closeScreen

game/ui/base/transferscreen.cpp:239–472  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

237}
238
239void TransferScreen::closeScreen()
240{
241 auto player = state->getPlayer();
242
243 // Step 01: Check accommodation of different sorts
244 {
245 std::array<int, MAX_BASES> vecCrewDelta;
246 std::array<int, MAX_BASES> vecCargoDelta;
247 std::array<int, MAX_BASES> vecBioDelta;
248 std::array<bool, MAX_BASES> vecChanged;
249 vecCrewDelta.fill(0);
250 vecCargoDelta.fill(0);
251 vecBioDelta.fill(0);
252 vecChanged.fill(false);
253
254 // Find all delta and mark all that have any changes
255 std::set<sp<TransactionControl>> linkedControls;
256 for (auto &l : transactionControls)
257 {
258 for (auto &c : l.second)
259 {
260 if (linkedControls.find(c) != linkedControls.end())
261 {
262 continue;
263 }
264 int i = 0;
265 for ([[maybe_unused]] auto &b : state->player_bases)
266 {
267 int crewDelta = c->getCrewDelta(i);
268 int cargoDelta = c->getCargoDelta(i);
269 int bioDelta = c->getBioDelta(i);
270 if (cargoDelta || bioDelta || crewDelta)
271 {
272 vecCrewDelta[i] += crewDelta;
273 vecCargoDelta[i] += cargoDelta;
274 vecBioDelta[i] += bioDelta;
275 vecChanged[i] = true;
276 }
277 i++;
278 }
279 if (c->getLinked())
280 {
281 for (auto &l : *c->getLinked())
282 {
283 linkedControls.insert(l.lock());
284 }
285 }
286 }
287 }
288
289 // Check every base, find first bad one
290 int i = 0;
291 StateRef<Base> bad_base;
292 bool cargoOverLimit = false;
293 bool alienOverLimit = false;
294 bool crewOverLimit = false;
295 for (auto &b : state->player_bases)
296 {

Callers

nothing calls this directly

Calls 15

trFunction · 0.85
formatFunction · 0.85
getPlayerMethod · 0.80
endMethod · 0.80
getCrewDeltaMethod · 0.80
getCargoDeltaMethod · 0.80
getBioDeltaMethod · 0.80
insertMethod · 0.80
getUsageMethod · 0.80
stageQueueCommandMethod · 0.80
isRelatedToMethod · 0.80
emptyMethod · 0.80

Tested by

no test coverage detected