Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Too many local, nonstatic variables
#1
I get this error, after applying Verrigan's Seamless maps tut (I never got this problem any other time I added it, but yeah).

Anyone have any idea?
Reply
#2
Ahh.. this has been brought up heaps if times.. Um.. I seriously cant remember what the fix was i think it might have something to do with video and cpu memory.. I cant actually remember though.. Sorry..
Reply
#3
you get this error if a User Defined Type is exceeding 64KB of
static data, meaning set arrays, ect.

So what you do to fix it? Remove some of the things you added like layers, ect. or make dynamic tiles and maps so they aren't allocated as static data.
Reply
#4
I have no idea how to do that, and all I added was Verrigan's seamless maps. Now, when I had my old source (Oblivion, ManaSync), I added this just to test it, and everything worked fine, I've never seen this before. Maybe it's what Dark said, maybe I'll switch over to Video Memory.

Thanks for the help guys.
Reply
#5
whats highlighted.
Reply
#6
Make them dynamic by changing anything like this:

Tile(0 to x, 0 to x) as ...

to

Tile() as ...

then redim it somewhere, perhaps the load map or something like that.

Redim Preserve Map(x).Tile(0 to x, 0 to x)

In client, you don't need Preserve.

Make since?
Reply
#7
Yeah, I just did that, thanks. It fixed that problem, but now I get a subscript out of range with this:

Code:
Ground = Map.Tile(X, Y).Ground

In this:

Code:
Sub BltTile(ByVal X As Long, ByVal Y As Long)
  Dim Bufx As Long, Bufy As Long
  Dim i As Integer
  Dim Ground As Long
  Dim Anim1 As Long
  Dim Anim2 As Long

  For i = -1 To 7
    If i = -1 Then
      Ground = Map.Tile(X, Y).Ground
      Anim1 = Map.Tile(X, Y).Mask
      Anim2 = Map.Tile(X, Y).Anim
      Bufx = (X * PIC_X) + (PIC_X * (MAX_MAPX + 1))
      Bufy = (Y * PIC_Y) + (PIC_Y * (MAX_MAPY + 1))
    Else
      Ground = SMaps(i).Tile(X, Y).Ground
      Anim1 = SMaps(i).Tile(X, Y).Mask
      Anim2 = SMaps(i).Tile(X, Y).Anim
      Select Case i
      Case 0
        Bufx = (X * PIC_X) + (PIC_X * (MAX_MAPX + 1))
        Bufy = Y * PIC_Y
      Case 1
        Bufx = (X * PIC_X) + (2 * (PIC_X * (MAX_MAPX + 1)))
        Bufy = Y * PIC_Y
      Case 2
        Bufx = (X * PIC_X) + (2 * (PIC_X * (MAX_MAPX + 1)))
        Bufy = (Y * PIC_Y) + (PIC_Y * (MAX_MAPY + 1))
      Case 3
        Bufx = (X * PIC_X) + (2 * (PIC_X * (MAX_MAPX + 1)))
        Bufy = (Y * PIC_Y) + (2 * (PIC_Y * (MAX_MAPY + 1)))
      Case 4
        Bufx = (X * PIC_X) + (PIC_X * (MAX_MAPX + 1))
        Bufy = (Y * PIC_Y) + (2 * (PIC_Y * (MAX_MAPY + 1)))
      Case 5
        Bufx = X * PIC_X
        Bufy = (Y * PIC_Y) + (2 * (PIC_Y * (MAX_MAPY + 1)))
      Case 6
        Bufx = X * PIC_X
        Bufy = (Y * PIC_Y) + (PIC_Y * (MAX_MAPY + 1))
      Case 7
        Bufx = X * PIC_X
        Bufy = Y * PIC_Y
      End Select
    End If
    
    rec.top = Int(Ground / 7) * PIC_Y
    rec.Bottom = rec.top + PIC_Y
    rec.Left = (Ground - Int(Ground / 7) * 7) * PIC_X
    rec.Right = rec.Left + PIC_X
    Call DD_BackBuffer.BltFast(Bufx, Bufy, DD_TileSurf, rec, DDBLTFAST_WAIT)
    
    If (MapAnim = 0) Or (Anim2  0 Then
              rec.top = Int(Anim2 / 7) * PIC_Y
              rec.Bottom = rec.top + PIC_Y
              rec.Left = (Anim2 - Int(Anim2 / 7) * 7) * PIC_X
              rec.Right = rec.Left + PIC_X
              Call DD_BackBuffer.BltFast(Bufx, Bufy, DD_TileSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
        End If
    End If
  Next
End Sub

[EDIT] Ground = 0 If that helps any.
Reply
#8
did you redim the maps? and if you did (on game load) did you redim preserve when new maps are added?
Reply
#9
double post but whatever.

its fixed now

To Fix (for future reference):

Code:
Main():
Redim SaveMap.Tiles()
Redim Maps.Tiles()
Redim SMaps(7)
Redim SMap(i).Tiles() (using for i = 0 to 7)

Sub iLoadMap:
Redim iLoadMap

And then another Redim of SMaps(7) and .tiles in the other sub under iLoadMap
Reply
#10
Lol.. i was way off.. Oh well.. Big Grin
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)