I recently ported our AngelScript gluecode to a recent version (2.20.3). I've rewritten all classes and operator bindings to adhere to the new principle of named functions. Yet if I try to use operators in a script function, I get an error message.
This is the class in question - a simple vector class of 3 floats
mEngine->RegisterObjectType( "TVektor", sizeof(TVektor), asOBJ_VALUE | asOBJ_APP_CLASS_C);
mEngine->RegisterGlobalFunction( "float opMul(const TVektor &in, const TVektor &in)", asFUNCTIONPR( operator *, (const TVektor &, const TVektor &), float), asCALL_CDECL);
mEngine->RegisterGlobalFunction( "TVektor opMul(float, const TVektor &in)", asFUNCTIONPR( operator *, (float, const TVektor &), TVektor), asCALL_CDECL);
mEngine->RegisterGlobalFunction( "TVektor opMul(const TVektor &in, float)", asFUNCTIONPR( operator *, (const TVektor &, float), TVektor), asCALL_CDECL);
All calls are successful. Now I try to use the operator TVektor * float in a script function:
void DestroyTile_3(uint x, uint y, uint layer, TVektor direction, float damage)
{
StartEffect( SomeEffectId, float(x), float(y), 0.0f, direction * damage);
}
and I get an error upon compilation:
No conversion from 'TVektor&' to math type available.[/quote]
Any suggestion what I'm doing wrong? According to my understanding, operator * (TVektor, float) should be invoked, but it isn't. Any hint is appreciated.
Bye, Thomas