Raised This Month: $51 Target: $400
 12% 

[TUT] Enumerations (enum)


Post New Thread Reply   
 
Thread Tools Display Modes
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 10-09-2010 , 08:19   Re: [TUT] Enumerations (enum)
Reply With Quote #11

Fine. Thanks for being jerk.
__________________
hleV is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-09-2010 , 08:30   Re: [TUT] Enumerations (enum)
Reply With Quote #12

Look, you have already your answer (yours) and you still ask. You are talking about a notation which has already been discussed elsewhere. You can find plenty of references like HLSDK or HLSDK:S. I'm not sure to understand why you insist on that, you should well aware it doesn't matter and pawn != c/c++.
__________________

Last edited by Arkshine; 10-09-2010 at 08:34.
Arkshine is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 10-09-2010 , 12:44   Re: [TUT] Enumerations (enum)
Reply With Quote #13

Quote:
Originally Posted by Arkshine View Post
Look, you have already your answer (yours) and you still ask. You are talking about a notation which has already been discussed elsewhere. You can find plenty of references like HLSDK or HLSDK:S. I'm not sure to understand why you insist on that, you should well aware it doesn't matter and pawn != c/c++.
I was wondering because I never seen anyone using m_ for members of enumeration. While Pawn is not C/C++, its enumeration reminds of C/C++' structures. The question is also related to enumerations, which is what this thread is all about. Sorry that my question didn't look good enough for you to answer (answer well).
__________________
hleV is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 10-09-2010 , 12:46   Re: [TUT] Enumerations (enum)
Reply With Quote #14

Quote:
Originally Posted by hleV View Post
I was wondering because I never seen anyone using m_ for members of enumeration.
I have in my private plugins because I had to basically create a class like you would in C++ but using a different plugin to handle the class.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-09-2010 , 12:54   Re: [TUT] Enumerations (enum)
Reply With Quote #15

Quote:
The question is also related to enumerations, which is what this thread is all about. Sorry that my question didn't look good enough for you to answer (answer well).
The thread is about the use of an enum, not about how naming a var/item/whatyouwant. For that, it's related to the coder's style and there is already a thread about that. That's why there was no point to talk about that there. Also just because the pawn syntax is near of the c/c++ doesn't mean you have to use the same way of naming a var.
__________________
Arkshine is offline
abdul-rehman
Veteran Member
Join Date: Jan 2010
Location: Khi, Pakistan
Old 10-09-2010 , 13:12   Re: [TUT] Enumerations (enum)
Reply With Quote #16

Just for your information Hlev m_* is use to declare offsets like m_iPlayerSucks = 343
__________________

My Plugins For ZP

Inactive due to College and Studies
abdul-rehman is offline
Send a message via Yahoo to abdul-rehman Send a message via Skype™ to abdul-rehman
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 10-09-2010 , 13:16   Re: [TUT] Enumerations (enum)
Reply With Quote #17

Quote:
Originally Posted by abdul-rehman View Post
Just for your information Hlev m_* is use to declare offsets like m_iPlayerSucks = 343
Wrong. m_* is used for member variables within a class.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
abdul-rehman
Veteran Member
Join Date: Jan 2010
Location: Khi, Pakistan
Old 10-09-2010 , 13:37   Re: [TUT] Enumerations (enum)
Reply With Quote #18

Quote:
Originally Posted by Exolent[jNr] View Post
Wrong. m_* is used for member variables within a class.
OK
But what r member variables
__________________

My Plugins For ZP

Inactive due to College and Studies
abdul-rehman is offline
Send a message via Yahoo to abdul-rehman Send a message via Skype™ to abdul-rehman
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 10-09-2010 , 13:45   Re: [TUT] Enumerations (enum)
Reply With Quote #19

Quote:
Originally Posted by abdul-rehman View Post
OK
But what r member variables
Nothing in Pawn.
Learn C++ if you want to know about member variables.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 10-09-2010 , 14:30   Re: [TUT] Enumerations (enum)
Reply With Quote #20

Okay, so to answer Arkshine's post.

Quote:
Originally Posted by Arkshine View Post
That's not complete and there are few things to say :

- You don't talk about weak (lower case letter) and strong tag (upper case letter). The weak tag can be dropped implicitly in some situations. Check the pawn language guide to get more informations.
- Stop to cast the tags in your examples. At least the 3 first, there is no reason to cast.
- I would like to see an example with tagName + IncrementType.
- Don't say random things like "If the above code gives a tag mismatch warning[...]" ; When you set a value, which is important is the tag of the var (g_ePlayerData). When you get a value which is important is the tag of the item (Player_Speed). g_ePlayerData is untag, so if you try to set a value with a strong tag, you will get an error. If the tag was weak or if the the var (g_ePlayerData) was tagged with the same tag as the value you want to set, you won't get errors. In the next example when you get the value, since Player_Speed is a fload and since 250.0 too, the tag is the same, no error and no need to specify Float:.
- I don't see the point to show "Method #1:". Explaining the size it's ok, but showing an example is really a bad idea. It's confusing and you should avoid to show weird ways.
- ePlayerData[ Player_Speed ] = 250.0 ; should be casted.
- There is no example with custom tags.
- There is no example with structure inside a structure.
- In your last example, the problem can be simply solved by using a weak tag. The tag will be dropped automatically.

Here an old thread you may find some ideas
- I checked the Pawn Language Guide before writing this tutorial and I never saw anything about strong or weak tags.
- I don't understand what you're talking about. If you could point out where I did something like that wrong I wouldn't mind discussing it.
- I can't think of any situation where that would be necessary. So it's kind of hard to create an example.
- When I've written a proper enum and used it in an array, it has sometimes given me a tag mismatch warning from that because of the multi-dimensional array. If you want, I can write up a test plugin to show you.
- You're right. I'll replace that part with how the enum structures arrays.
- I can't tell when a cast is or isn't needed so I normally don't use them unless the compiler gives me an tag mismatch.
- I gave examples from bool and Array. Array is a custom tag and the use of tags is no different than other tags.
- I've never used such structures, but I could try to create an example for one.
- Like I said, I never saw anything about weak/strong tags. And the way I gave fixes the problem so what's wrong with the way I showed?
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:25.


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