working fixes
This commit is contained in:
+13
-3
@@ -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;}
|
||||
Reference in New Issue
Block a user