#include "ProjectileProfile.h"

// Constructor implementation
ProjectileProfile::ProjectileProfile() {
  memset(_name, 0, sizeof(_name));
  _type = PELLET;
  _caliber = 0;
  _weight = 0;
}
ProjectileProfile::ProjectileProfile(String name, ProjectileType type, float caliber, float weight) {
   memset(_name, 0, sizeof(_name));
   strncpy(_name, name.c_str(), sizeof(_name) - 1);
   _type=type;
   _caliber=caliber;
   _weight=weight;
}
String ProjectileProfile::getName(){
  _name[sizeof(_name)-1] = '\0';
  for (int i = 0; i < sizeof(_name) - 1; i++) {
    if (_name[i] == '\0') { _name[i+1] = '\0'; break; }
  }
  return String(_name);
}
float ProjectileProfile::getWeight(){return _weight;}
String ProjectileProfile::getType(){if (_type==PELLET){return "Pellet";}else{return "Slug";}}
float ProjectileProfile::getCaliber(){return _caliber;}