Jump to content
  • Advertisement
Sign in to follow this  
VoidSpirit

Using enum constants in initialization list

This topic is 746 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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!

Edited by VoidSpirit

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!