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

Method update

game/state/battle/battleitem.cpp:155–300  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

153void BattleItem::updateTB(GameState &state) { item->updateTB(state); }
154
155void BattleItem::update(GameState &state, unsigned int ticks)
156{
157 item->update(state, ticks);
158 // May have exploded
159 if (!tileObject)
160 {
161 return;
162 }
163
164 if (ticksUntilCollapse > 0)
165 {
166 if (ticksUntilCollapse > ticks)
167 {
168 ticksUntilCollapse -= ticks;
169 }
170 else
171 {
172 ticksUntilCollapse = 0;
173 collapse();
174 }
175 }
176
177 if (!falling)
178 {
179 return;
180 }
181
182 if (ownerInvulnerableTicks > 0)
183 {
184 if (ownerInvulnerableTicks > ticks)
185 {
186 ownerInvulnerableTicks -= ticks;
187 }
188 else
189 {
190 ownerInvulnerableTicks = 0;
191 }
192 }
193
194 if (collisionIgnoredTicks > 0)
195 {
196 if (collisionIgnoredTicks > ticks)
197 {
198 collisionIgnoredTicks -= ticks;
199 }
200 else
201 {
202 collisionIgnoredTicks = 0;
203 }
204 }
205
206 int remainingTicks = ticks;
207
208 auto previousPosition = position;
209 auto newPosition = position;
210
211 while (remainingTicks-- > 0)
212 {

Callers

nothing calls this directly

Calls 3

getOwningTileMethod · 0.80
getTypeMethod · 0.45
playSampleMethod · 0.45

Tested by

no test coverage detected