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

Method updateFormValues

game/ui/base/transactionscreen.cpp:409–453  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

407}
408
409void TransactionScreen::updateFormValues(bool queueHighlightUpdate)
410{
411 int leftIndex = getLeftIndex();
412 int rightIndex = getRightIndex();
413
414 // Crew
415 lqDelta = 0;
416 lq2Delta = 0;
417
418 // Update storage
419 cargoDelta = 0;
420 cargo2Delta = 0;
421 bioDelta = 0;
422 bio2Delta = 0;
423 moneyDelta = 0;
424
425 for (auto &l : transactionControls)
426 {
427 for (auto &c : l.second)
428 {
429 // if this control is linked to others, only update calculations for one control of the
430 // linked group
431 // if this control is not linked, update calculations
432 if (!c->getLinked() || c->getLinked()->front().lock() == c)
433 {
434 lqDelta += c->getCrewDelta(leftIndex);
435 lq2Delta += c->getCrewDelta(rightIndex);
436 cargoDelta += c->getCargoDelta(leftIndex);
437 bioDelta += c->getBioDelta(leftIndex);
438 cargo2Delta += c->getCargoDelta(rightIndex);
439 bio2Delta += c->getBioDelta(rightIndex);
440 moneyDelta += c->getPriceDelta();
441 }
442 }
443 }
444
445 if (queueHighlightUpdate)
446 {
447 framesUntilHighlightUpdate = HIGHLIGHT_UPDATE_DELAY;
448 }
449 else
450 {
451 updateBaseHighlight();
452 }
453}
454
455void TransactionScreen::updateBaseHighlight()
456{

Callers 1

TransactionScreenMethod · 0.95

Calls 4

getCrewDeltaMethod · 0.80
getCargoDeltaMethod · 0.80
getBioDeltaMethod · 0.80
getPriceDeltaMethod · 0.80

Tested by

no test coverage detected