Question about enums
#1

Ok, so... my two enums:

Код:
enum _enum { _id, _modelid, _x, _y, _z }

enum _enum1 { _x1, _y1, _z1, _interior }
Well, these '1' chars make things less clear. Is there are way to declare another enum with the same index names? Like this:

Код:
enum _enum { _id, _modelid, _x, _y, _z }

enum _enum1 { _x, _y, _z, _interior }
You might say its unknown thus, which index to take (2 or 0) when calling let's say:

Код:
arr[_x];
But hello,... I declare my arrays this way:

Код:
new arr[_enum];
new arr1[_enum1];
So maybe if it's possibe to describe, which exactly enum I'm using with a certain array, I should be allowed to use same enum indices, which means:

Код:
arr[_x]   same as    arr[2]
arr1[_x]    same as    arr1[0]
Thanks for your advice.
Reply
#2

Thanks ******. Eh... I'd like to have short enum indices, because

Код:
new some_var = object[E_OBJECT_DATA_MODELID];
looks such a mess. 'OBJECT' gives no extra info here as my array name has it, such a long index name makes code harder readable (to me at least). Not good.

Код:
new some_var = object[MODELID];
looks much better. But 'MODELID' is a popular name (kind of) to use my index name must become elongated (and messy) because of that reason... blah. Maybe some redefinitions could do the trick? Don't know...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)