Jump to content
Eternal Lands Official Forums
0ctane

cal3d "enum Boolean" conflicts with system Boolean

Recommended Posts

There are a number of changes to sound.h with the inclusion of NEW_FILE_IO. In an effort to migrate the Mac OS X client to all the new code changes, I found a way to remove the Mac dependancy on ALUT_WAV. This requires me to add two new files of Mac specific code, and I can then use OpenAL 1.1 (previously had to use 1.0). We can use the Mac's native sound capabilities and remove a define. Woohoo!

 

Not so fast.

./el_osx/cal3d_wrapper.h:101: error: using typedef-name 'Boolean' after 'enum'
/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/CoreServices.framework/Headers/../Frameworks/CarbonCore.framework/Headers/MacTypes.h:288: error: 'Boolean' has a previous declaration here
/Users/jeff/programs/el_osx/cal3d_wrapper.h:150: error: using typedef-name 'Boolean' after 'enum'
/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/CoreServices.framework/Headers/../Frameworks/CarbonCore.framework/Headers/MacTypes.h:288: error: 'Boolean' has a previous declaration here
./el_osx/cal3d_wrapper.h:150: error: invalid type in declaration before ';' token
...

Well, I want to kick the cal3d dev for screwing with Boolean. Any thoughts on how to get around this problem? Can cal3d's Boolean enum be turned off after use?

 

Of course, the latest version of cal3d has "CalBoolean" instead of "Boolean" enum'd. Grrr.... Will the new cal3d work in EL? Anyone feel like tackling it?

Share this post


Link to post
Share on other sites

We should probably simply remove the enum:

me@host:~/tmp/elc$ grep -E "True|False" *.{h,c,cpp}
cal3d_wrapper.h:#undef True
cal3d_wrapper.h:#undef False
cal3d_wrapper.h:  False = 0,
cal3d_wrapper.h:  True = 1
cal3d_wrapper.cpp:	  return self->executeAction(id, delayIn, delayOut, 1.0f,true) ? True : False;

The only place where it's used is CalMixer_ExecuteAction_Stop, where we could simply return an int. I even believe the return value of that function is never checked...

Share this post


Link to post
Share on other sites

Can we redefine CalMixer_ExecuteAction_Stop?

extern "C" CAL3D_WRAPPER_API enum Boolean CalMixer_ExecuteAction_Stop(CalMixer *self, int id, float delayIn, float delayOut)
{
return self->executeAction(id, delayIn, delayOut, 1.0f,true) ? True : False;
}

extern "C" CAL3D_WRAPPER_API int CalMixer_ExecuteAction_Stop(CalMixer *self, int id, float delayIn, float delayOut)
{
return self->executeAction(id, delayIn, delayOut, 1.0f,true) ? 1 : 0;
}

Would that even work?

 

[edit] And what is keeping us from migrating to cal3d version 1.2?

Edited by 0ctane

Share this post


Link to post
Share on other sites

I think the redefine as proposed should simply work (though I haven't tested it), so go ahead and try :rolleyes:

 

As for migrating to cal3d 1.2... I have no idea. Is it necessary/useful/desirable/smart to do so?

Share this post


Link to post
Share on other sites
I think the redefine as proposed should simply work (though I haven't tested it), so go ahead and try :rolleyes:

Seems fine. cal3d_wrapper.h needs a small change for it too on line 429. Can anyone else test it out before I commit the change?

As for migrating to cal3d 1.2... I have no idea. Is it necessary/useful/desirable/smart to do so?

Well, the version being used right now is pretty old. Old might translate to "stable".

Share this post


Link to post
Share on other sites

Oops.

We also use CalModel_AttachMesh, CalMixer_BlendCycle, and CalMixer_ClearCycle that have enum Boolean.

 

In cal3d_wrappers.cpp, line 17:

extern "C" CAL3D_WRAPPER_API int CalMixer_ExecuteAction_Stop(CalMixer *self, int id, float delayIn, float delayOut)

 

In cal3d_wrappers.h, search replace all "enum Boolean" to "int". Comment out the enum Boolean lines 99-105.

 

In cal.h, line 10:

int CalMixer_ExecuteAction_Stop(struct CalMixer *self, int id, float delayIn, float delayOut);

Edited by 0ctane

Share this post


Link to post
Share on other sites
As for migrating to cal3d 1.2... I have no idea. Is it necessary/useful/desirable/smart to do so?

Last time I tried there were one or two functions that we were using that weren't provided in 0.12, so upgrading would mean rewriting some of the cal3d wrapper.

Share this post


Link to post
Share on other sites

Well, I am experiencing some other headaches in getting OpenAL without ALUT_WAV working, so I guess I can hold off on the modifications to cal*.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×