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

Method update

game/state/city/vehicle.cpp:2032–2240  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2030}
2031
2032void Vehicle::update(GameState &state, unsigned int ticks)
2033{
2034 if (isDead() && status == VehicleStatus::Operational)
2035 {
2036 status = VehicleStatus::Destroyed;
2037
2038 // Remove from building
2039 if (currentBuilding)
2040 {
2041 currentBuilding->currentVehicles.erase({&state, shared_from_this()});
2042 }
2043 }
2044
2045 if (isDead())
2046 {
2047 return;
2048 }
2049
2050 bool turbo = ticks > TICKS_PER_SECOND;
2051 bool IsIdle;
2052
2053 if (stunTicksRemaining >= ticks)
2054 {
2055 stunTicksRemaining -= ticks;
2056 return;
2057 }
2058 else if (stunTicksRemaining > 0)
2059 {
2060 ticks -= stunTicksRemaining;
2061 stunTicksRemaining = 0;
2062 }
2063
2064 if (cloakTicksAccumulated < CLOAK_TICKS_REQUIRED_VEHICLE)
2065 {
2066 cloakTicksAccumulated += ticks;
2067 }
2068 if (!hasCloak())
2069 {
2070 cloakTicksAccumulated = 0;
2071 }
2072 if (teleportTicksAccumulated < TELEPORT_TICKS_REQUIRED_VEHICLE)
2073 {
2074 teleportTicksAccumulated += ticks;
2075 }
2076 if (!hasTeleporter())
2077 {
2078 teleportTicksAccumulated = 0;
2079 }
2080
2081 IsIdle = this->missions.empty();
2082 if (!IsIdle)
2083 {
2084 this->missions.front().update(state, *this, ticks);
2085 }
2086
2087 popFinishedMissions(state);
2088
2089 int maxShield = this->getMaxShield();

Callers 2

updateMethod · 0.45
updateMethod · 0.45

Calls 12

getMaxShieldMethod · 0.95
getShieldRechargeRateMethod · 0.95
getAngularSpeedMethod · 0.95
updateSpriteMethod · 0.95
facingToXYFunction · 0.85
xyToFacingFunction · 0.85
facingDistanceFunction · 0.85
emptyMethod · 0.80
isGroundMethod · 0.80
getDistanceToMethod · 0.80
canFireMethod · 0.45
getPositionMethod · 0.45

Tested by

no test coverage detected