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

Method fireWeapon2

src/Geoscape/DogfightState.cpp:1162–1182  ·  view source on GitHub ↗

* Fires a shot from the second weapon * equipped on the craft. */

Source from the content-addressed store, hash-verified

1160 * equipped on the craft.
1161 */
1162void DogfightState::fireWeapon2()
1163{
1164 if(_weapon2Enabled)
1165 {
1166 CraftWeapon *w2 = _craft->getWeapons()->at(1);
1167 if (w2->setAmmo(w2->getAmmo() - 1))
1168 {
1169
1170 std::wostringstream ss;
1171 ss << w2->getAmmo();
1172 _txtAmmo2->setText(ss.str());
1173
1174 CraftWeaponProjectile *p = w2->fire();
1175 p->setDirection(D_UP);
1176 p->setHorizontalPosition(HP_RIGHT);
1177 _projectiles.push_back(p);
1178
1179 _game->getResourcePack()->getSound("GEO.CAT", w2->getRules()->getSound())->play();
1180 }
1181 }
1182}
1183
1184/**
1185 * Each time a UFO will try to fire it's cannons

Callers

nothing calls this directly

Calls 11

fireMethod · 0.80
setHorizontalPositionMethod · 0.80
getWeaponsMethod · 0.45
setAmmoMethod · 0.45
getAmmoMethod · 0.45
setTextMethod · 0.45
setDirectionMethod · 0.45
playMethod · 0.45
getSoundMethod · 0.45
getResourcePackMethod · 0.45
getRulesMethod · 0.45

Tested by

no test coverage detected