Announcement

Collapse
No announcement yet.

Central definition for a struct? [answered]

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    Indeed, you are both entirely correct, gentlemen. Thank you!

    Odd that dependson is required. The compiler still has to sort out the compile order when it encounters references to other classes in the class body.

    Leave a comment:


  • replied
    If the declaring class is in the same package as the class using the struct without being a superclass of the using class, you may have to declare the using class with the dependson(declaringClassName) class modifier. See the XGame.xPawn declaration for an example. This will tell the compiler to make sure the declaring class is parsed before the class using the struct.

    Leave a comment:


  • replied
    I can't remember whether or not it works, but try
    var TheClass.TheStruct Blah;

    Leave a comment:


  • started a topic Central definition for a struct? [answered]

    Central definition for a struct? [answered]

    I have a simple struct that I'd like to re-use in other classes:
    Code:
    struct SoundInfo
    {
        var Sound Sound;
        // Anywhere from 0.5 to 2.
        var float Pitch;
        // Anywhere from 0 to 2.
        var float Volume;
        var float Radius;
    };
    Is there any way I could declare this struct in one class and then declare variables of this type in another class? I messed around with public and static, but no luck.
Working...
X