Amaroq7 / SPMod

SourcePawn Scripting Engine for Half-Life 1 based games
GNU General Public License v3.0
27 stars 12 forks source link

Convert cvar API to methodmap #11

Closed Amaroq7 closed 6 years ago

Amaroq7 commented 6 years ago

Description

Depends on #8. Natives which access cvar by name could be entirely dropped in favor of pcvars.

Possible api:

enum Cvar
{
    INVALID_CVAR = -1
};

methodmap Cvar
{
    /* this constructor would register cvar */
    public native Cvar(const char[] name, const char[] value, CvarFlags = None);
    public native float GetFloat();
    public native void GetString(char[] value, int size);
    public native int GetInt();
    public native CvarFlags GetFlags();
    public native void SetFloat(float value);
    public native void SetString(const char[] value);
    public native void SetInt(int value);
    public native void SetFlags(CvarFlags flags);
};
native Cvar FindCvar(const char[] name);

How do we replicate the issue?

n/a

Expected behavior (i.e. solution)

Methodmap API to work with cvar.

Other Comments

n/a