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

Method updateBaseHighlight

game/ui/base/transferscreen.cpp:142–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140}
141
142void TransferScreen::updateBaseHighlight()
143{
144 if (viewHighlightPrevious != viewHighlight)
145 {
146 int i = 0;
147 for (auto &b : state->player_bases)
148 {
149 auto viewName = format("BUTTON_SECOND_BASE_%d", ++i);
150 auto view = form->findControlTyped<GraphicButton>(viewName);
151 auto viewImage = drawMiniBase(*b.second, viewHighlight, viewFacility);
152 view->setImage(viewImage);
153 view->setDepressedImage(viewImage);
154 }
155 }
156
157 // Update first base
158 TransactionScreen::updateBaseHighlight();
159
160 // Update second base
161 switch (viewHighlight)
162 {
163 case BaseGraphics::FacilityHighlight::Quarters:
164 {
165 auto facilityPic = form->findControlTyped<Graphic>("FACILITY_SECOND_PIC");
166 facilityPic->setVisible(true);
167 facilityPic->setImage(state->facility_types["FACILITYTYPE_LIVING_QUARTERS"]->sprite);
168 form->findControlTyped<Graphic>("FACILITY_SECOND_BAR")->setVisible(true);
169 int usage = second_base->getUsage(*state, FacilityType::Capacity::Quarters, lq2Delta);
170 fillBaseBar(false, usage);
171 auto facilityLabel = form->findControlTyped<Label>("FACILITY_SECOND_TEXT");
172 facilityLabel->setVisible(true);
173 facilityLabel->setText(format("%d%%", usage));
174 break;
175 }
176 case BaseGraphics::FacilityHighlight::Stores:
177 {
178 auto facilityPic = form->findControlTyped<Graphic>("FACILITY_SECOND_PIC");
179 facilityPic->setVisible(true);
180 facilityPic->setImage(state->facility_types["FACILITYTYPE_STORES"]->sprite);
181 form->findControlTyped<Graphic>("FACILITY_SECOND_BAR")->setVisible(true);
182 int usage = second_base->getUsage(*state, FacilityType::Capacity::Stores, cargo2Delta);
183 fillBaseBar(false, usage);
184 auto facilityLabel = form->findControlTyped<Label>("FACILITY_SECOND_TEXT");
185 facilityLabel->setVisible(true);
186 facilityLabel->setText(format("%d%%", usage));
187 break;
188 }
189 case BaseGraphics::FacilityHighlight::Aliens:
190 {
191 auto facilityPic = form->findControlTyped<Graphic>("FACILITY_SECOND_PIC");
192 facilityPic->setVisible(true);
193 facilityPic->setImage(state->facility_types["FACILITYTYPE_ALIEN_CONTAINMENT"]->sprite);
194 form->findControlTyped<Graphic>("FACILITY_SECOND_BAR")->setVisible(true);
195 int usage = second_base->getUsage(*state, FacilityType::Capacity::Aliens, bio2Delta);
196 fillBaseBar(false, usage);
197 auto facilityLabel = form->findControlTyped<Label>("FACILITY_SECOND_TEXT");
198 facilityLabel->setVisible(true);
199 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