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

Method setBase

src/Basescape/BaseView.cpp:86–109  ·  view source on GitHub ↗

* Changes the current base to display and * initializes the internal base grid. * @param base Pointer to base to display. */

Source from the content-addressed store, hash-verified

84 * @param base Pointer to base to display.
85 */
86void BaseView::setBase(Base *base)
87{
88 _base = base;
89 _selFacility = 0;
90
91 // Clear grid
92 for (int x = 0; x < BASE_SIZE; ++x)
93 for (int y = 0; y < BASE_SIZE; ++y)
94 _facilities[x][y] = 0;
95
96 // Fill grid with base facilities
97 for (std::vector<BaseFacility*>::iterator i = _base->getFacilities()->begin(); i != _base->getFacilities()->end(); ++i)
98 {
99 for (int y = (*i)->getY(); y < (*i)->getY() + (*i)->getRules()->getSize(); ++y)
100 {
101 for (int x = (*i)->getX(); x < (*i)->getX() + (*i)->getRules()->getSize(); ++x)
102 {
103 _facilities[x][y] = *i;
104 }
105 }
106 }
107
108 _redraw = true;
109}
110
111/**
112 * Changes the texture to use for drawing

Callers 3

PlaceLiftStateMethod · 0.45
PlaceFacilityStateMethod · 0.45
miniClickMethod · 0.45

Calls 5

getFacilitiesMethod · 0.80
getYMethod · 0.45
getSizeMethod · 0.45
getRulesMethod · 0.45
getXMethod · 0.45

Tested by

no test coverage detected