Skip to content

Structs as Global Variables?

Hello!

I am trying to create a struct to act as a global variable within an include file.

For example in a central core include file #A I define the following:
//System Details struct
struct SYSTEM_DATA_STRUCT {

    int nSystemToggleType;
    string sSystemName;
    string sSystemDescription;
    string sSystemScript;
};

In file/Include #B I want to reference said struct as a global variable, like this:
struct SYSTEM_DATA_STRUCT stSystemDetails {
    stSystemDetails.nSystemToggleType = TOGGLE_TYPE_SUB_SYSTEM;
    stSystemDetails.sSystemName = "Time System";
    stSystemDetails.sSystemDescription = "Toggle for the Debugging of the Eminence Time System";
    stSystemDetails.sSystemScript = "emn_time_inc";
};

The intent is only to set said struct once and rely on it. Unfortunately I cant seem to make it work(Tried variou syntax ways). Is it at all possible, or am I doomed to have to use a function to set these fields up?


Thanks in advance!

Comments

  • ForSeriousForSerious Member Posts: 466
    The closest I think you are going to get is saving campaign variables.
    On load, load them to local variables onto the module object. On change, save the campaign variables with the new values.
Sign In or Register to comment.