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

Method getNumWeapons

src/Savegame/Craft.cpp:396–414  ·  view source on GitHub ↗

* Returns the amount of weapons currently * equipped on this craft. * @return Number of weapons. */

Source from the content-addressed store, hash-verified

394 * @return Number of weapons.
395 */
396int Craft::getNumWeapons() const
397{
398 if (_rules->getWeapons() == 0)
399 {
400 return 0;
401 }
402
403 int total = 0;
404
405 for (std::vector<CraftWeapon*>::const_iterator i = _weapons.begin(); i != _weapons.end(); ++i)
406 {
407 if ((*i) != 0)
408 {
409 total++;
410 }
411 }
412
413 return total;
414}
415
416/**
417 * Returns the amount of soldiers from a list

Callers 2

initMethod · 0.80
InterceptStateMethod · 0.80

Calls 1

getWeaponsMethod · 0.45

Tested by

no test coverage detected