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

Method getVehicleCount

src/Savegame/Craft.cpp:855–866  ·  view source on GitHub ↗

* Returns the total amount of vehicles of * a certain type stored in the craft. * @param vehicle Vehicle type. * @return Number of vehicles. */

Source from the content-addressed store, hash-verified

853 * @return Number of vehicles.
854 */
855int Craft::getVehicleCount(const std::string &vehicle) const
856{
857 int total = 0;
858 for (std::vector<Vehicle*>::const_iterator i = _vehicles.begin(); i != _vehicles.end(); ++i)
859 {
860 if ((*i)->getRules()->getType() == vehicle)
861 {
862 total++;
863 }
864 }
865 return total;
866}
867
868/**
869 * Returns the craft's dogfight status.

Callers 3

CraftEquipmentStateMethod · 0.80
updateQuantityMethod · 0.80
moveLeftByValueMethod · 0.80

Calls 2

getTypeMethod · 0.45
getRulesMethod · 0.45

Tested by

no test coverage detected