Pointer to the start of the memory area occupied by global lite-C variables. Any global lite-C variable or struct can be identified by the distance of its address to this pointer, even in different instances of the application, in multiplayer games or in saved games where all pointers can be different. This way the pVars pointer can be used to create a unique handle for any variable or struct that is, unlike a pointer, the same in all application instances.
- The distance of any global lite-C variable or struct address to the pVars pointer is guaranteed to remain the same as long as the lite-C code remains unchanged. Any modification to the code will change the
distances of all variables.
- The pVars pointer has no meaning for local variables or structs, for predefined engine variables, or for data allocated through malloc().
long var_to_handle(void* address)
return (long)address - (long)pVars;
void* var_for_handle(long handle)
return (void*)(handle + (long)pVars);