xienwolf
Deity
NO_GAMEOPTION is not an integer, it is an enumerator. As such, you CAN get away with using it as an integer, since there is a sequential order assigned, but you are FORBIDDEN to use an integer in place of an enumerator. You must cast it, which is what the (GameOptionTypes)iNum does.
So the game will read:
m_iReqGameOption(NO_GAMEOPTION)
as
m_iReqGameOption(-1)
Even though it prefers you don't do things that way. In this particular case, there is no harm done. But what is stored, is a -1.
The proper format for your IF statement is:
if (GC.getGameINLINE().isOption((GameOptionTypes)GC.getUnitInfo(eUnit) .getReqGameOption())).
But you want to make sure you do not make this check if getReqGameOption returns NO_GAMEOPTION, because you don't know if that will return true or false, as it doesn't exist.
So you want to use both cases really. I suspect that:
if (GC.getUnitInfo(eUnit).getNotGameOption() != NO_GAMEOPTION)
will work fine, it will treat NO_GAMEOPTION like a -1 in this case and be able to compare it with an integer. The reason that the other one doesn't work is because .isOption() requires that you pass it a GameOptionTypes variable, so will yell at you for trying to give it an integer.
So the game will read:
m_iReqGameOption(NO_GAMEOPTION)
as
m_iReqGameOption(-1)
Even though it prefers you don't do things that way. In this particular case, there is no harm done. But what is stored, is a -1.
The proper format for your IF statement is:
if (GC.getGameINLINE().isOption((GameOptionTypes)GC.getUnitInfo(eUnit) .getReqGameOption())).
But you want to make sure you do not make this check if getReqGameOption returns NO_GAMEOPTION, because you don't know if that will return true or false, as it doesn't exist.
So you want to use both cases really. I suspect that:
if (GC.getUnitInfo(eUnit).getNotGameOption() != NO_GAMEOPTION)
will work fine, it will treat NO_GAMEOPTION like a -1 in this case and be able to compare it with an integer. The reason that the other one doesn't work is because .isOption() requires that you pass it a GameOptionTypes variable, so will yell at you for trying to give it an integer.