* Fires a shot from the second weapon * equipped on the craft. */
| 1160 | * equipped on the craft. |
| 1161 | */ |
| 1162 | void 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 |
nothing calls this directly
no test coverage detected