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

Method updateBaseHighlight

game/ui/base/transactionscreen.cpp:455–524  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

453}
454
455void TransactionScreen::updateBaseHighlight()
456{
457 if (viewHighlightPrevious != viewHighlight)
458 {
459 int i = 0;
460 for (auto &b : state->player_bases)
461 {
462 auto viewName = format("BUTTON_BASE_%d", ++i);
463 auto view = form->findControlTyped<GraphicButton>(viewName);
464 auto viewImage = drawMiniBase(*b.second, viewHighlight, viewFacility);
465 view->setImage(viewImage);
466 view->setDepressedImage(viewImage);
467 }
468 viewHighlightPrevious = viewHighlight;
469 }
470
471 switch (viewHighlight)
472 {
473 case BaseGraphics::FacilityHighlight::Quarters:
474 {
475 auto facilityPic = form->findControlTyped<Graphic>("FACILITY_FIRST_PIC");
476 facilityPic->setVisible(true);
477 facilityPic->setImage(state->facility_types["FACILITYTYPE_LIVING_QUARTERS"]->sprite);
478 form->findControlTyped<Graphic>("FACILITY_FIRST_BAR")->setVisible(true);
479 int usage =
480 state->current_base->getUsage(*state, FacilityType::Capacity::Quarters, lqDelta);
481 fillBaseBar(true, usage);
482 auto facilityLabel = form->findControlTyped<Label>("FACILITY_FIRST_TEXT");
483 facilityLabel->setVisible(true);
484 facilityLabel->setText(format("%d%%", usage));
485 break;
486 }
487 case BaseGraphics::FacilityHighlight::Stores:
488 {
489 auto facilityPic = form->findControlTyped<Graphic>("FACILITY_FIRST_PIC");
490 facilityPic->setVisible(true);
491 facilityPic->setImage(state->facility_types["FACILITYTYPE_STORES"]->sprite);
492 form->findControlTyped<Graphic>("FACILITY_FIRST_BAR")->setVisible(true);
493 int usage =
494 state->current_base->getUsage(*state, FacilityType::Capacity::Stores, cargoDelta);
495 fillBaseBar(true, usage);
496 auto facilityLabel = form->findControlTyped<Label>("FACILITY_FIRST_TEXT");
497 facilityLabel->setVisible(true);
498 facilityLabel->setText(format("%d%%", usage));
499 break;
500 }
501 case BaseGraphics::FacilityHighlight::Aliens:
502 {
503 auto facilityPic = form->findControlTyped<Graphic>("FACILITY_FIRST_PIC");
504 facilityPic->setVisible(true);
505 facilityPic->setImage(state->facility_types["FACILITYTYPE_ALIEN_CONTAINMENT"]->sprite);
506 form->findControlTyped<Graphic>("FACILITY_FIRST_BAR")->setVisible(true);
507 int usage =
508 state->current_base->getUsage(*state, FacilityType::Capacity::Aliens, bioDelta);
509 fillBaseBar(true, usage);
510 auto facilityLabel = form->findControlTyped<Label>("FACILITY_FIRST_TEXT");
511 facilityLabel->setVisible(true);
512 facilityLabel->setText(format("%d%%", usage));

Callers

nothing calls this directly

Calls 6

formatFunction · 0.85
setDepressedImageMethod · 0.80
getUsageMethod · 0.80
setImageMethod · 0.45
setVisibleMethod · 0.45
setTextMethod · 0.45

Tested by

no test coverage detected