Tags in enums, passing to functions
#8

Quote:
Originally Posted by ******
Посмотреть сообщение
That's probably because "stat" is a variable so can represent any part of the enum at all. Imagine the case where you have multiple tags in the enum - suddenly your simple "if" becomes far more complex determining what the tag of the dynamically selected slot is and calling the correct comparison function for the given tag. Not only is this very hard but offset tags are not stored in the compiled amx. The fact that all of your enum slots are Float: is just a special case that COULD be detected but isn't.

This is actually made entirely impossible to resolve by the fact that you can have multiple names for the same enum slot, each with different tags (like a "union" in C). In that case, which tag should be used when dynamically selecting a slot as you are? Better to just have a default unless told otherwise as you do.
I don't wholly understand this. The tag of 'stat' is E_PLAYER_STATS, right? But what it represents (pStat_respect) is a Float. So it's basically a float being represented with E_PLAYER_STATS tag? If so, how can I 'keep' the original Float: tag to use it in if()?

What do you mean by this:

Quote:

This is actually made entirely impossible to resolve by the fact that you can have multiple names for the same enum slot,

?

Do you mean this?

pawn Код:
enum E_PLAYER_STATS // Percentages (between 0 - 100)
{
    pStat_something = 0,
    Float:pStat_somethingElse = 0
};
Where one has a Float: tag and one doesn't?

Okay, so what's my best course of action to get around this, apart from storing the types of variables in an array?
Reply


Messages In This Thread
Tags in enums, passing to functions - by MP2 - 27.07.2013, 00:11
AW: Tags in enums, passing to functions - by Nero_3D - 27.07.2013, 00:32
Re: Tags in enums, passing to functions - by MP2 - 27.07.2013, 00:37
Re: Tags in enums, passing to functions - by MP2 - 28.07.2013, 15:23
Re: Tags in enums, passing to functions - by Kar - 28.07.2013, 16:36
Re: Tags in enums, passing to functions - by MP2 - 28.07.2013, 16:36
Re: Tags in enums, passing to functions - by Konstantinos - 28.07.2013, 16:54
Re: Tags in enums, passing to functions - by MP2 - 28.07.2013, 17:19
Re: Tags in enums, passing to functions - by MP2 - 28.07.2013, 20:14
Re: Tags in enums, passing to functions - by MP2 - 28.07.2013, 20:34

Forum Jump:


Users browsing this thread: 1 Guest(s)