Advertisement

Using enum constants in initialization list

Started by September 02, 2016 08:03 PM
4 comments, last by VoidSpirit 8 years, 2 months ago

Hello!

I'm registering some enums, i.e. TmColors = {clWhite, clBlack etc...}

and trying to use it in initialization lists:

array<int> a={clWhite,clBlack};

and have no result - array elements are empty.

What i do wrong?

You're not doing anything wrong. This looks like a bug. I'll investigate it.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement

Thanks for answer!

I solved it (it works). Really it for dictionary type:

in buffer constructor adding code fragment for enum type in buffer:

if( typeId >= asTYPEID_INT8 && typeId <= asTYPEID_DOUBLE )

{...

}

// ADDED:

else if(engine->GetTypeInfoById(typeId)->GetFlags() & asOBJ_ENUM)
{typeId=asTYPEID_UINT32;
Set(name, (asINT64)*(unsigned int*)ref);
}

I think for other containers it is same case.

I haven't been able to reproduce the problem you mentioned. Can you give a more detailed example of when the problem occurs?

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

OK, I'll certainly try it, but I need few days to restore and compile my project

I have verified my code with list initializations. Sorry, my bad - i tryed to add implicit casting to CScriptDictValue and it had cause confusion.

Thanks for you answers!

This topic is closed to new replies.

Advertisement