Psylixiri
Member
|
casting an Int
im trying to cast from an Enumeration to an Int to be able to see if the mouse focus on an obj and eventually return a value for a member
the only code ive seen wich seen possibly being related to an example is the one in inventory.cpp of esenthel MMO
Code:
Item& item(Int i) {return (Item&)items[i];}
can som1one tell me if its possible to be able to cast an int without using an extanded Class
or so.. if there any other way to be able for me to point a value taken from Gui device position?
|
|
01-24-2012 03:59 PM |
|
Dynad
Member
|
RE: casting an Int
Enums are already integers, so u don't need to cast them.
There is always evil somewhere, you just have to look for it properly.
|
|
01-24-2012 04:38 PM |
|
Psylixiri
Member
|
RE: casting an Int
as i said.. i want a Gui device to return a value...im searching a way to..but the only case ive tought to is put endless cases of if Gui.ms==attack[FIREBALL] return a value
would look weird dont you?
|
|
01-24-2012 04:53 PM |
|
Dynad
Member
|
RE: casting an Int
Well if u don't like a long list of if's or a switch statement then just loop through the total of spells and check against the Gui.ms value.
There is always evil somewhere, you just have to look for it properly.
|
|
01-24-2012 04:57 PM |
|
Psylixiri
Member
|
RE: casting an Int
ok...so its so... simple.. damnit
|
|
01-24-2012 05:03 PM |
|