Open clowenhg opened 10 years ago
Issue may be a matter of the map data, but until we can add data to other maps we can't test this.
Now that I was able to upload the map the error went away. The error showed up at first, but after uploading something for Map1 it doesn't show up anymore.
Need to try deleting the server.dat and trying again, I think it may be related to the cache having data that the server doesn't.
Now that there was a Map2 linked previously, it looks like the client expect to be able to go there. Going to the edge of the map like I was moving from 1 to 2 causes the Map Failed to Load message to keep coming up. Suspecting that the cache is out of sync with the server.
Looks like deleting the cache removes the issue. Removed the error handling and got a "Subscript out of Range" error.
So it seems like an issue of syncing between the cache and the server data.
Traced the error to this line
modCompress - UncompressString
ReDim bRet(lKey - 1) 'allocate output buffer
In this case, lKey was 0 to ReDim with a -1 seems to be the issue. Going to investigate, but we may just be able to surround this with an if block.
So the bRet(0) is the one throwing an issue. Saying the subscript is out of range.
Call ZUncompress(bRet(0), lKey, bData(0), lCSz) 'decompress to output buffer
It seems like this isn't a problem after the server is established with some maps, but it shows that the map cache could override live map data from the server.
Server: modProcess - ProcessString
If MapRS.NoMatch Then
SendSocket Index, Chr$(21) + String$(2677, vbNullChar)
Else
SendSocket Index, Chr$(21) + MapRS!Data
End If
If the map isn't found in the database, it sends a bunch of nulls. Suspecting that this causes a problem with the compression. Possibly all null is an issue, or the final data size and alignment isn't correct.
Previous note was Case 4 'Request Map, using a different size 2677) later in the code there is this. There is also a Case 104 'Send uncompressed map with the 2677 size.
Server: modProcess - ProcessString
Case 45 'Request Map
If Len(St) = 0 Then
MapRS.Seek "=", .Map
If MapRS.NoMatch Then
SendSocket Index, Chr$(21) + String$(2388, vbNullChar)
Else
SendSocket Index, Chr$(21) + MapRS!Data
End If
Else
Hacker Index, "A.66"
End If
So, my current suspicion is that the case 45 is sending simply blank text, which isn't actually a compressed string. The client isn't aware that it's not compressed, tries to uncompress it and has an error.
Since the entire string is null, there is no size information encoded into the byte string, so defining the bRet to size -1.
It also looks like the map data is compressed when it's placed into the database. The Case 104 explicitly decompresses the map after getting it from the database.
St = UncompressString(MapRS!Data)
So, logging into a fresh server.dat, Map 1 has grass and the message "Map Failed to Load - Showing Anyways" appears.
In the Client, modProcess - ProcessReceivedMap is where that message appears.
It seems to only be happening on Map 1