Hi Andreas,
I've run into a small problem with the latest WIP version of AngelScript. The problematic line of code reads as follows:
ent.renderfx = RF_MINLIGHT | RF_WEAPONMODEL | RF_FORCENOLOD | ( cg_shadows.integer < 2 ? RF_NOSHADOW : 0 );
And the error is:
^1ERROR: D:/Projects/rapid/game/base/progs/client/main/vweapon.as 326:98: Can't implicitly convert from 'int' to 'cg_entrenderfx_e'.^1
^1ERROR: D:/Projects/rapid/game/base/progs/client/main/vweapon.as 326:73: Both expressions must have the same type
ent.renderfx is an int and all RF_ constants are cg_entrenderfx_e
enums. Now to workaround the problem I have to explicitly convert RF_NOSHADOW
to int, which seems a bit weird because AS should have no trouble converting enums to int, at least it works with simpe assignments without any hassle. Does the ternary operator which mixes ints and enums need some special handling in the compiler, perhaps?
Thanks.