working fixes

This commit is contained in:
Dan Priece
2026-08-17 12:55:33 -04:00
parent a23322dddf
commit 122abcdc7c
5 changed files with 351 additions and 17 deletions
+13 -3
View File
@@ -1,10 +1,20 @@
#include "GunProfile.h"
// Constructor implementation
GunProfile::GunProfile() {}
GunProfile::GunProfile() {
memset(_name, 0, sizeof(_name));
_type = 0;
}
GunProfile::GunProfile(String name, int type) {
strcpy(_name, name.c_str());
memset(_name, 0, sizeof(_name));
strncpy(_name, name.c_str(), sizeof(_name) - 1);
_type=type;
}
String GunProfile::getName(){return String(_name);}
String GunProfile::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);
}
int GunProfile::getPowerLevel(){return _type;}