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

Method createMapRowBuilding

game/ui/skirmish/mapselector.cpp:56–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54MapSelector::~MapSelector() = default;
55
56sp<Control> MapSelector::createMapRowBuilding(StateRef<Building> building, sp<GameState> state)
57{
58 auto control = mksp<Control>();
59
60 const int HEIGHT = 21;
61
62 auto text = control->createChild<Label>(
63 format("[%s Building] %s [%s]", building->owner == state->getAliens() ? "Alien" : "Human",
64 building->name, building->battle_map.id),
65 ui().getFont("smalfont"));
66 text->Location = {0, 0};
67 text->Size = {488, HEIGHT};
68 text->TextVAlign = VerticalAlignment::Centre;
69
70 {
71 auto btnImage = fw().data->loadImage(
72 "PCK:xcom3/ufodata/newbut.pck:xcom3/ufodata/newbut.tab:57:ui/menuopt.pal");
73 auto btnLocation = control->createChild<GraphicButton>(btnImage, btnImage);
74 btnLocation->Location = text->Location + Vec2<int>{text->Size.x, 0};
75 btnLocation->Size = {22, HEIGHT};
76 btnLocation->addCallback(FormEventType::ButtonClick, [building, state, this](Event *) {
77 skirmish.setLocation(building);
78 fw().stageQueueCommand({StageCmd::Command::POP});
79 });
80 }
81
82 return control;
83}
84
85sp<Control> MapSelector::createMapRowVehicle(StateRef<VehicleType> vehicle, sp<GameState> state)
86{

Callers

nothing calls this directly

Calls 7

formatFunction · 0.85
getAliensMethod · 0.80
addCallbackMethod · 0.80
stageQueueCommandMethod · 0.80
getFontMethod · 0.45
loadImageMethod · 0.45
setLocationMethod · 0.45

Tested by

no test coverage detected