UE1 - UT I need to use a struct from another class

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Helen

Member
Jan 23, 2010
48
0
6
Let's say I have this class, with this struct declared inside:
Code:
class myReplicationInfo expands ReplicationInfo;

struct PlayerStat
{
    var string Player;
    var int Score;
};

Now I have another class, which does NOT inherit from the above class. Inside this class, I would like to declare a variable of type 'PlayerStat', which is the struct found in the myReplicationInfo class. For example:

Code:
class myServerInfo expands ServerInfo;

function Dummy()
{
    local PlayerStat ps;
}

Can I do this? If so, what is the syntax? (because the above doesn't work of course).

Thanks.
 

Wormbo

Administrator
Staff member
Jun 4, 2001
5,913
36
48
Germany
www.koehler-homepage.de
The syntax would be myReplicationInfo.PlayerStat, but I'm not sure if it will work all the time (or at all in UE1). Starting with UE2 there's the special class modifier dependson() that forces the compiler to parse the depended class first. Without it, the compiler would not know that there's a PlayerStat struct or enum in the myReplicationInfo class.

The order in which classes are parsed is unspecified. I think it depends on the order in which the source files are listed in the Classes directory by the file system. That's why in some cases the qualified struct reference works and in others it doesn't. That is, assuming qualified struct references are supported at all in UE1.
 

Helen

Member
Jan 23, 2010
48
0
6
myReplicationInfo.PlayerStat doesn't do the trick :(

That's ok, I'll just pass info a different way.

Thanks.