Libprimis
Imprimis' 3D destroyable world engine
|
An object representing all Cubescript objects. More...
#include <command.h>
Classes | |
union | identvalptr |
Public Member Functions | |
ident (int t, const char *n, int m, int x, int *s, void *f=nullptr, int flags=0) | |
Constructor for an ident for an int variable. | |
ident (int t, const char *n, float m, float x, float *s, void *f=nullptr, int flags=0) | |
Constructor for an ident for a float variable. | |
ident (int t, const char *n, char **s, void *f=nullptr, int flags=0) | |
Constructor for an ident for a string variable. | |
ident (int t, const char *n, char *a, int flags) | |
ident (int t, const char *n, int a, int flags) | |
ident (int t, const char *n, float a, int flags) | |
ident (int t, const char *n, int flags) | |
ident (int t, const char *n, const tagval &v, int flags) | |
ident (int t, const char *n, const char *args, uint argmask, int numargs, void *f=nullptr, int flags=0) | |
Constructor for an ident for a C++ bound command. | |
void | changed () |
Calls a change effect for this ident, if one exists. | |
void | setval (const tagval &v) |
Sets the value and type of value of this ident given a tagval. | |
void | setval (const identstack &v) |
Sets the value and type of value of this ident given an identstack. | |
void | forcenull () |
Sets the value type of this ident to null. | |
float | getfloat () const |
Returns the saved value of the ident as a float. | |
int | getint () const |
Returns the saved value of the ident as an integer. | |
double | getnumber () const |
Returns the saved value of the ident as a double. | |
const char * | getstr () const |
void | getval (tagval &r) const |
void | getcstr (tagval &v) const |
void | getcval (tagval &v) const |
Public Attributes | ||
uchar | type | |
union { | ||
uchar valtype | ||
uchar numargs | ||
}; | ||
ushort | flags | |
int | index | |
const char * | name | |
union { | ||
struct { | ||
union { | ||
struct { | ||
int minval | ||
int maxval | ||
} | ||
struct { | ||
float minvalf | ||
float maxvalf | ||
} | ||
} | ||
identvalptr storage | ||
identval overrideval | ||
} | ||
struct { | ||
uint * code | ||
identval val | ||
identstack * stack | ||
} | ||
struct { | ||
const char * args | ||
uint argmask | ||
} | ||
}; | ||
identfun | fun | |
An object representing all Cubescript objects.
This object defines all possible state for any object in Cubescript. Different types will have different members due to the union types, but the ident object is common to them regardless. This allows storage of CS objects in a uniform map consisting of one type.
|
inline |
Calls a change effect for this ident, if one exists.
If there is no function pointed to by fun
(it is null), then nothing will occur.
|
inline |
Sets the value type of this ident to null.
If a string is being stored inside this ident, it is freed.
float ident::getfloat | ( | ) | const |
Returns the saved value of the ident as a float.
Returns a float even if the ident is of another type, e.g. integer
int ident::getint | ( | ) | const |
Returns the saved value of the ident as an integer.
Returns an int even if the ident is of another type, e.g. float
double ident::getnumber | ( | ) | const |
Returns the saved value of the ident as a double.
Returns a double even if the ident is of another type, e.g. integer
|
inline |
Sets the value and type of value of this ident given an identstack.
Sets this ident's value type and value to the corresponding values from the passed identstack object.
v | the identstack to set values from |
|
inline |
Sets the value and type of value of this ident given a tagval.
Sets this ident's value type and value to the corresponding values from the passed tagval object.
v | the tagval to set values from |
identfun ident::fun |
the pointer a command or variable points to (the on-change command for a var)
int ident::maxval |
if an int variable, its max allowed value
float ident::maxvalf |
if a float variable, its max allowed value
int ident::minval |
if an int variable, its min allowed value
float ident::minvalf |
if a float variable, its min allowed value
uchar ident::numargs |
if command, number of commands the Id_Command has
uchar ident::type |
one of Id_* in Id_ enum
uchar ident::valtype |
if alias, points to Id_Alias's type