Open Surge Forum

A fun 2D retro platformer inspired by Sonic games and a game creation system

You are not logged in.

Announcement

Our community has moved to Discord! https://discord.gg/w8JqM7m

#1 2009-03-03 10:45:39

Celdecea
Member
From: Southern Oregon
Registered: 2009-02-23
Posts: 147

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.

Offline

#2 2009-03-03 16:09:43

Alexandre
Administrator
From: Brazil
Registered: 2009-01-27
Posts: 3,304
Website

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

Offline

#3 2009-03-04 03:04:58

Celdecea
Member
From: Southern Oregon
Registered: 2009-02-23
Posts: 147

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

Offline

#4 2009-03-04 19:26:50

Neoblast
Member
Registered: 2009-02-11
Posts: 46

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

Offline

Board footer

Powered by FluxBB  hosted by tuxfamily.org