Jump to content
  • 0

Map cache


Lemongrass

Question


  • Group:  Developer
  • Topic Count:  28
  • Topics Per Day:  0.01
  • Content Count:  547
  • Reputation:   270
  • Joined:  11/08/11
  • Last Seen:  

So as you might have noticed, I have posted a problem with the documentation of the map cache format yesterday.

http://rathena.org/board/tracker/issue-6860-map-cachetxt/

So it was not a real problem for me, but right now I have got a real weird logical issue. I looked through the whole source and debugged a lot of it, but I do not really get, why the map cache is read correctly, although the standard supplied map cache is in a different format.

What am I talking about?

I tried reading the map cache the way the source does and I ran from one problem into another.

The way rAthena source reads the map cache is exactly as documented(since todays bugfix):

uint32 file size

uint16 map count

[map count times]{

char [12] map name

uint16 map width

uint16 map height

uint32 compressed data size

byte [compressed data size] data

}

Well besides the documentation issue, that I will report after this topic is solved, which is again:

struct map_cache_map_info {
   char name[MAP_NAME_LENGTH];
   int16 xs;
   int16 ys;
[color=#ff0000]    int32 len;[/color]
};

vs

<12-characters-long string> map name

<short> X size

<short> Y size

<long> compressed cell data length

<variable> compressed cell data

But anyway. My real problem is as follows:

If you view the map cache with a Hexeditor you can see almost clearly that the structure of the file cannot fit to this description and not even to the source with which it is read!

I found out that the structure has to be like this:

uint32 file size

uint32 map count

[map count times]{

char [12] map name

uint16 map width

uint16 map height

uint32 compressed data size

byte [compressed data size] data

}

Otherwise you will not be able to read the file correctly, not even the first map("alb_ship"). So how is it possible that the source can read it, even if it is in a wrong format?

Link to comment
Share on other sites

1 answer to this question

Recommended Posts


  • Group:  Developer
  • Topic Count:  28
  • Topics Per Day:  0.01
  • Content Count:  547
  • Reputation:   270
  • Joined:  11/08/11
  • Last Seen:  

*bump for the weekend* :D

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...