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

Method displayWeapon

game/ui/general/vehiclesheet.cpp:166–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164}
165
166void VehicleSheet::displayWeapon(sp<VEquipment> item, sp<VEquipmentType> type)
167{
168 form->findControlTyped<Label>("LABEL_2_L")->setText(tr("Damage"));
169 form->findControlTyped<Label>("LABEL_2_R")->setText(format("%d", type->damage));
170 form->findControlTyped<Label>("LABEL_3_L")->setText(tr("Range"));
171 form->findControlTyped<Label>("LABEL_3_R")->setText(format("%d", type->getRangeInTiles()));
172 form->findControlTyped<Label>("LABEL_4_L")->setText(tr("Accuracy"));
173 form->findControlTyped<Label>("LABEL_4_R")->setText(format("%d%%", type->accuracy));
174
175 // Only show rounds if non-zero (IE not infinite ammo)
176 if (type->max_ammo != 0)
177 {
178 form->findControlTyped<Label>("LABEL_5_L")->setText(tr("Rounds"));
179 form->findControlTyped<Label>("LABEL_5_R")
180 ->setText(item ? format("%d / %d", item->ammo, type->max_ammo)
181 : format("%d", type->max_ammo));
182 }
183}
184
185void VehicleSheet::displayGeneral(sp<VEquipment> item [[maybe_unused]], sp<VEquipmentType> type)
186{

Callers

nothing calls this directly

Calls 4

trFunction · 0.85
formatFunction · 0.85
setTextMethod · 0.45
getRangeInTilesMethod · 0.45

Tested by

no test coverage detected