Question about enums - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Question about enums (
/showthread.php?tid=505351)
Question about enums -
Baltazar - 08.04.2014
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:
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.
Re: Question about enums -
Baltazar - 08.04.2014
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...