Fix compilation issues

This commit is contained in:
F1ssi0N 2018-03-13 19:45:49 +00:00
parent 0147ecc4cb
commit 238ffc43dd
2 changed files with 11 additions and 5 deletions

View File

@ -288,10 +288,13 @@ void ConvarBase::tf_convar_changed(sdk::IConVar *iconvar, const char *old_string
} }
} }
ConvarBase::ConvarBase(const char *name, Convar_Type type, const ConvarBase *parent) : parent(parent), t(type), next(head), init_complete(false) { ConvarBase::ConvarBase(const char *name, ConvarType type, const ConvarBase *parent) : parent(parent), t(type), next(head), init_complete(false) {
head = this; head = this;
if constexpr (doghook_platform_windows())
strcpy_s(internal_name, name); strcpy_s(internal_name, name);
else if constexpr (doghook_platform_linux())
strcpy(internal_name, name);
// Create a tf convar based on this one // Create a tf convar based on this one
tf_convar = new sdk::ConCommandBase; tf_convar = new sdk::ConCommandBase;

View File

@ -106,10 +106,10 @@ public:
auto from_string(const char *str) -> bool override final { auto from_string(const char *str) -> bool override final {
assert(str); assert(str);
if (_stricmp(str, "false") == 0) { if (stricmp(str, "false") == 0) {
value = false; value = false;
return false; return false;
} else if (_stricmp(str, "true") == 0) { } else if (stricmp(str, "true") == 0) {
value = true; value = true;
return false; return false;
} }
@ -279,7 +279,10 @@ public:
Convar(const char *name, const char *value, const ConvarBase *parent) : Convar(name, parent) { Convar(const char *name, const char *value, const ConvarBase *parent) : Convar(name, parent) {
auto size = strlen(value) + 1; auto size = strlen(value) + 1;
this->value = new char[size]; this->value = new char[size];
if constexpr (doghook_platform_windows())
strcpy_s(this->value, size, value); strcpy_s(this->value, size, value);
else if constexpr (doghook_platform_linux())
strncpy(this->value, value, size);
} }
~Convar() { ~Convar() {