Topic: Patch: Prevent access vio when skipping brick id #'s

As of revision 13, if you have a brick file with a gap in the brick id sequence (like 0, 1, 6, 100, 200) and you attempt to build a level using these bricks, an access violation may occur.  This patch file attempts to prevent the access violation.

With this patch, if a brick id is not used, the cursor image is not rendered (src/level.c near line 1480) and a "Missing Brick #" appears on the bottom of the level editor (src/level.c near line 2220).  Finally, a small fix prevents an access vio when skipped bricks are unloaded on application close (src/brick.c around line 90).

I wanted to be able to sort my bricks a bit, like put some bricks at 0-20 and others at 20-40 etc, which was a little tedious before these edits. ;-)

Hope this helps.

Re: Patch: Prevent access vio when skipping brick id #'s

Very good, but your patch inspired me a better idea: instead of showing a "Missing Brick #" message, why don't we just jump to the next valid brick? A simple loop would solve the problem. I'll look at it in details tonight. smile

Re: Patch: Prevent access vio when skipping brick id #'s

Alexandre wrote:

...why don't we just jump to the next valid brick? A simple loop would solve the problem...

That would be even better. big_smile

Re: Patch: Prevent access vio when skipping brick id #'s

Hmmmm, there should be a reload function or... a default brick in case some cannot be read