Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Don't load the map twice
#1
eh, its somewhat of a bugfix, but I already posted it in tutorials, so heres the link... http://www.ms.shannaracorp.com/forums/vi...c.php?t=23

What currently happens is the entire map is loaded to get the revision to see if the client has the right version or not, if it does, it loads the map again.

What I did was make it load the map, check if it has the right version, if it does, it makes savemap = to the map already loaded, so the map doesn't need to be loaded twice.
Reply
#2
I would say that is a bug fix.
Reply
#3
Yeah thank you Miss, its a bug fix.
Reply
#4
Dave Wrote:Can't believe no one has caught that Tongue

I was pretty amazed myself Tongue.

I only found it cause I was moving the client to java.
Reply
#5
The url do not longer work, not sure if I remember but should it be like this?

Code:
If GetMapRevision(x)  y Then
                ' We do so we dont need the map
                
                ' Load the map
                Call LoadMap(x)
                
                Call SendData("needmap" & SEP_CHAR & "no" & SEP_CHAR & END_CHAR)
                Exit Sub
            End If

The instead of =.
Reply
#6
Actualy is = and not .
If the Revision you have on your map is the same as the one the server has, then you dont need to receive the map and just load it.
Reply
#7
No.

The tutorial replaced GetMapRevision
It loaded the map into tempMap after modifing loadmap (or you could have created a getMap to return a map it loads
then it checks the revisions, and if equal, it sets savemap = to tempmap
Reply
#8
William Wrote:The url do not longer work, not sure if I remember but should it be like this?
http://key2heaven.net/ms/forums/viewtopic.php?t=23

Incase you haven't figured it out already. =)
Reply
#9
Ok I hate to bring this up again(cause of old date), but I noticed that I of course still had the bug where it ALWAYS requested a new map.

Well I made these changes and it seems to work perfectly fine now.

I Changed:
If FileExist(MAP_PATH & "map" & x & MAP_EXT, True) Then
To:
If FileExist(MAP_PATH & "map" & x & MAP_EXT, False) = True Then


Code:
If FileExist(MAP_PATH & "map" & x & MAP_EXT, False) = True Then
            ' Check to see if the revisions match
            If GetMapRevision(x) = y Then

                Call LoadMap(x)
                Call SendData("needmap" & SEP_CHAR & "no" & SEP_CHAR & END_CHAR)
                Exit Sub
            End If
        End If
        
        ' Either the revisions didn't match or we dont have the map, so we need it
        Call SendData("needmap" & SEP_CHAR & "yes" & SEP_CHAR & END_CHAR)
        Exit Sub
    End If

I tested it and had it display every time I was on a new map or an old map; had my girlfriend make a simple change and it showed I was on a new map. While walking around on the old maps it displayed I was on an old map.

I noticed their was an optimizing tutorial and some other stuff. Do they make this any better? Cause the fix I made actually seemed to work perfectly fine all the time and I noticed that the maps were loading quicker.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)