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

Method nextStep

src/Geoscape/BaseDefenseState.cpp:122–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120}
121
122void BaseDefenseState::nextStep()
123{
124 if (_thinkcycles == -1)
125 return;
126
127 ++_thinkcycles;
128
129 if (_thinkcycles == 1)
130 {
131 _txtInit->setVisible(true);
132 return;
133 }
134
135 if (_thinkcycles > 1)
136 {
137 switch (_action)
138 {
139 case BDA_DESTROY:
140 _lstDefenses->addRow(2, tr("STR_UFO_DESTROYED").c_str(),L" ",L" ");
141 _game->getResourcePack()->getSound("GEO.CAT", 11)->play();
142 _action = BDA_END;
143 return;
144 case BDA_END:
145 _btnOk->setVisible(true);
146 _thinkcycles = -1;
147 return;
148 default:
149 break;
150 }
151 if (_attacks == _defenses && _passes == _gravShields)
152 {
153 _action = BDA_END;
154 return;
155 }
156 else if (_attacks == _defenses && _passes < _gravShields)
157 {
158 _lstDefenses->addRow(3, tr("STR_GRAV_SHIELD_REPELS_UFO").c_str(),L" ",L" ");
159 ++_row;
160 ++_passes;
161 _attacks = 0;
162 return;
163 }
164
165
166
167 BaseFacility* def = _base->getDefenses()->at(_attacks);
168
169 switch (_action)
170 {
171 case BDA_NONE:
172 _lstDefenses->addRow(3, tr((def)->getRules()->getType()).c_str(),L" ",L" ");
173 ++_row;
174 _action = BDA_FIRE;
175 return;
176 case BDA_FIRE:
177 _lstDefenses->setCellText(_row, 1, tr("STR_FIRING").c_str());
178 _game->getResourcePack()->getSound("GEO.CAT", (def)->getRules()->getFireSound())->play();
179 _action = BDA_RESOLVE;

Callers

nothing calls this directly

Calls 15

percentFunction · 0.85
addRowMethod · 0.80
getDefensesMethod · 0.80
setCellTextMethod · 0.80
getHitRatioMethod · 0.80
setVisibleMethod · 0.45
playMethod · 0.45
getSoundMethod · 0.45
getResourcePackMethod · 0.45
getTypeMethod · 0.45
getRulesMethod · 0.45
getFireSoundMethod · 0.45

Tested by

no test coverage detected