I removed part after part of my AI to narrow it down to this:
Code: Select all
import("queue.fibonacci_heap", "FibonacciHeap", 2);
class BugAI extends AIController
{
}
function BugAI::Start()
{
local someitem = "hello";
::TestStuff(someitem);
while(true) {}
}
function TestStuff(item, prio, someother = 0)
{
local queue = FibonacciHeap();
queue.Insert(item, null);
// queue.Insert(item, prio);
}
What happens here? Well you see, I'm calling the function ::TestStuff here with one parameter (someitem), whereas I didn't define such a function. I only defined one with three values, of which the last has a default value (important! Without this third parameter with default value, the API gives a proper error (wrong number of parameters) instead of crashing OpenTTD).
Now, the intresting stuff starts. Inside the called function, I assume that prio has now a (null) value. This would still be fine, but somehow it isn't: If I call the FibonacciHeap's Insert function with an explicit null as parameter for the priority, it doesn't complain (don't know what exactly it does then, though). However, feeding it with prio instead will crash OpenTTD. This leads me to the assumption that prio doesn't really contain (null), but something undefined or other.
I have not been able to produce a crash of OpenTTD without using the FibonacciHeap here, but I think it's a problem of the framework.
Or isn't it? Am I missing something? Please tell me, if so...