Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Map Editor - Byte Arrays :-(
#7
Gah, now when i try to send the map, it crashes the VB6 that's running the server... what the hell :?

Client Send Code
Code:
Public Sub SendMap()
Dim Buffer() As Byte
  
  Buffer = FillBuffer(VarPtr(Map), LenB(Map))
  
  Call SendDataNew(Buffer, SMsgMapData)
End Sub

Server Receive Code
Code:
Private Sub HandleMapData(ByVal Index As Long, ByVal StartAddr As Long, ByVal ByteLen As Long, ByVal ExtraVar As Long)
  Dim Buffer() As Byte
  Dim i As Long, MapNum As Integer
  Dim nMap As MapRec
  
  If HasAccess(Index, ADMIN_MAPPER) = 0 Then Exit Sub
  
  Buffer = FillBuffer(StartAddr, ByteLen)
  MapNum = GetPlayerMap(Index)
  
  'MsgBox Len(Map(MapNum))
  Call CopyMemory(nMap, Buffer(0), aLen(Buffer))
  Map(MapNum) = nMap
  
  Call SendMapNpcsToMap(MapNum)
  Call SpawnMapNpcs(MapNum)
  
  'Save the map
  Call SaveMap(MapNum)
  
  'Refresh map for everyone online
  For i = 1 To MAX_PLAYERS
    If IsPlaying(i) And GetPlayerMap(i) = MapNum Then
      Call PlayerWarp(i, MapNum, GetPlayerX(i), GetPlayerY(i))
    End If
  Next
End Sub

Those were straight from the MS code that verrigan converted as an example or whatever. But it just brings up that stupid microsoft "error report" screen or whatever.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)