Jump to content
  • Advertisement
Sign in to follow this  
Rakkar2

Bug report: Functions returning boolean always true

This topic is 4142 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

Script:
	// ANGELSCRIPT BUG: Must have ==true or it is always true
		if (this.FirstElapse(2000)==true)
C++
bool ScriptThread::FirstElapse(unsigned int time)
{
	if (time==0 && elapsedScriptTime==0)
		return true;
	else
		return elapsedScriptTime >= time && lastScriptTime < time;
}
C++ Registration
result = ScriptManager::engine->RegisterObjectMethod(className, "bool FirstElapse(uint)", asMETHOD(ScriptThread, FirstElapse),asCALL_THISCALL); RakAssert(result>=0);

Share this post


Link to post
Share on other sites
Advertisement
Thanks for the report. I'll look into it a.s.a.p.

There's been too many bug reports lately that I've not been able to do anything about, since I'm unable to reproduce them. :( Hopefully this shouldn't be difficult to fix.

Regards,
Andreas

Share this post


Link to post
Share on other sites
Is it possible that this is the same boolean bug as all the others, where the bool is a 32 bit value but for some reason only the low byte is being copied?

Share this post


Link to post
Share on other sites
It may be partly related, but I doubt it is the exact same bug. That would just be too good to be true.

Share this post


Link to post
Share on other sites
Just started investigating this bug. So far I've not been able to reproduce it, but I've not given up yet. I have a few questions for you though:

What version of AngelScript are you using? What compiler, CPU, and OS are you using?

Share this post


Link to post
Share on other sites
Well, I was able to reproduce the problem by forcing the function to return trash in the upper bytes of the boolean value.


// registered as: bool test_f(uint)
int test_f(unsigned int param)
{
// Force return false with trash in upper bytes, to test if AngelScript is able to handle this
return 0xFFFFFF00;
}


This test shows me that I must add an extra byte code after calling functions returning 1 or 2 byte types to clean the upper bytes of the value. It is indeed a bug in AngelScript. Thanks a lot for the report.

Regards,
Andreas

Share this post


Link to post
Share on other sites
I've just checked in the fix for this bug. You can find it in revision 133.

Please let me know if I have fixed your problem as well, or if I just fixed another unrelated one.

Regards,
Andreas

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!