Cvars: Move CCVar class to cvars.h

This commit is contained in:
Arkshine 2015-01-17 00:32:08 +01:00
parent faeaf9259e
commit 6619176a76
3 changed files with 34 additions and 26 deletions

View File

@ -13,32 +13,6 @@
#include "CList.h"
#include "sh_list.h"
// *****************************************************
// class CCVar
// *****************************************************
class CCVar
{
cvar_t cvar;
String name;
String plugin;
public:
CCVar(const char* pname, const char* pplugin, int pflags, float pvalue) : name(pname), plugin(pplugin)
{
cvar.name = (char*)name.c_str();
cvar.flags = pflags;
cvar.string = "";
cvar.value = pvalue;
}
inline cvar_t* getCvar() { return &cvar; }
inline const char* getPluginName() { return plugin.c_str(); }
inline const char* getName() { return name.c_str(); }
inline bool operator == (const char* string) { return (strcmp(name.c_str(), string) == 0); }
int plugin_id;
};
// *****************************************************
// class CPlayer
// *****************************************************

View File

@ -47,6 +47,7 @@
#include "CLang.h"
#include "fakemeta.h"
#include "amxxlog.h"
#include "cvars.h"
#define AMXXLOG_Log g_log.Log
#define AMXXLOG_Error g_log.LogError

View File

@ -10,8 +10,41 @@
#ifndef CVARS_H
#define CVARS_H
#include "cvardef.h"
#include "CString.h"
class CDetour;
class CCVar
{
cvar_t cvar;
String name;
String plugin;
public:
CCVar(const char* pname, const char* pplugin, int pflags, float pvalue) : name(pname), plugin(pplugin)
{
cvar.name = (char*)name.c_str();
cvar.flags = pflags;
cvar.string = "";
cvar.value = pvalue;
}
inline cvar_t* getCvar() {
return &cvar;
}
inline const char* getPluginName() {
return plugin.c_str();
}
inline const char* getName() {
return name.c_str();
}
inline bool operator == (const char* string) {
return (strcmp(name.c_str(), string) == 0);
}
int plugin_id;
};
void CreateCvarHook(void);
extern CDetour *Cvar_DirectSetDetour;