Cvars: Convert CString to ke::AString in CCVar class

This commit is contained in:
Arkshine 2015-01-17 00:40:25 +01:00
parent 6619176a76
commit f973f5beb7

View File

@ -11,37 +11,45 @@
#define CVARS_H #define CVARS_H
#include "cvardef.h" #include "cvardef.h"
#include "CString.h" #include <am-string.h>
class CDetour; class CDetour;
class CCVar class CCVar
{ {
cvar_t cvar; cvar_t cvar;
String name; ke::AString name;
String plugin; ke::AString plugin;
public: public:
CCVar(const char* pname, const char* pplugin, int pflags, float pvalue) : name(pname), plugin(pplugin) CCVar(const char* pname, const char* pplugin, int pflags, float pvalue) : name(pname), plugin(pplugin)
{ {
cvar.name = (char*)name.c_str(); cvar.name = name.chars();
cvar.flags = pflags; cvar.flags = pflags;
cvar.string = ""; cvar.string = "";
cvar.value = pvalue; cvar.value = pvalue;
} }
inline cvar_t* getCvar() { inline cvar_t* getCvar()
{
return &cvar; return &cvar;
} }
inline const char* getPluginName() {
return plugin.c_str(); inline const char* getPluginName()
{
return plugin.chars();
} }
inline const char* getName() {
return name.c_str(); inline const char* getName()
{
return name.chars();
} }
inline bool operator == (const char* string) {
return (strcmp(name.c_str(), string) == 0); inline bool operator == (const char* string)
{
return name.compare(string) == 0;
} }
int plugin_id; int plugin_id;
}; };