100th callback problem
In Dink Smallwood 1.08(maybe 1.07 too), adding a callback with an ID of 100
will corrupt memory and may distort game data, crash the game, or go on without damaging anything important.
Beware if writing callback intensive scripts.
will corrupt memory and may distort game data, crash the game, or go on without damaging anything important.
Beware if writing callback intensive scripts.
I've never heard of this, can you give an example of the script you discovered this in? Seth is still fixing stuff like that for DinkHD and I'm pretty sure he'd be interested in knowing about this critical bug.
Yup. It's not that '100' is special while '101' would theoretically work, it's just that the game runs out of callback slots. This puts a limit on recursion in DinkC. Beuc also noticed this while making his minesweeper clone, which is how I know about it.
There's a limit to everything in DinkC it seems (variables, sprites, scripts, callbacks, etc.). Seth apparently only used fixed size arrays. I don't think it would be that hard to remove the limits but it would be better to just replace DinkC with a better language altogether if someone was interested in that in my opinion.
There's a limit to everything in DinkC it seems (variables, sprites, scripts, callbacks, etc.). Seth apparently only used fixed size arrays. I don't think it would be that hard to remove the limits but it would be better to just replace DinkC with a better language altogether if someone was interested in that in my opinion.
I wish someone would, but its doubtful after all these years that someone would in fact go to the trouble
RedInk was considering adding Python scripting but timing was an issue. Beuc was going to add guile scripting but hasn't done it for some reason.
Well, the engine can handle running out of callback slots; it simply returns 0 as the callback ID.
I had problems running the kill_all_callbacks procedure; it runs from 1 to max_callbacks(100), while the table has max_callbacks(0 to 99) slots.
I had tinkered with the source and a bitmap was placed right after the callback table, the inexistent slot 100 was marked as active, and the game crashed as soon as it tried to kill_all_callbacks.
tl;dr: editing the line
in dinkvar.h to
should fix it.
I had problems running the kill_all_callbacks procedure; it runs from 1 to max_callbacks(100), while the table has max_callbacks(0 to 99) slots.
I had tinkered with the source and a bitmap was placed right after the callback table, the inexistent slot 100 was marked as active, and the game crashed as soon as it tried to kill_all_callbacks.
tl;dr: editing the line
call_back callback[max_callbacks]
in dinkvar.h to
call_back callback[max_callbacks+1]
should fix it.