AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Enum structs (https://forums.alliedmods.net/showthread.php?t=315091)

kyriuch 03-21-2019 17:38

Enum structs
 
Hello. I wanted to ask whether enum structs are yet released or not? Comparing to https://wiki.alliedmods.net/SourcePa...itional_Syntax they like are out now. I'm trying to use them but I can't compile a single enum struct that looks like that:
Code:

enum struct BlockData {
    int BlockId;
    float BlockPosition[3];
    float BlockRotation[3];
    int BlockTransparency;
};

And error that I get:

Code:

error 001: expected token: "{", but found "struct"
Anyone can tell me why?

Edit: I guess nevermind? Is it gonna be able in 1.10? If so, there's already a problem:

Code:

GetEntPropVector(blockEntityId, Prop_Data, "m_vecOrigin", blockData.BlockPosition);
Can't get vector from ent prop into enum struct property that is in-fact 3-elements float array.

Psyk0tik 03-22-2019 10:20

Re: Enum structs
 
Quote:

Originally Posted by kyriuch (Post 2644345)
Hello. I wanted to ask whether enum structs are yet released or not? Comparing to https://wiki.alliedmods.net/SourcePa...itional_Syntax they like are out now. I'm trying to use them but I can't compile a single enum struct that looks like that:
Code:

enum struct BlockData {
    int BlockId;
    float BlockPosition[3];
    float BlockRotation[3];
    int BlockTransparency;
};

And error that I get:

Code:

error 001: expected token: "{", but found "struct"
Anyone can tell me why?

Edit: I guess nevermind? Is it gonna be able in 1.10? If so, there's already a problem:

Code:

GetEntPropVector(blockEntityId, Prop_Data, "m_vecOrigin", blockData.BlockPosition);
Can't get vector from ent prop into enum struct property that is in-fact 3-elements float array.

In 1.10 it compiles when I remove the semi-colon. Just stating this to get it out of the way.

Mathias. 03-22-2019 10:34

Re: Enum structs
 
Quote:

Originally Posted by Crasher_3637 (Post 2644434)
In 1.10 it compiles when I remove the semi-colon. Just stating this to get it out of the way.

Quote:

Originally Posted by BAILOPAN (Post 2640204)
I've made a very slight change to the enum struct syntax. The final closing brace (}) must now be followed by a newline. Semicolons are not allowed even with #pragma semicolon, to be consistent with most other close-brace scenarios.


Psyk0tik 03-22-2019 10:55

Re: Enum structs
 
Yes, exactly that.


All times are GMT -4. The time now is 22:51.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.