hi
i have got some confusing error messages about read-only references when calling behaviors (or regular functions)
//as
(...)
CCamera@ pCam = wp.GetCamera();
vec3 end = pCam.Pos + pCam.Dir*1000;
//cpp (some important functions)
r = engine->RegisterGlobalBehaviour(asBEHAVE_ADD,"vec3 f(const vec3 ∈, const vec3 ∈)",asFUNCTION(vec3add),asCALL_CDECL); assert(r >= 0);
r = engine->RegisterGlobalBehaviour(asBEHAVE_SUBTRACT,"vec3 f(const vec3 ∈, const vec3 ∈)",asFUNCTION(vec3sub),asCALL_CDECL); assert(r >= 0);
r = engine->RegisterGlobalBehaviour(asBEHAVE_MULTIPLY,"vec3 f(const float, const vec3 ∈)",asFUNCTION(vec3mul1),asCALL_CDECL); assert(r >= 0);
r = engine->RegisterGlobalBehaviour(asBEHAVE_MULTIPLY,"vec3 f(const vec3 ∈, const float)",asFUNCTION(vec3mul2),asCALL_CDECL); assert(r >= 0);
//and camera class props
r = pSE->RegisterObjectProperty(pClassName,"const vec3 Pos",offsetof(CGRCamera,Pos)); assert(r>=0);
r = pSE->RegisterObjectProperty(pClassName,"const vec3 Dir",offsetof(CGRCamera,Dir)); assert(r>=0);
when i remove 'const' from camera's RegisterObjectProperty everything works fine
and when i compile script below, everything is ok too (which is the most confusing)
//as
const vec3 v1(0,2,0);
const vec3 v2(1,1,0);
vec3 ple = v1 + v2*1000;
are object properties 'const' in different way than local variables? (or can i register behaviors to be more const? :) )
(i've tested that on wip and last stable version (2.7))
hans