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

Method init

src/Basescape/SoldiersState.cpp:138–156  ·  view source on GitHub ↗

* Updates the soldiers list * after going to other screens. */

Source from the content-addressed store, hash-verified

136 * after going to other screens.
137 */
138void SoldiersState::init()
139{
140 State::init();
141 int row = 0;
142 _lstSoldiers->clearList();
143 for (std::vector<Soldier*>::iterator i = _base->getSoldiers()->begin(); i != _base->getSoldiers()->end(); ++i)
144 {
145 _lstSoldiers->addRow(3, (*i)->getName(true).c_str(), tr((*i)->getRankString()).c_str(), (*i)->getCraftString(_game->getLanguage()).c_str());
146 if ((*i)->getCraft() == 0)
147 {
148 _lstSoldiers->setRowColor(row, Palette::blockOffset(15)+6);
149 }
150 row++;
151 }
152 if (row > 0 && _lstSoldiers->getScroll() >= row)
153 {
154 _lstSoldiers->scrollTo(0);
155 }
156}
157
158/**
159 * Returns to the previous screen.

Callers

nothing calls this directly

Calls 12

initFunction · 0.85
clearListMethod · 0.80
addRowMethod · 0.80
getCraftStringMethod · 0.80
getLanguageMethod · 0.80
setRowColorMethod · 0.80
getScrollMethod · 0.80
scrollToMethod · 0.80
getSoldiersMethod · 0.45
getNameMethod · 0.45
getRankStringMethod · 0.45
getCraftMethod · 0.45

Tested by

no test coverage detected