Libprimis
Imprimis' 3D destroyable world engine
Loading...
Searching...
No Matches
ident Struct Reference

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   min 
            int   max 
         }   i
         struct { 
            float   min 
            float   max 
         }   f
      } 
      identvalptr   storage 
      identval   overrideval 
   }   val
   struct { 
      uint *   code 
      identval   val 
      identstack *   stack 
   }   alias
   struct { 
      const char *   args 
      uint   argmask 
   }   cmd
}; 
identfun fun

Detailed Description

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.

Member Function Documentation

◆ changed()

void ident::changed ( )
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.

◆ forcenull()

void ident::forcenull ( )
inline

Sets the value type of this ident to null.

If a string is being stored inside this ident, it is freed.

◆ getfloat()

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

Returns
the float value of the ident

◆ getint()

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

◆ getnumber()

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

Returns
the double value of the ident

◆ setval() [1/2]

void ident::setval ( const identstack & v)
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.

Parameters
vthe identstack to set values from

◆ setval() [2/2]

void ident::setval ( const tagval & v)
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.

Parameters
vthe tagval to set values from

Member Data Documentation

◆ fun

identfun ident::fun

the pointer a command or variable points to (the on-change command for a var)

◆ max [1/2]

float ident::max

if a float variable, its max allowed value

◆ max [2/2]

int ident::max

if an int variable, its max allowed value

◆ min [1/2]

float ident::min

if a float variable, its min allowed value

◆ min [2/2]

int ident::min

if an int variable, its min allowed value

◆ numargs

uchar ident::numargs

if command, number of commands the Id_Command has

◆ type

uchar ident::type

one of Id_* in Id_ enum

◆ valtype

uchar ident::valtype

if alias, points to Id_Alias's type


The documentation for this struct was generated from the following file:
  • /github/workspace/src/libprimis-headers/command.h