I'm having a problem with bools in v1.6.1... If I use global properties, they work as expected. The folllowing prints out 'false true false true'
// In the program
m_pEngine->RegisterGlobalProperty("bool g_bMyBool", &g_bMyBool, 0);
// In the script
g_bMyBool = false;
if (g_bMyBool) Console.Write("true\n");
else Console.Write("false\n");
g_bMyBool = true;
if (g_bMyBool) Console.Write("true\n");
else Console.Write("false\n");
g_bMyBool = false;
if (g_bMyBool) Console.Write("true\n");
else Console.Write("false\n");
g_bMyBool = true;
if (g_bMyBool) Console.Write("true\n");
else Console.Write("false\n");
But if I try and use a bool as an object property, things dont work quite right.
Scripting.GetEngine().RegisterObjectType("CSPhysics", 0, 0);
Scripting.GetEngine().RegisterGlobalProperty("CSPhysics Physics", this, 0);
Scripting.GetEngine().RegisterObjectProperty("CSPhysics", "bool Enable", offsetof(CSPhysics, m_bEnable), 0);
If I did the same test as before, AngelScript will always read the bool 'Physics.Enable' as 'true'. I can assign values to 'Physics.Enable' and those values are applied correctly, but it is only read as true.
D
[edited by - Desdemona on March 22, 2004 9:47:58 PM]
[edited by - Desdemona on March 22, 2004 9:48:32 PM]