MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / ArticleStateBaseFacility

Method ArticleStateBaseFacility

src/Ufopaedia/ArticleStateBaseFacility.cpp:40–151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38{
39
40 ArticleStateBaseFacility::ArticleStateBaseFacility(Game *game, ArticleDefinitionBaseFacility *defs) : ArticleState(game, defs->id)
41 {
42 RuleBaseFacility *facility = _game->getRuleset()->getBaseFacility(defs->id);
43
44 // add screen elements
45 _txtTitle = new Text(200, 17, 10, 24);
46
47 // Set palette
48 setPalette("PAL_BASESCAPE");
49
50 ArticleState::initLayout();
51
52 // add other elements
53 add(_txtTitle);
54
55 // Set up objects
56 _game->getResourcePack()->getSurface("BACK09.SCR")->blit(_bg);
57 _btnOk->setColor(Palette::blockOffset(4));
58 _btnPrev->setColor(Palette::blockOffset(4));
59 _btnNext->setColor(Palette::blockOffset(4));
60
61 _txtTitle->setColor(Palette::blockOffset(13)+10);
62 _txtTitle->setBig();
63 _txtTitle->setText(tr(defs->title));
64
65 // build preview image
66 int tile_size = 32;
67 _image = new Surface(tile_size*2, tile_size*2, 232, 16);
68 add(_image);
69
70 SurfaceSet *graphic = _game->getResourcePack()->getSurfaceSet("BASEBITS.PCK");
71 Surface *frame;
72 int x_offset, y_offset;
73 int x_pos, y_pos;
74 int num;
75
76 if (facility->getSize()==1)
77 {
78 x_offset = y_offset = tile_size/2;
79 }
80 else
81 {
82 x_offset = y_offset = 0;
83 }
84
85 num = 0;
86 y_pos = y_offset;
87 for (int y = 0; y < facility->getSize(); ++y)
88 {
89 x_pos = x_offset;
90 for (int x = 0; x < facility->getSize(); ++x)
91 {
92 frame = graphic->getFrame(facility->getSpriteShape() + num);
93 frame->setX(x_pos);
94 frame->setY(y_pos);
95 frame->blit(_image);
96
97 if (facility->getSize()==1)

Callers

nothing calls this directly

Calls 15

getBaseFacilityMethod · 0.80
getSurfaceSetMethod · 0.80
getFrameMethod · 0.80
getSpriteShapeMethod · 0.80
getSpriteFacilityMethod · 0.80
setColumnsMethod · 0.80
setDotMethod · 0.80
addRowMethod · 0.80
setCellColorMethod · 0.80
getBuildCostMethod · 0.80
getMonthlyCostMethod · 0.80
getHitRatioMethod · 0.80

Tested by

no test coverage detected