Advertisement

Bug report: Functions returning boolean always true

Started by May 14, 2007 01:03 AM
5 comments, last by WitchLord 17 years, 6 months ago
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);
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

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
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?
It may be partly related, but I doubt it is the exact same bug. That would just be too good to be true.

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

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?

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

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

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
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

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

This topic is closed to new replies.

Advertisement