🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Using enum constants in initialization list

Started by
4 comments, last by VoidSpirit 7 years, 9 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?

Advertisement

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

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