vbGore Free Online RPG Engine

Revolutionizing Visual Basic ORPG Development
It is currently Sat May 18, 2013 12:19 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Effect_NextOpenSlot
PostPosted: Sat Apr 07, 2007 8:43 am 
Cubic Root of 1

Joined: Sat Sep 16, 2006 4:00 pm
Posts: 290
The function Effect_NextOpenSlot returns a byte, but if the maximum amount of effect on screen has been reached, it returns -1, causing an overflow error.

Code:
Private Function Effect_NextOpenSlot() As Byte

Dim EffectIndex As Byte

'Find The Next Open Effect Slot

    Do
        EffectIndex = EffectIndex + 1   'Check The Next Slot
        If EffectIndex > NumEffects Then    'Dont Go Over Maximum Amount
            Effect_NextOpenSlot = -1
            Exit Function
        End If
    Loop While Effect(EffectIndex).Used = True    'Check Next If Effect Is In Use

    'Return the next open slot
    Effect_NextOpenSlot = EffectIndex

End Function


And in the spells subs there is a handler for the -1 value, but the variable is declared as byte:

Code:
Dim EffectIndex As Byte
Dim LoopC As Long

'Get the next open effect slot

    EffectIndex = Effect_NextOpenSlot
    If EffectIndex = -1 Then Exit Function


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 07, 2007 9:24 am 
Site Admin

Joined: Fri Jul 14, 2006 4:00 pm
Posts: 11230
Location: Washington
Haha whoops, good catch. :lol:

I think I got it all fixed up - change it to integers. How'd you find this, anyways? Don't think I would've noticed that for ages.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 07, 2007 10:35 pm 
Cubic Root of 1

Joined: Sat Sep 16, 2006 4:00 pm
Posts: 290
Hahahha, I made a failed quick attempt to render particles in the connect form and realized that xD


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 8 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group