amxmodx/amxmodx/cvars.h

61 lines
1.1 KiB
C
Raw Normal View History

// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#ifndef CVARS_H
#define CVARS_H
2015-01-17 00:32:08 +01:00
#include "cvardef.h"
#include <am-string.h>
2015-01-17 00:32:08 +01:00
class CDetour;
2015-01-17 00:32:08 +01:00
class CCVar
{
cvar_t cvar;
ke::AString name;
ke::AString plugin;
2015-01-17 00:32:08 +01:00
public:
CCVar(const char* pname, const char* pplugin, int pflags, float pvalue) : name(pname), plugin(pplugin)
{
cvar.name = name.chars();
cvar.flags = pflags;
2015-01-17 00:32:08 +01:00
cvar.string = "";
cvar.value = pvalue;
2015-01-17 00:32:08 +01:00
}
inline cvar_t* getCvar()
{
2015-01-17 00:32:08 +01:00
return &cvar;
}
inline const char* getPluginName()
{
return plugin.chars();
2015-01-17 00:32:08 +01:00
}
inline const char* getName()
{
return name.chars();
2015-01-17 00:32:08 +01:00
}
inline bool operator == (const char* string)
{
return name.compare(string) == 0;
2015-01-17 00:32:08 +01:00
}
2015-01-17 00:32:08 +01:00
int plugin_id;
};
void CreateCvarHook(void);
extern CDetour *Cvar_DirectSetDetour;
#endif // CVARS_H