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

enum inside of enum


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 02-01-2020 , 11:42   enum inside of enum
Reply With Quote #1

Is it possible to have an enum inside of another enum If so, how would I make it and what are its limits?
__________________
retired chump
DjSoftero is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 02-01-2020 , 12:46   Re: enum inside of enum
Reply With Quote #2

What do you mean by "enum inside enum"?

PHP Code:
enum type1
{
     
a,
     
b,
     
c
}

enum type2
{
    
d[type1],
    
e,
    
f

or you want to actually put an enum inside another enum?
__________________

Last edited by HamletEagle; 02-01-2020 at 12:46.
HamletEagle is offline
Old 02-01-2020, 13:26
DjSoftero
This message has been deleted by DjSoftero.
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 02-01-2020 , 13:45   Re: enum inside of enum
Reply With Quote #3

well, I have this:
PHP Code:
enum [[+=:]ewinner] {
    
ongoing,
    
team1,
    
team2,
    
draw
}
enum _:egame{
    
ID,
    
team1[max_team_name_length],
    
Float:team1rate,
    
team2[max_team_name_length],
    
Float:team2rate,
    
ending,
    
winner

the last variable winner can have 4 values:
PHP Code:
enum _:ewinner {
    
ongoing,
    
team1,
    
team2,
    
draw

So when I access an array
PHP Code:
new array[egame]
array[
winner]// this can have only 4 values 0, 1, 2, 3. Decided to use enum for that instead of 4
//separate defines for better future readability, but now I'm questioning myself whether 
//enum can be used that way.
//I don't quite understand how to give it its values. 
edit----
I guess I should use it like this?
PHP Code:
enum (+=1) {
    
ongoing,
    
t1,
    
t2,
    
draw

btw, sorry. The initial question`s wording was insufficient.
__________________
retired chump

Last edited by DjSoftero; 02-01-2020 at 14:04.
DjSoftero is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-01-2020 , 17:17   Re: enum inside of enum
Reply With Quote #4

PHP Code:
enum WinnerTypes
{
    
ongoing 1,
    
team1,
    
team2,
    
draw

__________________

Last edited by Bugsy; 02-01-2020 at 17:17.
Bugsy 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 06:48.


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