0

I'm getting a error while calling this function "An unhandled exception of type 'System.OverflowException' occurred in"

Public Structure GlowStruct
    Public r As Single
    Public g As Single
    Public b As Single
    Public a As Single
    Public rwo As Boolean
    Public rwuo As Boolean
End Structure

Private Sub DrawGlow(ByVal pGlowIn As Int32, ByVal col As GlowStruct)
    Dim pGlowObj = Mem.ReadInt(bClient + Offset.oGlowObject, 4)
    Mem.WriteSingle(pGlowObj + ((pGlowIn * &H38) + &H4), 4, col.r)
    Mem.WriteSingle(pGlowObj + ((pGlowIn * &H38) + &H8), 4, col.g)
    Mem.WriteSingle(pGlowObj + ((pGlowIn * &H38) + &HC), 4, col.b)
    Mem.WriteSingle(pGlowObj + ((pGlowIn * &H38) + &H10), 4, col.a)
    Mem.WriteBool(pGlowObj + ((pGlowIn * &H38) + &H24), 1, col.rwo)
    Mem.WriteBool(pGlowObj + ((pGlowIn * &H38) + &H25), 1, col.rwuo)
End Sub
1
  • What value do you send as pGlowObj? - By the way how's the multithreading going? :) Commented Apr 1, 2016 at 0:13

1 Answer 1

1

When you multiply pGlowObj it is being treated as an integer still. Presumably pGlowObj * &H38 exceeds the maximum value for an integer.

Since you want a Single at the end anyway of the calculation anyway, just force pGlowObj to be a single to start with, and then it won't overflow:

Dim pGlowObj as Single = Mem.ReadInt(bClient + Offset.oGlowObject, 4)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.